From fc53963fc57c466dc10757ac98d2009927f6ef15 Mon Sep 17 00:00:00 2001 From: "M." Date: Sat, 9 Mar 2024 21:59:47 +0530 Subject: [PATCH] RegistryServiceTest : remove unused variable hasImage and dockerFileUtilMockedStatic Signed-off-by: M. --- .../docker/service/RegistryServiceTest.java | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/src/test/java/io/fabric8/maven/docker/service/RegistryServiceTest.java b/src/test/java/io/fabric8/maven/docker/service/RegistryServiceTest.java index 787755c8c..86cf2e168 100644 --- a/src/test/java/io/fabric8/maven/docker/service/RegistryServiceTest.java +++ b/src/test/java/io/fabric8/maven/docker/service/RegistryServiceTest.java @@ -11,7 +11,6 @@ import io.fabric8.maven.docker.config.ImagePullPolicy; import io.fabric8.maven.docker.util.AuthConfigFactory; import io.fabric8.maven.docker.util.AutoPullMode; -import io.fabric8.maven.docker.util.DockerFileUtil; import io.fabric8.maven.docker.util.ImageName; import io.fabric8.maven.docker.util.Logger; import io.fabric8.maven.docker.util.ProjectPaths; @@ -25,7 +24,6 @@ import org.junit.jupiter.params.provider.ValueSource; import org.mockito.ArgumentCaptor; import org.mockito.Mock; -import org.mockito.MockedStatic; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; @@ -57,9 +55,8 @@ class RegistryServiceTest { private TestCacheStore cacheStore; private AutoPullMode autoPullMode; private RegistryService registryService; - private boolean hasImage; private Map authConfig; - private MockedStatic dockerFileUtilMockedStatic; + @TempDir private File projectBaseDir; @@ -96,7 +93,6 @@ void setup() { imageName = null; imagePullPolicy = null; autoPullMode = null; - hasImage = false; registry = null; imageConfiguration = null; } @@ -107,8 +103,6 @@ void pullImagePullPolicyAlways(boolean hasImage) throws Exception { givenAnImage(); givenAnImageConfiguration("myregistry.com/user/app:1.0.1"); givenImagePullPolicy(ImagePullPolicy.Always); - givenHasImage(hasImage); - checkPulledButNotTagged(); } @@ -118,8 +112,6 @@ void pullImageAutopullAlways(boolean hasImage) throws Exception { givenAnImage(); givenAnImageConfiguration("myregistry.com/user/app:1.0.1"); givenAutoPullMode(AutoPullMode.ALWAYS); - givenHasImage(hasImage); - checkPulledButNotTagged(); } @@ -136,7 +128,6 @@ private void checkPulledButNotTagged() throws DockerAccessException { void pullImageAlwaysWhenPreviouslyPulled() throws Exception { givenAnImage(); givenAnImageConfiguration("myregistry.com/user/app:1.0.1"); - givenHasImage(false); givenPreviousPulled(true); givenImagePullPolicy(ImagePullPolicy.Always); @@ -167,7 +158,6 @@ void alreadyPulled() throws DockerAccessException { @Test void policyNeverWithImageAvailable() throws DockerAccessException { givenAnImage(); - givenHasImage(true); givenPreviousPulled(false); givenImagePullPolicy(ImagePullPolicy.Never); @@ -181,7 +171,6 @@ void policyNeverWithImageAvailable() throws DockerAccessException { @Test void policyNeverWithImageNotAvailable() throws DockerAccessException { givenAnImage(); - givenHasImage(false); givenAnImageConfiguration("myregistry.com/user/app:1.0.1"); givenPreviousPulled(false); givenImagePullPolicy(ImagePullPolicy.Never); @@ -202,13 +191,10 @@ private void thenExceptionThrown() { void pullWithCustomRegistry() throws DockerAccessException { givenAnImageConfiguration("myregistry.com/user/app:1.0.1"); givenAnImage("myregistry.com/user/test:1.0.1"); - givenHasImage(false); givenPreviousPulled(false); givenRegistry("anotherRegistry.com"); givenImagePullPolicy(ImagePullPolicy.IfNotPresent); - whenAutoPullImage(); - thenImageHasBeenPulledWithRegistry("myregistry.com"); thenImageHasNotBeenTagged(); thenNoExceptionThrown(); @@ -223,7 +209,6 @@ void pullImageWithPolicy_pullPolicyAlwaysAndBuildConfiguration_shouldPull() thro .name("myregistry.com/user/app:1.0.1") .buildConfig(buildImageConfiguration).build(); givenAnImage("myregistry.com/user/test:1.0.1"); - givenHasImage(false); givenPreviousPulled(false); givenRegistry("anotherRegistry.com"); givenImagePullPolicy(ImagePullPolicy.Always); @@ -248,7 +233,6 @@ void pullImageWithPolicy_pullPolicyAlwaysAndBuildConfiguration_shouldPull() thro void tagForCustomRegistry() throws DockerAccessException { givenAnImageConfiguration("myregistry.com/user/app:1.0.1"); givenAnImage("user/test:1.0.1"); - givenHasImage(false); givenPreviousPulled(false); givenRegistry("anotherRegistry.com"); givenImagePullPolicy(ImagePullPolicy.IfNotPresent); @@ -533,9 +517,6 @@ private void givenAutoPullMode(AutoPullMode autoPullMode) { this.autoPullMode = autoPullMode; } - private void givenHasImage(boolean hasImage) { - this.hasImage = hasImage; - } private void givenPreviousPulled(boolean pulled) { this.cacheStore.put("dummyKey", pulled ? "{ '" + imageName + "': true}" : null);