From 3bae76c6e4b8905aa7f26f949f1a83ade2e04539 Mon Sep 17 00:00:00 2001 From: Vincent Latombe Date: Wed, 16 Aug 2023 13:16:43 +0200 Subject: [PATCH] Follow up #1415 Use a more explicit check and add todos to clean up for later. Verified with ``` mvn test -Dtest=KubernetesCloudTest -Djenkins.version=2.414 ``` --- pom.xml | 1 + .../plugins/kubernetes/KubernetesCloudTest.java | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 06e15ebab5..67f392f9dc 100644 --- a/pom.xml +++ b/pom.xml @@ -45,6 +45,7 @@ + 2.387.3 false true diff --git a/src/test/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesCloudTest.java b/src/test/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesCloudTest.java index 1b270f94b1..87e25c03ed 100644 --- a/src/test/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesCloudTest.java +++ b/src/test/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesCloudTest.java @@ -5,6 +5,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import hudson.util.VersionNumber; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -15,6 +16,7 @@ import java.util.logging.Level; import java.util.logging.Logger; +import jenkins.model.Jenkins; import org.htmlunit.ElementNotFoundException; import org.htmlunit.html.DomElement; import org.htmlunit.html.DomNodeList; @@ -73,14 +75,13 @@ public void configRoundTrip() throws Exception { assertEquals("PodTemplate{id='"+podTemplate.getId()+"', name='test-template', label='test'}", podTemplate.toString()); } + // TODO 2.414+ delete private HtmlPage getCloudPage(JenkinsRule.WebClient wc) throws IOException, SAXException { - HtmlPage p = wc.goTo("configureClouds/"); - List forms = p.getForms(); - // config page was moved in 2.414 - if (forms.stream().noneMatch(htmlForm -> htmlForm.getNameAttribute().equals("config"))) { - p = wc.goTo("cloud/kubernetes/configure"); + if (Jenkins.getVersion().isNewerThanOrEqualTo(new VersionNumber("2.414"))) { + return wc.goTo("cloud/kubernetes/configure"); + } else { + return wc.goTo("configureClouds/"); } - return p; } @Test