Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamoDb Integration tests #132

Open
lezzi opened this issue May 29, 2021 · 1 comment
Open

DynamoDb Integration tests #132

lezzi opened this issue May 29, 2021 · 1 comment

Comments

@lezzi
Copy link
Contributor

lezzi commented May 29, 2021

Automate local in-memory dynamodb start to simplify writing integration tests. It can also be used as an alternative to mocking the fluent API.

Something like:

await using var inMemoryContext = InMemoryDynamoDbFactory.CreateAsync();

// Use inMemoryContext as a regular context

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html

@lezzi lezzi added enhancement New feature or request suggestion and removed enhancement New feature or request labels May 29, 2021
@Newp
Copy link

Newp commented Jan 1, 2022

#172

This issue will help to conduct an integration test.

I test using github action, and because github can use docker-in-docker, local dynamodb is performed on the step of github action, and in the unit test, a client-server environment very similar to the real environment such as a separate in memory context is created.

  • In a docker-in-docker environment, it is recommended to run the docker run before .net core installation because it takes time before the container image is completely warmed up.

  • Below is the github flow that I am actually using.

`
name: xxx UnitTest

on:
pull_request:

jobs:
unittest:
runs-on: ubuntu-latest
defaults:
run :
working-directory: ./server

steps:
- uses: actions/checkout@v2

- name : Run Docker Images
  run: docker-compose -f ./docker-compose-unittest.yml up -d
  working-directory: ./docker

- name: Setup .NET Core
  uses: actions/setup-dotnet@v1
  with:
    dotnet-version: 3.1.301

- name: Install dependencies
  run: dotnet restore

- name: Build
  run: dotnet build --configuration Release --no-restore

- name: curl - dynamodb
  run : curl http://localhost:8000

- name: Test
  run: dotnet test`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants