diff --git a/.ci/compose.test.aui.yml b/.ci/compose.test.aui.yml new file mode 100644 index 0000000000..c96e332e70 --- /dev/null +++ b/.ci/compose.test.aui.yml @@ -0,0 +1,17 @@ +services: + admin-ui: + container_name: admin-ui-test + hostname: admin-ui + image: admin-ui:0.0.1 + environment: + - ASPNETCORE_ENVIRONMENT=Development + ports: + - "5173:8080" + depends_on: + database-migrator: + condition: service_completed_successfully + rabbitmq: + condition: service_started + configs: + - source: Config + target: app/appsettings.override.json diff --git a/.ci/compose.test.capi.yml b/.ci/compose.test.capi.yml new file mode 100644 index 0000000000..62e1b3fc35 --- /dev/null +++ b/.ci/compose.test.capi.yml @@ -0,0 +1,19 @@ +services: + consumer-api: + container_name: consumer-api-test + hostname: consumer-api + image: consumer-api:0.0.1 + environment: + - ASPNETCORE_ENVIRONMENT=Development + ports: + - "5000:8080" + depends_on: + database-migrator: + condition: service_completed_successfully + rabbitmq: + condition: service_started + azure-storage-emulator: + condition: service_started + configs: + - source: Config + target: app/appsettings.override.json diff --git a/.ci/docker-compose.test.postgres.yml b/.ci/compose.test.postgres.yml similarity index 100% rename from .ci/docker-compose.test.postgres.yml rename to .ci/compose.test.postgres.yml diff --git a/.ci/docker-compose.test.sqlserver.yml b/.ci/compose.test.sqlserver.yml similarity index 100% rename from .ci/docker-compose.test.sqlserver.yml rename to .ci/compose.test.sqlserver.yml diff --git a/.ci/docker-compose.test.yml b/.ci/compose.test.yml similarity index 66% rename from .ci/docker-compose.test.yml rename to .ci/compose.test.yml index 391acf0b8f..e44fe35169 100644 --- a/.ci/docker-compose.test.yml +++ b/.ci/compose.test.yml @@ -1,40 +1,4 @@ services: - consumer-api: - container_name: consumer-api-test - hostname: consumer-api - image: consumer-api:0.0.1 - environment: - - ASPNETCORE_ENVIRONMENT=Development - ports: - - "5000:8080" - depends_on: - database-migrator: - condition: service_completed_successfully - rabbitmq: - condition: service_started - azure-storage-emulator: - condition: service_started - configs: - - source: Config - target: app/appsettings.override.json - - admin-ui: - container_name: admin-ui-test - hostname: admin-ui - image: admin-ui:0.0.1 - environment: - - ASPNETCORE_ENVIRONMENT=Development - ports: - - "5173:8080" - depends_on: - database-migrator: - condition: service_completed_successfully - rabbitmq: - condition: service_started - configs: - - source: Config - target: app/appsettings.override.json - event-handler-service: container_name: event-handler-service-test image: event-handler-service:0.0.1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a2e21e5121..abf6c1b4e8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -209,27 +209,85 @@ jobs: pattern: docker-* merge-multiple: true - - name: Load Docker images - run: ./.ci/loadDockerImages.sh + - name: Load Docker images and build test code + run: | + { + ./.ci/loadDockerImages.sh + } & + { + dotnet restore Backbone.sln; + dotnet build --no-restore Backbone.sln + } + wait + + #### Admin UI integration tests + + - name: Restart compose stack + id: restart-compose-stack-1 + run: | + docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.sqlserver.yml -f ./.ci/compose.test.aui.yml down -v; + docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.sqlserver.yml -f ./.ci/compose.test.aui.yml up -d --no-build - - name: Run integration tests - run: ./.ci/integrationTest.sqlserver.sh + - name: Run Admin UI integration tests + id: run-aui-integration-tests + if: (success() || failure()) && (steps.restart-compose-stack-1.outcome == 'success') + run: dotnet test --no-restore --no-build --logger "GitHubActions;summary.includeNotFoundTests=false" AdminApi/test/AdminApi.Tests.Integration + env: + ADMIN_API_BASE_ADDRESS: "http://localhost:5173" - name: Save Docker Logs - if: failure() - run: docker compose -f ./.ci/docker-compose.test.yml -f ./.ci/docker-compose.test.sqlserver.yml logs > docker-log.txt + if: (success() || failure()) && (steps.run-aui-integration-tests.outcome == 'failure') + run: docker compose -f ./.ci/compose.test.aui.yml logs > aui.integration-test.sqlserver.txt + + #### Consumer API integration tests + + - name: Restart compose stack + id: restart-compose-stack-2 + if: success() || failure() + run: | + docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.sqlserver.yml -f ./.ci/compose.test.capi.yml down -v; + docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.sqlserver.yml -f ./.ci/compose.test.capi.yml up -d --no-build + + - name: Run Consumer API integration tests + id: run-capi-integration-tests + if: (success() || failure()) && (steps.restart-compose-stack-2.outcome == 'success') + run: dotnet test --no-restore --no-build --logger "GitHubActions;summary.includeNotFoundTests=false" AdminApi/test/AdminApi.Tests.Integration + env: + CONSUMER_API_BASE_ADDRESS: "http://localhost:5000" + + - name: Save Docker Logs + if: (success() || failure()) && (steps.run-capi-integration-tests.outcome == 'failure') + run: docker compose -f ./.ci/compose.test.capi.yml logs > capi.integration-test.sqlserver.txt + + #### Identity Deletion Job integration tests + + - name: Restart compose stack + id: restart-compose-stack-3 + if: success() || failure() + run: | + docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.sqlserver.yml down -v; + docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.sqlserver.yml up -d --no-build + + - name: Run Identity Deletion Job integration tests + id: run-idj-integration-tests + if: (success() || failure()) && (steps.restart-compose-stack-3.outcome == 'success') + run: | + mv Jobs/test/Job.IdentityDeletion.Tests.Integration/appsettings.override.json ./Jobs/test/Job.IdentityDeletion.Tests.Integration/appsettings.override.json.bak + cp .ci/appsettings.override.postgres.local.json Jobs/test/Job.IdentityDeletion.Tests.Integration/appsettings.override.json + dotnet build --no-restore Jobs/test/Job.IdentityDeletion.Tests.Integration + dotnet test --no-restore --no-build --logger "GitHubActions;summary.includeNotFoundTests=false" Jobs/test/Job.IdentityDeletion.Tests.Integration - name: Archive logs if: failure() uses: actions/upload-artifact@v4 with: - name: integration-test-sqlserver-docker-logs - path: docker-log.txt + name: aui.integration-test.sqlserver + path: capi.integration-test.sqlserver.txt env: DOTNET_CONSOLE_ANSI_COLOR: true integration-test-postgres: - name: Run Integration Tests (on Postgres) + name: Run Integration Tests (on SQL Server) runs-on: ubuntu-latest needs: image-test-builds steps: @@ -254,22 +312,80 @@ jobs: pattern: docker-* merge-multiple: true - - name: Load Docker images - run: ./.ci/loadDockerImages.sh + - name: Load Docker images and build test code + run: | + { + ./.ci/loadDockerImages.sh + } & + { + dotnet restore Backbone.sln; + dotnet build --no-restore Backbone.sln + } + wait + + #### Admin UI integration tests + + - name: Restart compose stack + id: restart-compose-stack-1 + run: | + docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.postgres.yml -f ./.ci/compose.test.aui.yml down -v; + docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.postgres.yml -f ./.ci/compose.test.aui.yml up -d --no-build - - name: Run integration tests - run: ./.ci/integrationTest.postgres.sh + - name: Run Admin UI integration tests + id: run-aui-integration-tests + if: (success() || failure()) && (steps.restart-compose-stack-1.outcome == 'success') + run: dotnet test --no-restore --no-build --logger "GitHubActions;summary.includeNotFoundTests=false" AdminApi/test/AdminApi.Tests.Integration + env: + ADMIN_API_BASE_ADDRESS: "http://localhost:5173" - name: Save Docker Logs - if: failure() - run: docker compose -f ./.ci/docker-compose.test.yml -f ./.ci/docker-compose.test.postgres.yml logs > docker-log.txt + if: (success() || failure()) && (steps.run-aui-integration-tests.outcome == 'failure') + run: docker compose -f ./.ci/compose.test.aui.yml logs > aui.integration-test.postgres.txt + + #### Consumer API integration tests + + - name: Restart compose stack + id: restart-compose-stack-2 + if: success() || failure() + run: | + docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.postgres.yml -f ./.ci/compose.test.capi.yml down -v; + docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.postgres.yml -f ./.ci/compose.test.capi.yml up -d --no-build + + - name: Run Consumer API integration tests + id: run-capi-integration-tests + if: (success() || failure()) && (steps.restart-compose-stack-2.outcome == 'success') + run: dotnet test --no-restore --no-build --logger "GitHubActions;summary.includeNotFoundTests=false" AdminApi/test/AdminApi.Tests.Integration + env: + CONSUMER_API_BASE_ADDRESS: "http://localhost:5000" + + - name: Save Docker Logs + if: (success() || failure()) && (steps.run-capi-integration-tests.outcome == 'failure') + run: docker compose -f ./.ci/compose.test.capi.yml logs > capi.integration-test.postgres.txt + + #### Identity Deletion Job integration tests + + - name: Restart compose stack + id: restart-compose-stack-3 + if: success() || failure() + run: | + docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.postgres.yml down -v; + docker compose -f ./.ci/compose.test.yml -f ./.ci/compose.test.postgres.yml up -d --no-build + + - name: Run Identity Deletion Job integration tests + id: run-idj-integration-tests + if: (success() || failure()) && (steps.restart-compose-stack-3.outcome == 'success') + run: | + mv Jobs/test/Job.IdentityDeletion.Tests.Integration/appsettings.override.json ./Jobs/test/Job.IdentityDeletion.Tests.Integration/appsettings.override.json.bak + cp .ci/appsettings.override.postgres.local.json Jobs/test/Job.IdentityDeletion.Tests.Integration/appsettings.override.json + dotnet build --no-restore Jobs/test/Job.IdentityDeletion.Tests.Integration + dotnet test --no-restore --no-build --logger "GitHubActions;summary.includeNotFoundTests=false" Jobs/test/Job.IdentityDeletion.Tests.Integration - name: Archive logs if: failure() uses: actions/upload-artifact@v4 with: - name: integration-test-postgres-docker-logs - path: docker-log.txt + name: aui.integration-test.postgres + path: capi.integration-test.postgres.txt env: DOTNET_CONSOLE_ANSI_COLOR: true @@ -307,7 +423,7 @@ jobs: run: ./backbone/.ci/loadDockerImages.sh - name: Run Consumer API & Admin API - run: docker compose -f ./backbone/.ci/docker-compose.test.yml -f ./backbone/.ci/docker-compose.test.sqlserver.yml up -d --no-build + run: docker compose -f ./backbone/.ci/compose.test.yml -f ./backbone/.ci/compose.test.sqlserver.yml -f ./.ci/compose.test.capi.yml up -d --no-build - name: Install runtime dependencies working-directory: ./runtime @@ -325,7 +441,7 @@ jobs: - name: Save Docker Logs if: failure() - run: docker compose -f ./backbone/.ci/docker-compose.test.yml -f ./backbone/.ci/docker-compose.test.sqlserver.yml logs > docker-log.txt + run: docker compose -f ./.ci/compose.test.capi.yml logs > docker-log.txt - name: Archive logs if: failure() @@ -335,7 +451,7 @@ jobs: path: docker-log.txt - name: Stop Consumer API - run: docker compose -f ./backbone/.ci/docker-compose.test.yml -f ./backbone/.ci/docker-compose.test.sqlserver.yml down + run: docker compose -f ./backbone/.ci/compose.test.yml -f ./backbone/.ci/compose.test.sqlserver.yml -f ./.ci/compose.test.capi.yml down transport-test-postgres: name: Run transport Tests (on Postgres) @@ -371,7 +487,7 @@ jobs: run: ./backbone/.ci/loadDockerImages.sh - name: Run Consumer API & Admin API - run: docker compose -f ./backbone/.ci/docker-compose.test.yml -f ./backbone/.ci/docker-compose.test.postgres.yml up -d --no-build + run: docker compose -f ./backbone/.ci/compose.test.yml -f ./backbone/.ci/compose.test.postgres.yml -f ./.ci/compose.test.capi.yml up -d --no-build - name: Install runtime dependencies working-directory: ./runtime @@ -389,7 +505,7 @@ jobs: - name: Save Docker Logs if: failure() - run: docker compose -f ./backbone/.ci/docker-compose.test.yml -f ./backbone/.ci/docker-compose.test.postgres.yml logs > docker-log.txt + run: docker compose -f ./.ci/compose.test.capi.yml logs > docker-log.txt - name: Archive logs if: failure() @@ -399,7 +515,7 @@ jobs: path: docker-log.txt - name: Stop Consumer API - run: docker compose -f ./backbone/.ci/docker-compose.test.yml -f ./backbone/.ci/docker-compose.test.postgres.yml down + run: docker compose -f ./backbone/.ci/compose.test.yml -f ./backbone/.ci/compose.test.postgres.yml -f ./.ci/compose.test.capi.yml down build-helm-chart: name: Build Helm Chart