Skip to content

Commit

Permalink
MR comment fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wwadge committed May 23, 2022
1 parent bfa02f7 commit 9663bcf
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,8 @@ public void testSteps_forBuildToDockerRegistry_skipExistingDigest()
Assert.assertEquals(image1.getDigest(), image2.getDigest());
Assert.assertEquals(image1.getImageId(), image2.getImageId());

// Test that the first image was pushed...
// Test that the first image was pushed while the second one was skipped
Assert.assertTrue(image1.isImagePushed());
// ...while the second one was skipped
Assert.assertFalse(image2.isImagePushed());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ public class JibContainer {
private final DescriptorDigest imageDigest;
private final DescriptorDigest imageId;
private final Set<String> tags;
private final Boolean imagePushed;
private final boolean imagePushed;

@VisibleForTesting
JibContainer(
ImageReference targetImage,
DescriptorDigest imageDigest,
DescriptorDigest imageId,
Set<String> tags,
Boolean imagePushed) {
boolean imagePushed) {
this.targetImage = targetImage;
this.imageDigest = imageDigest;
this.imageId = imageId;
Expand Down Expand Up @@ -67,7 +67,7 @@ public ImageReference getTargetImage() {
*
* @return true if pushed.
*/
public Boolean isImagePushed() {
public boolean isImagePushed() {
return imagePushed;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,12 +573,16 @@ private Future<BuildResult> pushImage(
results.manifestCheckResult.get().isPresent()));

realizeFutures(manifestPushResults);

boolean imagePushed =
!(JibSystemProperties.skipExistingImages()
&& results.manifestCheckResult.get().isPresent());

return manifestPushResults.isEmpty()
? new BuildResult(
results.manifestCheckResult.get().get().getDigest(),
Verify.verifyNotNull(containerConfigPushResult).get().getDigest(),
!(JibSystemProperties.skipExistingImages()
&& results.manifestCheckResult.get().isPresent()))
imagePushed)
// Manifest pushers return the same BuildResult.
: manifestPushResults.get(0).get();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void testCreation() {
Assert.assertEquals(digest1, container.getDigest());
Assert.assertEquals(digest2, container.getImageId());
Assert.assertEquals(tags1, container.getTags());
Assert.assertEquals(true, container.isImagePushed());
Assert.assertTrue(container.isImagePushed());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ public void testEquality() {
BuildResult container1 = new BuildResult(digest1, id, true);
BuildResult container2 = new BuildResult(digest1, id, true);
BuildResult container3 = new BuildResult(digest2, id, true);
BuildResult container4 = new BuildResult(digest1, id, false);

Assert.assertEquals(container1, container2);
Assert.assertEquals(container1.hashCode(), container2.hashCode());
Assert.assertEquals(container1.hashCode(), container4.hashCode());
Assert.assertNotEquals(container1, container3);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,6 @@ public void testBuildImage_writesImageJson() throws Exception {
Assert.assertEquals(imageId, metadataOutput.getImageId());
Assert.assertEquals(digest, metadataOutput.getImageDigest());
Assert.assertEquals(tags, ImmutableSet.copyOf(metadataOutput.getTags()));
Assert.assertTrue(metadataOutput.isImagePushed());
}
}

0 comments on commit 9663bcf

Please sign in to comment.