Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-71737] refactor to support dedicated cloud rename page #1432

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
<connectorHost />
<jenkins.host.address />
<slaveAgentPort />
<!-- TODO fix KubernetesCloudTest todos once past 2.414 -->
<jenkins.version>2.401.1</jenkins.version>
<bom>2.401.x</bom>
<!-- TODO https://github.com/jenkinsci/jenkins/pull/8310 -->
<jenkins.version>2.423-rc34199.8c3d6c65b_758</jenkins.version>
<bom>2.414.x</bom>
<bom.version>2357.v1043f8578392</bom.version>
<no-test-jar>false</no-test-jar>
<useBeta>true</useBeta>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:c="/lib/credentials">

<f:entry title="${%Name}" field="name">
<f:textbox default="kubernetes" clazz="required"/>
</f:entry>

<f:advanced title="Kubernetes Cloud details">

<f:entry title="${%Kubernetes URL}" field="serverUrl">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
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;
Expand All @@ -16,8 +15,6 @@
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;
import org.htmlunit.html.HtmlButton;
Expand Down Expand Up @@ -69,19 +66,14 @@ public void configRoundTrip() throws Exception {
j.jenkins.clouds.add(cloud);
j.jenkins.save();
JenkinsRule.WebClient wc = j.createWebClient();
HtmlPage p = getCloudPage(wc);
HtmlPage p = getCloudPage(wc, cloud);
HtmlForm f = p.getFormByName("config");
j.submit(f);
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 {
if (Jenkins.getVersion().isNewerThanOrEqualTo(new VersionNumber("2.414"))) {
return wc.goTo("cloud/kubernetes/configure");
} else {
return wc.goTo("configureClouds/");
}
private HtmlPage getCloudPage(JenkinsRule.WebClient wc, KubernetesCloud cloud) throws IOException, SAXException {
return wc.goTo(cloud.getUrl() + "configure");
}

@Test
Expand Down Expand Up @@ -269,7 +261,7 @@ public void defaultWorkspaceVolume() throws Exception {
j.jenkins.clouds.add(cloud);
j.jenkins.save();
JenkinsRule.WebClient wc = j.createWebClient();
HtmlPage p = getCloudPage(wc);
HtmlPage p = getCloudPage(wc, cloud);
HtmlForm f = p.getFormByName("config");
HtmlButton buttonExtends = getButton(f, "Pod Templates");
buttonExtends.click();
Expand All @@ -287,16 +279,8 @@ public void defaultWorkspaceVolume() throws Exception {
assertEquals(WorkspaceVolume.getDefault(), podTemplate.getWorkspaceVolume());
}

// TODO 2.385+ delete
private HtmlButton getButton(HtmlForm f, String buttonText) {
HtmlButton button;
try {
button = HtmlFormUtil.getButtonByCaption(f, buttonText);
} catch (ElementNotFoundException e) {
// before https://github.com/jenkinsci/jenkins/pull/7173 the 3 dots where added by core
button = HtmlFormUtil.getButtonByCaption(f, buttonText + "...");
}
return button;
return HtmlFormUtil.getButtonByCaption(f, buttonText);
}

@Test
Expand Down