Closed EtherZa closed 3 months ago
I agree that having test containers where possible is a step forward.
Let me think about this some more and perhaps accept this PR into a side master branch and then iterate on combining with the private cloud resources that are currently used for testing.
Again, thanks for your help and effort.
Again, thanks for your help and effort.
@zarusz It's a pleasure. We all win here
Let me think about this some more and perhaps accept this PR into a side master branch and then iterate on combining with the private cloud resources that are currently used for testing.
The first approach I took was to just add support for environment variables to BaseIntegrationTest.Configuratoin
. Combining that with a .runsettings worked well until I tried to get it to work with live unit testing. Visual Studio ignores .runsettings in LUT.
This approach is still not perfect as secrets.txt
is not included with the LUT shadow copy. Manually copying the file to the LUT directory gets the tests running successfully at least.
@EtherZa I've adjusted the build.yaml and added the new secrets in GitHub to support int tests running against local and cloud infra. Please rebase against master.
Hopefully, it will work after one shot :)
Works like a charm - local tests are all green.
The Kafka and Event Hub tests intermittently need an extra run as there appears to be a race condition between each set; but that is a minor issue for now.
I am also hoping that you will forgive the code coverage complaint that SonarCloud is raising - it is the empty/commented line predicate in the secrets file reader. The build pipeline clearly makes use of neither condition :)
Thank you @zarusz. This will make a big difference.
Failed conditions
45.5% Coverage on New Code (required ≥ 75%)
Testing if you aren't @zarusz can be a little painful with the test configurations tailored for private resources ;)
Please consider this PR. It allows for a full test coverage running everything locally except for Azure Service Bus and Azure Event Hub which don't have containers available.
To ease some of the integration, Kafka and Mqtt are both hosted without certs. It does require some minor changes to some of the bootstrapping for the integration tests, but won't have any impact (beyond configuration) for the build pipeline.
I understand that build pipeline will be broken with the change, but that should be easily resolved by updating the devops version of secrets.txt with the sample provided.
Local development environment using docker
src/secrets.txt.sample
tosrc/secrets.txt
docker compose up --force-recreate -V
or./compose.sh