Add tests for docker:save multi-image feature and fix docker.save.aliases#1922
Open
JamBalaya56562 wants to merge 1 commit into
Open
Add tests for docker:save multi-image feature and fix docker.save.aliases#1922JamBalaya56562 wants to merge 1 commit into
JamBalaya56562 wants to merge 1 commit into
Conversation
|
013a57e to
20f6776
Compare
…ases Backfill unit-test coverage for the docker:save multi-image support (saveNames/saveAliases) which shipped without tests, plus the Docker 29+ IPAddress parsing branch in ContainerDetails. New tests: - UrlBuilderTest.getImages: images/get URL with repeated "names" params - DockerAccessWithHcClientTest.saveImages / saveImagesFail - SaveMojoTest: parameter-conflict validation and image-not-found paths - ContainerDetailsTest: getIPAddress returns null when no network carries an IP Also fixes a copy/paste bug in SaveMojo.getSaveAliasesPendingToSave(): the docker.save.aliases list was returned without being added, so a non-existent alias in the list was silently ignored instead of failing the save.
20f6776 to
8e81cac
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Why
The SonarCloud Quality Gate on
masteris failing on Coverage on New Code (70.8% < 80%). The build/test CI is all green — the gap is new code from thedocker:savemulti-image feature (saveNames/saveAliases) that was merged without unit tests, plus one branch of the Docker 29+IPAddressparsing inContainerDetails.This PR backfills unit tests for those paths and fixes a small bug found while doing so.
Tests added
UrlBuilderTest.getImages—images/get?names=…&names=…URL building for multiple images (covers thegetImages(List<ImageName>)method and the array-query-parameter support inbuild()).DockerAccessWithHcClientTest.testSaveImages/testSaveImagesFail— the multi-imagesaveImages(...)happy path and theDockerAccessExceptionwrapping on I/O failure.SaveMojoTest(7 tests) — the parameter-conflict validation branches (name/alias vs. name-list/alias-list) and the "image(s) not found by name/alias" paths.ContainerDetailsTest.testGetIPAddressNewFormatWithoutIp—getIPAddress()returnsnullwhenNetworkSettings.Networksis present but no network carries an IP.Bug fix
SaveMojo.getSaveAliasesPendingToSave()had a copy/paste error: whendocker.save.aliaseswas non-empty itreturned the list without adding the aliases (the siblinggetSaveNamesPendingToSave()correctly doesaddAll). As a result a non-existent alias indocker.save.aliaseswas silently ignored instead of failing the save with a clear "Can not find images with alias" error. Fixed toexit.addAll(saveAliases); the newSaveMojoTest.saveWithNonExistentAliaseslocks in the corrected behaviour.Verification
UrlBuilderTest,DockerAccessWithHcClientTest,SaveMojoTest,ContainerDetailsTest).943tests,0failures).docker.save.aliasesvalidation fix.🤖 Generated with Claude Code