This directory contains tests, clients, and plug-ins to validate the Deployment Service.
.
├── debugClient # a .NET application that allows you to interact with Deployment Service
├── integrationTestPlugin # a .NET application that modifies responses for tests
├── integrationTests # a xUnit test suite that validates the end-to-end business-logic of Deployment Service
└── unitTests # a xUnit test suite that validates Deployment Service components
└── sampleSchedules # sample schedules used for xUnit test suite that validates Deployment Service components
└── sampleYaml # sample YAML files used for xUnit test suite that validates Deployment Service components
One way to get started with Deployment Service is to run the Debug Client and Integration Tests.
-
Open this respository in its Dev Container
-
Open the "Run and Debug" menu (CTRL + SHIFT + D)
-
From the launch configuration dropdown, select "Integration Tests - Run"
-
Select the Start Icon ▶ (or press F5) to begin debugging the service and running the tests
-
Your terminal will show the tasks executed as described in tasks.json
-
The Debug Console (CTRL + SHIFT + Y) will become active, select the "Integration Tests - Client Run" session from the dropdown
-
A successful test run should emit something like this to the debug console
Passed integrationTests.DeploymentTests.ImmediateDeploymentAndDeletionTest [2 m] ......Sending ListItemRequest (Tracking ID: '44692d2a-db5d-4963-9a73-c9c43969e85c')... ......Waiting for ListItemResponse (Tracking ID: '44692d2a-db5d-4963-9a73-c9c43969e85c')... ......Heard ListItemResponse (Tracking ID: '44692d2a-db5d-4963-9a73-c9c43969e85c')... ......Sending LogRequest (Tracking ID: '11bd4565-ef43-4ec2-b450-9db574038040')... ......Waiting for LogResponse (Tracking ID: '11bd4565-ef43-4ec2-b450-9db574038040')... ......Heard LogResponse (Tracking ID: '11bd4565-ef43-4ec2-b450-9db574038040')... ......Waiting for file '11bd4565-ef43-4ec2-b450-9db574038040.log' in '/var/spacedev/xfer/platform-deployment-test-client/inbox' (Tracking ID: '11bd4565-ef43-4ec2-b450-9db574038040')... [xUnit.net 00:05:28.63] Finished: integrationTests Passed integrationTests.ListItemRequestTest.ListItemRequestQueryAndResponse [601 ms] Passed integrationTests.LogRequestTest.LogQuery [405 ms] Test Run Successful. Total tests: 4 Passed: 4 Total time: 5.4850 Minutes
-
Stop the debugger by selecting the Stop Icon 🟥 (Shift + F5)
This is a required step, failure to stop the services will result in unknown pod states
-
Follow the steps to successfully run the integration tests
-
Be sure to stop the services and detach the debugger
-
Open the "Run and Debug" menu (CTRL + SHIFT + D)
-
From the launch configuration dropdown, select debugService of choice such as "Integration Tests - Debug"
-
Set a breakpoint on Foreman.MessageReceivedHandler()
- Click in the gutter area to the left of a line number, a circle 🔴 will appear for lines with breakpoints set
-
Select the Continue Icon ⏯️ (or press F5) to run the integration tests debug again
-
The breakpoint will be hit and execution of the application will pause
-
You can inspect the state of the application, view the call stack, and interact with the application
-
Remove your breakpoint, or move it around, explore how the application works
-
Select the Continue Icon ⏯️ (or press F5) to continue execution
-
Remember, once finished, stop the debugger by selecting the Stop Icon 🟥 (Shift + F5)
This is a required step, failure to stop the services will result in unknown pod states
The unit tests assert that Deployment Service components are in the expected shape and configuration.
-
Open this respository in its Dev Container
-
Open the "Run and Debug" menu (CTRL + SHIFT + D)
-
From the launch configuration dropdown, select "Unit Tests - Run"
-
Select the Start Icon ▶ (or press F5) to begin running the tests
-
Your terminal will show the tasks executed as described in tasks.json
-
The Debug Console (CTRL + SHIFT + Y) will become active, select the "Unit Tests" session from the dropdown
-
A successful test run should emit something like this to the debug console
-
A successful test run should emit something like this to the debug console
[xUnit.net 00:00:00.89] Finished: unitTests Passed unitTests.ProtoTests.ListItemRequest [45 ms] Passed unitTests.ProtoTests.DeployRequest [< 1 ms] Passed unitTests.ProtoTests.LogRequest [< 1 ms] Passed unitTests.ProtoTests.ListItemResponse [< 1 ms] Passed unitTests.ProtoTests.LogResponse [< 1 ms] Passed unitTests.ProtoTests.DeployResponse [< 1 ms] Test Run Successful. Total tests: 6 Passed: 6 Total time: 1.4037 Seconds
The Integration Test Plugin is used to validate that message requests and responses modified by plugins are honored by the Deployment Service.
This plugin is injected into the running Deployment Service during testing by providing the appsettings.IntegrationTest.json configuration to the Deployment Service at startup time in the Integration Tests - Debug
launch configuration in launch.json.