chore(azure/build): improve test times for azure #6246
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some azure tests need the AzureCredentials class. These tests create the class by using the default AzureCredentials constructor. The constructor for the class has code that tries to actually authenticate against a Microsoft/Azure server, and all of the API calls to the MS servers fail. The tests all have code to set up in this class in the setup section of Groovy specs, which means that gradle never actually executes the tests for these classes. The API calls to MS fail and are repeatedly retried over and over again until they eventually stop and the tests run, and succeed. I'm not sure why the tests end up passing after the retries are exhausted.
This issue can only be found when running a command like
./gradlew :clouddriver-azure:test --debug
which shows the logs of the gradle runner attempting to execute the test. When running that command, errors likefrequently appear. The tests also take between 7-10 minutes to run.
With this change because the AzureCredentials constructor is no longer invoked and only mocked, the MS authentication API is never hit, and the tests complete immediately, without any API failures.
This should significantly improve the build times of clouddriver both locally and in CI environments.
After applying the change and running
./gradlew clean :clouddriver-azure:test
the tests complete in a few seconds, instead of minutes.