Missing services E2E tests #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Missing services E2E tests" | |
on: | |
workflow_dispatch: {} | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
env: | |
SERVAL_CLIENT_ID: ${{ secrets.SERVAL_CLIENT_ID }} | |
SERVAL_CLIENT_SECRET: ${{ secrets.SERVAL_CLIENT_SECRET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
ClearML_AccessKey: ${{ secrets.ClearML_AccessKey }} | |
ClearML_SecretKey: ${{ secrets.ClearML_SecretKey }} | |
SERVAL_HOST_URL: http://localhost | |
SERVAL_AUTH_URL: https://sil-appbuilder.auth0.com | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Get Machine | |
run: cd .. && git clone https://github.com/sillsdev/machine.git && cd machine && dotnet build && cd ../serval && dotnet build | |
- name: Restore dotnet tools | |
run: dotnet tool restore | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Start containers | |
run: docker compose -f "docker-compose.yml" up -d && sleep 20 #allow time for mongo to start up properly | |
- name: Debug network | |
run: docker ps -a && docker logs --since 10m serval_cntr && docker logs --since 10m echo_cntr && docker logs --since 10m machine-engine-cntr && docker logs --since 10m serval-mongo-1 && docker logs --since 10m machine-job-cntr | |
- name: Pre-Test | |
run: sudo mkdir -p /var/lib/serval && sudo chmod 777 /var/lib/serval | |
#Mongo | |
- name: Test Working Mongo | |
run: dotnet test --no-build --verbosity normal --filter "TestCategory=MongoWorking" | |
- name: Kill Mongo | |
run: docker stop serval-mongo-1 | |
- name: Test Not Working Mongo | |
run: dotnet test --no-build --verbosity normal --filter "TestCategory=MongoNotWorking" | |
- name: Restart Mongo | |
run: docker start serval-mongo-1 && sleep 20 | |
#Engine Server | |
- name: Test Working Engine Server | |
run: dotnet test --no-build --verbosity normal --filter "TestCategory=EngineServerWorking" | |
- name: Kill Engine Server | |
run: docker stop machine-engine-cntr | |
- name: Test Not Working EngineServer | |
run: dotnet test --no-build --verbosity normal --filter "TestCategory=EngineServerNotWorking" | |
- name: Restart Engine Server | |
run: docker start machine-engine-cntr && sleep 5 | |
#ClearML | |
- name: Restart containers with new env | |
run: docker compose down && docker compose -f "docker-compose.yml" up -d && sleep 20 #allow time for mongo to start up properly | |
env: | |
ClearML_SecretKey: "not_the_right_key" | |
- name: Test Not Working ClearML | |
run: dotnet test --no-build --verbosity normal --filter "TestCategory=ClearMLNotWorking" | |
env: | |
ClearML_SecretKey: "not_the_right_key" | |
#AWS | |
- name: Restart containers with new env | |
run: docker compose down && docker compose -f "docker-compose.yml" up -d && sleep 20 #allow time for mongo to start up properly | |
env: | |
AWS_SECRET_ACCESS_KEY: "not_the_right_key" | |
- name: Test Not Working AWS | |
run: dotnet test --no-build --verbosity normal --filter "TestCategory=AWSNotWorking" | |
env: | |
AWS_SECRET_ACCESS_KEY: "not_the_right_key" | |
#Clean up | |
- name: Debug network (Post test) | |
if: ${{ failure() }} | |
run: docker ps -a && docker logs --since 10m serval_cntr && docker logs --since 10m echo_cntr && docker logs --since 10m machine-engine-cntr && docker logs --since 10m serval-mongo-1 && docker logs --since 10m machine-job-cntr | |
- name: Stop containers | |
if: ${{ success() || failure() }} | |
run: docker compose down |