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] update for dedicated cloud rename page #889

Closed
wants to merge 4 commits 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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ THE SOFTWARE.

<properties>
<changelist>999999-SNAPSHOT</changelist>
<jenkins.version>2.414</jenkins.version>
<jenkins.version>2.423-rc34199.8c3d6c65b_758</jenkins.version> <!-- TODO: https://github.com/jenkinsci/jenkins/pull/8310 -->
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:c="/lib/credentials">
<f:entry title="${%Name}" field="cloudName">
<f:textbox />
</f:entry>
<f:entry field="credentialsId" title="${%Amazon EC2 Credentials}" description="AWS IAM Access Key used to connect to EC2. If not specified, implicit authentication mechanisms are used (IAM roles...)">
<c:select />
</f:entry>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:c="/lib/credentials">
<f:entry title="${%Name}" field="name">
<f:textbox />
</f:entry>
<f:entry title="${%Eucalyptus EC2 URL}" field="ec2EndpointUrl">
<f:textbox />
</f:entry>
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/hudson/plugins/ec2/AmazonEC2CloudTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public void setUp() throws Exception {

@Test
public void testConfigRoundtrip() throws Exception {
r.submit(getConfigForm());
r.assertEqualBeans(cloud, r.jenkins.clouds.get(AmazonEC2Cloud.class), "cloudName,region,useInstanceProfileForCredentials,privateKey,instanceCap,roleArn,roleSessionName");
r.submit(getConfigForm(cloud));
r.assertEqualBeans(cloud, r.jenkins.clouds.get(AmazonEC2Cloud.class), "region,useInstanceProfileForCredentials,privateKey,instanceCap,roleArn,roleSessionName");
}

@Test
Expand All @@ -87,14 +87,14 @@ public void testAmazonEC2FactoryGetInstance() throws Exception {

@Test
public void testSshKeysCredentialsIdRemainsUnchangedAfterUpdatingOtherFields() throws Exception {
HtmlForm form = getConfigForm();
HtmlForm form = getConfigForm(cloud);
HtmlTextInput input = form.getInputByName("_.roleSessionName");

input.setText("updatedSessionName");
r.submit(form);
AmazonEC2Cloud actual = r.jenkins.clouds.get(AmazonEC2Cloud.class);
assertEquals("updatedSessionName", actual.getRoleSessionName());
r.assertEqualBeans(cloud, actual, "cloudName,region,useInstanceProfileForCredentials,sshKeysCredentialsId,instanceCap,roleArn");
r.assertEqualBeans(cloud, actual, "region,useInstanceProfileForCredentials,sshKeysCredentialsId,instanceCap,roleArn");
}

@Test
Expand Down Expand Up @@ -161,7 +161,7 @@ public void testCustomSshCredentialTypes() throws IOException {
assertThat(actual.resolvePrivateKey(), notNullValue());
}

private HtmlForm getConfigForm() throws IOException, SAXException {
private HtmlForm getConfigForm(AmazonEC2Cloud cloud) throws IOException, SAXException {
return r.createWebClient().goTo(cloud.getUrl() + "configure").getFormByName("config");
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/hudson/plugins/ec2/EucalyptusTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ public void configRoundTrip() throws Exception {
HtmlPage p = wc.goTo(cloud.getUrl() + "configure");
HtmlForm f = p.getFormByName("config");
r.submit(f);
r.assertEqualBeans(cloud, r.jenkins.getCloud("test"), "name,ec2EndpointUrl,s3EndpointUrl,useInstanceProfileForCredentials,roleArn,roleSessionName,credentialsId,sshKeysCredentialsId,instanceCap,templates");
r.assertEqualBeans(cloud, r.jenkins.getCloud("test"), "ec2EndpointUrl,s3EndpointUrl,useInstanceProfileForCredentials,roleArn,roleSessionName,credentialsId,sshKeysCredentialsId,instanceCap,templates");
}
}
17 changes: 7 additions & 10 deletions src/test/java/hudson/plugins/ec2/SlaveTemplateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,13 @@
import hudson.model.Node;
import hudson.plugins.ec2.SlaveTemplate.ProvisionOptions;
import hudson.plugins.ec2.util.MinimumNumberOfInstancesTimeRangeConfig;
import org.htmlunit.html.HtmlForm;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;
import org.mockito.ArgumentCaptor;
import org.xml.sax.SAXException;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
Expand Down Expand Up @@ -110,7 +107,7 @@ public void testConfigRoundtrip() throws Exception {
AmazonEC2Cloud ac = new AmazonEC2Cloud("us-east-1", false, "abc", "us-east-1", "ghi", "3", templates, null, null);
r.jenkins.clouds.add(ac);

r.submit(getConfigForm(ac));
r.submit(r.createWebClient().goTo(ac.getUrl() + "configure").getFormByName("config"));
SlaveTemplate received = ((EC2Cloud) r.jenkins.clouds.iterator().next()).getTemplate(description);
r.assertEqualBeans(orig, received, "ami,zone,description,remoteFS,type,javaPath,jvmopts,stopOnTerminate,securityGroups,subnetId,tags,iamInstanceProfile,useEphemeralDevices,useDedicatedTenancy,connectionStrategy,hostKeyVerificationStrategy,tenancy,ebsEncryptRootVolume");
// For already existing strategies, the default is this one
Expand All @@ -132,7 +129,7 @@ public void testConfigRoundtripWithCustomSSHHostKeyVerificationStrategy() throws
AmazonEC2Cloud ac = new AmazonEC2Cloud("us-east-1", false, "abc", "us-east-1", "ghi", "3", templates, null, null);
r.jenkins.clouds.add(ac);

r.submit(getConfigForm(ac));
r.submit(r.createWebClient().goTo(ac.getUrl() + "configure").getFormByName("config"));
SlaveTemplate received = ((EC2Cloud) r.jenkins.clouds.iterator().next()).getTemplate(description);
r.assertEqualBeans(orig, received, "ami,zone,description,remoteFS,type,javaPath,jvmopts,stopOnTerminate,securityGroups,subnetId,useEphemeralDevices,useDedicatedTenancy,connectionStrategy,hostKeyVerificationStrategy");
assertEquals(STRATEGY_TO_CHECK, received.getHostKeyVerificationStrategy());
Expand Down Expand Up @@ -161,7 +158,7 @@ public void testConfigWithSpotBidPrice() throws Exception {
AmazonEC2Cloud ac = new AmazonEC2Cloud("us-east-1", false, "abc", "us-east-1", "ghi", "3", templates, null, null);
r.jenkins.clouds.add(ac);

r.submit(getConfigForm(ac));
r.submit(r.createWebClient().goTo(ac.getUrl() + "configure").getFormByName("config"));
SlaveTemplate received = ((EC2Cloud) r.jenkins.clouds.iterator().next()).getTemplate(description);
r.assertEqualBeans(orig, received, "ami,zone,spotConfig,description,remoteFS,type,javaPath,jvmopts,stopOnTerminate,securityGroups,subnetId,tags,usePrivateDnsName");
}
Expand All @@ -185,7 +182,7 @@ public void testSpotConfigWithoutBidPrice() throws Exception {
AmazonEC2Cloud ac = new AmazonEC2Cloud("us-east-1", false, "abc", "us-east-1", "ghi", "3", templates, null, null);
r.jenkins.clouds.add(ac);

r.submit(getConfigForm(ac));
r.submit(r.createWebClient().goTo(ac.getUrl() + "configure").getFormByName("config"));
SlaveTemplate received = ((EC2Cloud) r.jenkins.clouds.iterator().next()).getTemplate(description);
r.assertEqualBeans(orig, received, "ami,zone,spotConfig,description,remoteFS,type,javaPath,jvmopts,stopOnTerminate,securityGroups,subnetId,tags,usePrivateDnsName");
}
Expand All @@ -202,7 +199,7 @@ public void testWindowsConfigRoundTrip() throws Exception {
AmazonEC2Cloud ac = new AmazonEC2Cloud("us-east-1", false, "abc", "us-east-1", "ghi", "3", templates, null, null);
r.jenkins.clouds.add(ac);

r.submit(getConfigForm(ac));
r.submit(r.createWebClient().goTo(ac.getUrl() + "configure").getFormByName("config"));
SlaveTemplate received = ((EC2Cloud) r.jenkins.clouds.iterator().next()).getTemplate(description);
assertEquals(orig.getAdminPassword(), received.getAdminPassword());
assertEquals(orig.amiType, received.amiType);
Expand All @@ -220,7 +217,7 @@ public void testUnixConfigRoundTrip() throws Exception {
AmazonEC2Cloud ac = new AmazonEC2Cloud("us-east-1", false, "abc", "us-east-1", "ghi", "3", templates, null, null);
r.jenkins.clouds.add(ac);

r.submit(getConfigForm(ac));
r.submit(r.createWebClient().goTo(ac.getUrl() + "configure").getFormByName("config"));
SlaveTemplate received = ((EC2Cloud) r.jenkins.clouds.iterator().next()).getTemplate(description);
r.assertEqualBeans(orig, received, "amiType");
}
Expand Down Expand Up @@ -425,7 +422,7 @@ public void testMacConfig() throws Exception {
AmazonEC2Cloud ac = new AmazonEC2Cloud("us-east-1", false, "abc", "us-east-1", "ghi", "3", templates, null, null);
r.jenkins.clouds.add(ac);

r.submit(getConfigForm(ac));
r.submit(r.createWebClient().goTo(ac.getUrl() + "configure").getFormByName("config"));
SlaveTemplate received = ((EC2Cloud) r.jenkins.clouds.iterator().next()).getTemplate(description);
r.assertEqualBeans(orig, received, "type,amiType");
}
Expand Down