Open lezzi opened 3 years ago
https://github.com/AllocZero/EfficientDynamoDb/issues/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`
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:
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html