From fd7fbc862d24fff024c8adfc541b158c5780c3c5 Mon Sep 17 00:00:00 2001 From: Carroll Chiou Date: Fri, 17 Nov 2023 13:04:52 -0700 Subject: [PATCH] Require Jenkins 2.414.3 or newer (#1016) * Refactor to support separate cloud rename page * spotless * update jenkins incremental * add name back in config.jelly * fix jenkins version --- pom.xml | 4 +-- .../plugins/docker/DockerCloudTest.java | 26 ++----------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index ba6948bb..2dc9b62e 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 1.6 -SNAPSHOT - 2.387.3 + 2.414.3 jenkinsci/docker-plugin 3 @@ -76,7 +76,7 @@ io.jenkins.tools.bom - bom-2.387.x + bom-2.414.x 2543.vfb_1a_5fb_9496d pom import diff --git a/src/test/java/com/nirima/jenkins/plugins/docker/DockerCloudTest.java b/src/test/java/com/nirima/jenkins/plugins/docker/DockerCloudTest.java index b1db16be..bee603e1 100644 --- a/src/test/java/com/nirima/jenkins/plugins/docker/DockerCloudTest.java +++ b/src/test/java/com/nirima/jenkins/plugins/docker/DockerCloudTest.java @@ -19,8 +19,6 @@ import java.util.Map; import java.util.Set; import java.util.logging.Level; -import org.hamcrest.MatcherAssert; -import org.hamcrest.core.IsIterableContaining; import org.jenkinsci.plugins.docker.commons.credentials.DockerServerCredentials; import org.jenkinsci.plugins.docker.commons.credentials.DockerServerEndpoint; import org.junit.Assert; @@ -58,34 +56,14 @@ public void testConstructor_0_10_2() { private static final String LOG_MESSAGE = "Docker cloud requires a non-blank name after Jenkins 2.402"; - @Issue("JENKINS-70729") // Warn if cloud name is empty - @Test - public void testConstructorWithEmptyName() { - lr.record(DockerCloud.class.getName(), Level.ALL).capture(16); - DockerCloud cloud = - new DockerCloud("", new DockerAPI(new DockerServerEndpoint("uri", "credentialsId")), List.of()); - Assert.assertEquals(cloud.getDisplayName(), ""); - MatcherAssert.assertThat(lr.getMessages(), IsIterableContaining.hasItem(LOG_MESSAGE)); - } - - @Issue("JENKINS-70729") // Warn if cloud name is null - @Test - public void testConstructorWithNullName() { - lr.record(DockerCloud.class.getName(), Level.ALL).capture(16); - DockerCloud cloud = - new DockerCloud(null, new DockerAPI(new DockerServerEndpoint("uri", "credentialsId")), List.of()); - Assert.assertEquals(cloud.getDisplayName(), null); - MatcherAssert.assertThat(lr.getMessages(), IsIterableContaining.hasItem(LOG_MESSAGE)); - } - @Issue("JENKINS-70729") // Handle null or empty cloud name @Test public void testCopyConstructor() { lr.record(DockerCloud.class.getName(), Level.ALL).capture(16); DockerCloud cloud = - new DockerCloud(null, new DockerAPI(new DockerServerEndpoint("uri", "credentialsId")), List.of()); + new DockerCloud("tmp", new DockerAPI(new DockerServerEndpoint("uri", "credentialsId")), List.of()); + cloud.name = null; Assert.assertEquals(cloud.getDisplayName(), null); - MatcherAssert.assertThat(lr.getMessages(), IsIterableContaining.hasItem(LOG_MESSAGE)); String newName = "docker-cloud-" + Integer.toHexString(cloud.hashCode()); DockerCloud copy = new DockerCloud(newName, cloud); Assert.assertEquals(cloud.getDockerApi(), copy.getDockerApi());