Repository navigation
test(cli): add isolated real-agent provisioning coverage - #365
Peyton Robertson (peytonr18) wants to merge 9 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #365 +/- ##
==========================================
+ Coverage 98.12% 99.37% +1.24%
==========================================
Files 29 29
Lines 10518 10522 +4
==========================================
+ Hits 10321 10456 +135
+ Misses 197 66 -131 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
See if this can converge with: https://github.com/Azure/azure-init/tree/main/testinit |
|
Could we add a couple of sample changes to main to show that this collects those lines as expected to help hit 100%? Those could then be reverted afterwards. |
… and see that all other parts of main are covered
d58eda7 to
be8fb94
Compare
|
Cade Jacobson (@cadejacobson) Added a few more tests to get the whole file to 100%, not just the patch. Here's proof! |
Restore OVF, version, and directory-cleanup implementations using container fixtures and build variants for coverage. Retain only exit-code classification for the otherwise-unreachable NonEmptyPassword case.
|
I made an effort to really trim down any changes to the logic in CC: Cade Jacobson (@cadejacobson) |
This PR adds an isolated Docker fixture for the real
azure-initentrypoint, covering successful provisioning, provisioning failure, and configuration-error exits (0,1, and78). Stubbed commands and local Azure-service mocks let the tests validate markers, logs, and HTTP/KVP reports without provisioning the host. The goal of this is to hit 100% code coverage inmain.rs, which is one of the only files left that does not hit that coverage metric.The logic is extracted from Azure/azure-init#363, where
main.rswas first flagged for not having 100% code coverage. It made more sense to make this change independently, since it doesn't depend on the health logic.How to use
From the repository root on Ubuntu with Docker running, build the image and run the commands below. Normal
cargo testskips the Docker fixture.Build the fixture image using the same Ubuntu version as the host:
Run the CLI tests, then explicitly run the ignored Docker fixture:
The second command runs all three provisioning scenarios inside disposable containers, checking markers, logs, and HTTP/KVP reports without provisioning the host.
Test the Python runner's isolation, cleanup, and coverage-profile handling without Docker:
Run the related formatting, scoped lint, and workspace checks:
To reproduce the combined coverage report used by CI, first install
cargo-llvm-covand the LLVM tools if needed:With the fixture image already built, collect workspace coverage, explicitly add the ignored entrypoint test, and generate
lcov.info:Testing done
Passed on Ubuntu 22.04 against
main(26e98be), using Rust 1.89.0 and stable 1.94.1. All of the other CLI tests and local tests passed as well.