From 3e27e9850822134e1d07b3115bf272f84eec0904 Mon Sep 17 00:00:00 2001 From: sitay Date: Tue, 26 Mar 2024 09:56:58 +0200 Subject: [PATCH 01/15] update Jenkins and Java version. add CloudSet override --- pom.xml | 4 ++-- .../hudson/plugins/spotinst/cloud/SpotinstCloudSet.java | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 src/main/java/hudson/plugins/spotinst/cloud/SpotinstCloudSet.java diff --git a/pom.xml b/pom.xml index 8c8e2e9..5bba639 100644 --- a/pom.xml +++ b/pom.xml @@ -40,8 +40,8 @@ - 2.222.4 - 8 + 2.403 + 11 diff --git a/src/main/java/hudson/plugins/spotinst/cloud/SpotinstCloudSet.java b/src/main/java/hudson/plugins/spotinst/cloud/SpotinstCloudSet.java new file mode 100644 index 0000000..b420901 --- /dev/null +++ b/src/main/java/hudson/plugins/spotinst/cloud/SpotinstCloudSet.java @@ -0,0 +1,6 @@ +package hudson.plugins.spotinst.cloud; + +import jenkins.agents.CloudSet; + +public class SpotinstCloudSet extends CloudSet { +} From c6cfcb629906c39ad7fa22fd7a2db6aaafa35dba Mon Sep 17 00:00:00 2001 From: sitay Date: Tue, 26 Mar 2024 16:47:14 +0200 Subject: [PATCH 02/15] update Jenkins and Java version. add CloudSet override --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index 5bba639..4995ef4 100644 --- a/pom.xml +++ b/pom.xml @@ -93,6 +93,11 @@ trilead-api 1.0.13 + + org.jenkins-ci + symbol-annotation + 1.24 + org.jenkins-ci.plugins ssh-slaves From 330c508ad79f86027508fe9ff9e8f6925adec6ae Mon Sep 17 00:00:00 2001 From: sitay Date: Wed, 27 Mar 2024 21:17:42 +0200 Subject: [PATCH 03/15] update dependencies --- pom.xml | 15 ++++++++++++++- .../hudson/plugins/spotinst/api/SpotinstApi.java | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 4995ef4..b5a3cd0 100644 --- a/pom.xml +++ b/pom.xml @@ -40,8 +40,11 @@ - 2.403 + 2.426 11 + 11 + 11 + 11 @@ -132,6 +135,16 @@ + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + 11 + + true diff --git a/src/main/java/hudson/plugins/spotinst/api/SpotinstApi.java b/src/main/java/hudson/plugins/spotinst/api/SpotinstApi.java index c6e3682..97ebb0e 100644 --- a/src/main/java/hudson/plugins/spotinst/api/SpotinstApi.java +++ b/src/main/java/hudson/plugins/spotinst/api/SpotinstApi.java @@ -17,8 +17,8 @@ import hudson.plugins.spotinst.model.redis.LockGroupControllerResponse; import jenkins.model.Jenkins; import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.lang.StringUtils; +import org.apache.http.HttpStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; From c906d2c63a464d282f4e380122a32fb929e2f6fb Mon Sep 17 00:00:00 2001 From: sitay Date: Wed, 27 Mar 2024 21:31:25 +0200 Subject: [PATCH 04/15] update dependencies --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b5a3cd0..72162e6 100644 --- a/pom.xml +++ b/pom.xml @@ -138,7 +138,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.13.0 11 11 From 5620744653fc67cad1ede4a8e2500c603e10ebbf Mon Sep 17 00:00:00 2001 From: sitay Date: Thu, 28 Mar 2024 10:20:55 +0200 Subject: [PATCH 05/15] update dependencies --- pom.xml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 72162e6..42d7eb5 100644 --- a/pom.xml +++ b/pom.xml @@ -63,27 +63,27 @@ org.apache.httpcomponents httpclient - 4.5 + 4.5.14 org.apache.httpcomponents httpcore - 4.4.1 + 4.4.16 com.fasterxml.jackson.core jackson-core - 2.7.4 + 2.16.1 com.fasterxml.jackson.core jackson-annotations - 2.7.4 + 2.16.1 com.fasterxml.jackson.core jackson-databind - 2.7.4 + 2.16.1 org.mockito @@ -116,6 +116,11 @@ commons-collections4 4.4 + + org.kohsuke.stapler + stapler + 1814.vdc9dd5217ee2 + @@ -135,10 +140,14 @@ + + maven-enforcer-plugin + 3.4.1 + org.apache.maven.plugins maven-compiler-plugin - 3.13.0 + 3.8.1 11 11 From 0968aea0a372c3def6bd2ea866e182f987a205d9 Mon Sep 17 00:00:00 2001 From: sitay Date: Thu, 28 Mar 2024 15:02:29 +0200 Subject: [PATCH 06/15] update dependencies --- pom.xml | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 119 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 42d7eb5..35d9419 100644 --- a/pom.xml +++ b/pom.xml @@ -49,6 +49,21 @@ + + org.jenkins-ci.plugins + variant + 60.v7290fc0eb_b_cd + + + javax.servlet + javax.servlet-api + 4.0.1 + + + commons-logging + commons-logging + 1.3.1 + io.jenkins.tools.bom bom-2.249.x @@ -56,10 +71,55 @@ import pom + + commons-io + commons-io + 2.15.1 + + + com.github.spotbugs + spotbugs-annotations + 4.8.3 + + + junit + junit + 4.13.2 + + + org.kohsuke.stapler + stapler + 1839.ved17667b_a_eb_5 + + + com.github.spotbugs + spotbugs-annotations + 4.8.3 + provided + true + + + commons-logging + commons-logging + 1.3.1 + provided + + + junit + junit + 4.13.2 + test + + + javax.servlet + javax.servlet-api + 4.0.1 + provided + org.apache.httpcomponents httpclient @@ -73,53 +133,89 @@ com.fasterxml.jackson.core jackson-core - 2.16.1 + 2.17.0 com.fasterxml.jackson.core jackson-annotations - 2.16.1 + 2.17.0 com.fasterxml.jackson.core jackson-databind - 2.16.1 + 2.17.0 + + + org.codehaus.mojo + animal-sniffer-annotations + 1.23 org.mockito mockito-all - 1.8.4 + 2.0.2-beta test + + org.jenkins-ci.main + jenkins-test-harness + 2182.v0138ccb_c0b_cb_ + + + org.jenkins-ci + test-annotations + 1.4 + org.jenkins-ci.plugins trilead-api - 1.0.13 + 2.142.v748523a_76693 org.jenkins-ci symbol-annotation 1.24 + + org.jenkins-ci.plugins + ssh-credentials + 334.v7732563deee1 + org.jenkins-ci.plugins ssh-slaves - 1.31.3 + 2.948.vb_8050d697fec + + + org.jenkins-ci.plugins + structs + 337.v1b_04ea_4df7c8 + + + org.jenkins-ci.plugins + credentials + 1337.v60b_d7b_c7b_c9f org.jenkins-ci.plugins plain-credentials - 1.7 + 179.vc5cb_98f6db_38 org.apache.commons commons-collections4 4.4 + + commons-codec + commons-codec + 1.16.1 + org.kohsuke.stapler stapler - 1814.vdc9dd5217ee2 + 1839.ved17667b_a_eb_5 + compile @@ -140,10 +236,6 @@ - - maven-enforcer-plugin - 3.4.1 - org.apache.maven.plugins maven-compiler-plugin @@ -168,5 +260,20 @@ + + + + maven-enforcer-plugin + 3.4.1 + + + org.codehaus.mojo + extra-enforcer-rules + 1.8.0 + compile + + + + From 167120702b6c70732548571bb47e5bd5d3dcb229 Mon Sep 17 00:00:00 2001 From: sitay Date: Thu, 28 Mar 2024 17:12:43 +0200 Subject: [PATCH 07/15] update dependencies --- pom.xml | 166 ++++++++++++++++++ .../plugins/spotinst/api/SpotinstApi.java | 2 +- .../AwsSpotinstCloudInstanceTypeMonitor.java | 2 +- .../SpotinstCloudsCommunicationMonitor.java | 2 +- .../jobs/SpotinstSyncGroupsController.java | 2 +- 5 files changed, 170 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 35d9419..3b06e04 100644 --- a/pom.xml +++ b/pom.xml @@ -91,6 +91,170 @@ stapler 1839.ved17667b_a_eb_5 + + args4j + args4j + 2.37 + + + com.google.code.findbugs + jsr305 + 3.0.2 + true + + + com.google.errorprone + error_prone_annotations + 2.26.1 + + + com.google.guava + guava + 33.1.0-jre + + + com.google.guava + guava-testlib + 33.1.0-jre + + + com.google.inject + guice + 7.0.0 + + + com.google.inject + guice + 7.0.0 + classes + + + com.google.inject.extensions + guice-assistedinject + 7.0.0 + + + com.google.inject.extensions + guice-dagger-adapter + 7.0.0 + + + com.google.inject.extensions + guice-grapher + 7.0.0 + + + com.google.inject.extensions + guice-jmx + 7.0.0 + + + com.google.inject.extensions + guice-jndi + 7.0.0 + + + com.google.inject.extensions + guice-persist + 7.0.0 + + + com.google.inject.extensions + guice-servlet + 7.0.0 + + + com.google.inject.extensions + guice-spring + 7.0.0 + + + com.google.inject.extensions + guice-struts2 + 7.0.0 + + + com.google.inject.extensions + guice-testlib + 7.0.0 + + + com.google.inject.extensions + guice-throwingproviders + 7.0.0 + + + com.google.truth + truth + 1.4.2 + test + + + com.google.truth.extensions + truth-java8-extension + 1.4.2 + test + + + commons-codec + commons-codec + 1.16.1 + + + commons-collections + commons-collections + 20040616 + + + commons-jelly + commons-jelly + 2.16 + + + commons-jelly + commons-jelly-tags-ant + 20040902.071105 + + + commons-jelly + commons-jelly-tags-util + 20040902.071012 + + + commons-jelly + commons-jelly-tags-xml + 20040902.072037 + + + commons-jelly + commons-jelly-tags-fmt + 20040902.072321 + + + commons-jelly + commons-jelly-tags-beanshell + 20040902.071629 + + + commons-jelly + commons-jelly-tags-junit + 20040902.070920 + + + io.jenkins + configuration-as-code + 1775.v810dc950b_514 + + + io.jenkins.configuration-as-code + test-harness + 1775.v810dc950b_514 + + + io.jenkins.plugins + snakeyaml-api + 2.2-111.vc6598e30cc65 + @@ -205,11 +369,13 @@ org.apache.commons commons-collections4 4.4 + compile commons-codec commons-codec 1.16.1 + compile org.kohsuke.stapler diff --git a/src/main/java/hudson/plugins/spotinst/api/SpotinstApi.java b/src/main/java/hudson/plugins/spotinst/api/SpotinstApi.java index 97ebb0e..75a3f91 100644 --- a/src/main/java/hudson/plugins/spotinst/api/SpotinstApi.java +++ b/src/main/java/hudson/plugins/spotinst/api/SpotinstApi.java @@ -16,7 +16,7 @@ import hudson.plugins.spotinst.model.redis.LockGroupControllerRequest; import hudson.plugins.spotinst.model.redis.LockGroupControllerResponse; import jenkins.model.Jenkins; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.apache.http.HttpStatus; import org.slf4j.Logger; diff --git a/src/main/java/hudson/plugins/spotinst/cloud/monitor/AwsSpotinstCloudInstanceTypeMonitor.java b/src/main/java/hudson/plugins/spotinst/cloud/monitor/AwsSpotinstCloudInstanceTypeMonitor.java index 180c70e..1dcf563 100644 --- a/src/main/java/hudson/plugins/spotinst/cloud/monitor/AwsSpotinstCloudInstanceTypeMonitor.java +++ b/src/main/java/hudson/plugins/spotinst/cloud/monitor/AwsSpotinstCloudInstanceTypeMonitor.java @@ -5,7 +5,7 @@ import hudson.plugins.spotinst.cloud.AwsSpotinstCloud; import hudson.slaves.Cloud; import jenkins.model.Jenkins; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; import java.util.*; import java.util.stream.Collectors; diff --git a/src/main/java/hudson/plugins/spotinst/cloud/monitor/SpotinstCloudsCommunicationMonitor.java b/src/main/java/hudson/plugins/spotinst/cloud/monitor/SpotinstCloudsCommunicationMonitor.java index c87b3fc..957c2d5 100644 --- a/src/main/java/hudson/plugins/spotinst/cloud/monitor/SpotinstCloudsCommunicationMonitor.java +++ b/src/main/java/hudson/plugins/spotinst/cloud/monitor/SpotinstCloudsCommunicationMonitor.java @@ -6,7 +6,7 @@ import hudson.plugins.spotinst.common.GroupLockingManager; import hudson.plugins.spotinst.common.SpotinstCloudCommunicationState; import jenkins.model.Jenkins; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; import java.util.*; import java.util.stream.Collectors; diff --git a/src/main/java/hudson/plugins/spotinst/jobs/SpotinstSyncGroupsController.java b/src/main/java/hudson/plugins/spotinst/jobs/SpotinstSyncGroupsController.java index 222edd1..61a3096 100644 --- a/src/main/java/hudson/plugins/spotinst/jobs/SpotinstSyncGroupsController.java +++ b/src/main/java/hudson/plugins/spotinst/jobs/SpotinstSyncGroupsController.java @@ -10,7 +10,7 @@ import hudson.plugins.spotinst.jobs.jobSynchronizer.JobSynchronizer; import hudson.slaves.Cloud; import jenkins.model.Jenkins; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; From 978c9ca93244b7c81c1a9591ea5bd3ee3ec59c8c Mon Sep 17 00:00:00 2001 From: sitay Date: Sun, 31 Mar 2024 18:03:39 +0300 Subject: [PATCH 08/15] update dependencies --- pom.xml | 78 ++++++++++++++++++- .../spotinst/cloud/SpotinstCloudSet.java | 14 ++-- 2 files changed, 84 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 3b06e04..37a354e 100644 --- a/pom.xml +++ b/pom.xml @@ -40,11 +40,12 @@ - 2.426 + 2.426.3 11 11 11 11 + 1.33 @@ -288,6 +289,12 @@ org.apache.httpcomponents httpclient 4.5.14 + + + commons-logging + commons-logging + + org.apache.httpcomponents @@ -382,26 +389,93 @@ stapler 1839.ved17667b_a_eb_5 compile + + + commons-logging + commons-logging + + + + + false + + central + Maven Repository Switchboard + http://repo1.maven.org/maven2 + repo.jenkins-ci.org http://repo.jenkins-ci.org/public/ + + groovy.jfrog.io + http://groovy.jfrog.io/ui/native/libs-snapshot + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + repo.jenkins-ci.org - http://repo.jenkins-ci.org/public/ + https://repo.jenkins-ci.org/public/ + + + groovy.jfrog.io + https://groovy.jfrog.io/ui/native/libs-snapshot + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M4 + + + org.apache.maven.surefire + surefire-junit-platform + 3.0.0-M4 + + + + + --illegal-access=permit + + true + + + + org.apache.maven.plugins + maven-failsafe-plugin + 3.0.0-M4 + + + --illegal-access=permit + + true + + + + org.jenkins-ci.tools + maven-hpi-plugin + 3.48 + org.apache.maven.plugins maven-compiler-plugin diff --git a/src/main/java/hudson/plugins/spotinst/cloud/SpotinstCloudSet.java b/src/main/java/hudson/plugins/spotinst/cloud/SpotinstCloudSet.java index b420901..cfac291 100644 --- a/src/main/java/hudson/plugins/spotinst/cloud/SpotinstCloudSet.java +++ b/src/main/java/hudson/plugins/spotinst/cloud/SpotinstCloudSet.java @@ -1,6 +1,8 @@ -package hudson.plugins.spotinst.cloud; - -import jenkins.agents.CloudSet; - -public class SpotinstCloudSet extends CloudSet { -} +//package hudson.plugins.spotinst.cloud; +// +//import hudson.Extension; +//import jenkins.agents.CloudSet; +// +//@Extension +//public class SpotinstCloudSet extends CloudSet { +//} From c53f48334c31ff796680cc8e443eb3992e2b49e2 Mon Sep 17 00:00:00 2001 From: sitay Date: Mon, 1 Apr 2024 11:16:32 +0300 Subject: [PATCH 09/15] update dependencies, add index.jelly --- pom.xml | 66 ++++++++++++++++++++++++++-------- src/main/resources/index.jelly | 7 ++++ 2 files changed, 59 insertions(+), 14 deletions(-) create mode 100644 src/main/resources/index.jelly diff --git a/pom.xml b/pom.xml index 37a354e..9b46740 100644 --- a/pom.xml +++ b/pom.xml @@ -1,12 +1,13 @@ - + 4.0.0 org.jenkins-ci.plugins plugin 4.9 - + spotinst @@ -14,7 +15,6 @@ hpi Spotinst plugin - This plugin allows Jenkins to start agents with the Spot framework and terminate them as they become idle. https://github.com/jenkinsci/spotinst-plugin/blob/master/JenkinsWiki.adoc @@ -33,7 +33,7 @@ - scm:git:git://github.com/jenkinsci/spotinst-plugin.git + scm:git:https://github.com/jenkinsci/spotinst-plugin.git scm:git:git@github.com:jenkinsci/spotinst-plugin.git https://github.com/jenkinsci/spotinst-plugin HEAD @@ -256,6 +256,12 @@ snakeyaml-api 2.2-111.vc6598e30cc65 + + org.codehaus.mojo.signature + java18 + 1.0 + signature + @@ -405,16 +411,12 @@ central Maven Repository Switchboard - http://repo1.maven.org/maven2 + https://repo1.maven.org/maven2 repo.jenkins-ci.org http://repo.jenkins-ci.org/public/ - - groovy.jfrog.io - http://groovy.jfrog.io/ui/native/libs-snapshot - @@ -427,16 +429,12 @@ central Maven Plugin Repository - http://repo1.maven.org/maven2 + https://repo1.maven.org/maven2 repo.jenkins-ci.org https://repo.jenkins-ci.org/public/ - - groovy.jfrog.io - https://groovy.jfrog.io/ui/native/libs-snapshot - @@ -492,6 +490,7 @@ org.codehaus.mojo findbugs-maven-plugin + 3.0.5 none @@ -502,6 +501,11 @@ + + org.jenkins-ci.tools + maven-hpi-plugin + 3.48 + maven-enforcer-plugin 3.4.1 @@ -514,6 +518,40 @@ + + org.codehaus.mojo + animal-sniffer-maven-plugin + 1.19 + + + check + test + + check + + + + org.codehaus.mojo.signature + java18 + + + + + + true + + org.codehaus.mojo.signature + java18 + 1.0 + + java.lang.invoke.MethodHandle + + + + org.eclipse.jetty + jetty-maven-plugin + 11.0.15 + diff --git a/src/main/resources/index.jelly b/src/main/resources/index.jelly new file mode 100644 index 0000000..61b3296 --- /dev/null +++ b/src/main/resources/index.jelly @@ -0,0 +1,7 @@ + + + +
+ This plugin allows Jenkins to start agents with the Spot framework and terminate them as they become idle. +
+
From 838c1b445b3bcefb48882174d6517371edab626c Mon Sep 17 00:00:00 2001 From: sitay Date: Mon, 1 Apr 2024 12:01:34 +0300 Subject: [PATCH 10/15] update dependencies --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 9b46740..eaad35b 100644 --- a/pom.xml +++ b/pom.xml @@ -472,7 +472,7 @@ org.jenkins-ci.tools maven-hpi-plugin - 3.48 + 2.1 org.apache.maven.plugins @@ -504,7 +504,7 @@ org.jenkins-ci.tools maven-hpi-plugin - 3.48 + 2.1 maven-enforcer-plugin @@ -550,7 +550,7 @@ org.eclipse.jetty jetty-maven-plugin - 11.0.15 + 11.0.20 From b4ec1f3feb2a4dfcd64d74938373b64d33963ae2 Mon Sep 17 00:00:00 2001 From: sitay Date: Mon, 1 Apr 2024 13:46:39 +0300 Subject: [PATCH 11/15] update dependencies --- pom.xml | 44 +++++++------------------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) diff --git a/pom.xml b/pom.xml index eaad35b..e2df84b 100644 --- a/pom.xml +++ b/pom.xml @@ -206,41 +206,6 @@ commons-collections 20040616 - - commons-jelly - commons-jelly - 2.16 - - - commons-jelly - commons-jelly-tags-ant - 20040902.071105 - - - commons-jelly - commons-jelly-tags-util - 20040902.071012 - - - commons-jelly - commons-jelly-tags-xml - 20040902.072037 - - - commons-jelly - commons-jelly-tags-fmt - 20040902.072321 - - - commons-jelly - commons-jelly-tags-beanshell - 20040902.071629 - - - commons-jelly - commons-jelly-tags-junit - 20040902.070920 - io.jenkins configuration-as-code @@ -402,6 +367,11 @@ + + org.twdata.maven + mojo-executor + 2.4.0 + @@ -472,7 +442,7 @@ org.jenkins-ci.tools maven-hpi-plugin - 2.1 + 3.48 org.apache.maven.plugins @@ -504,7 +474,7 @@ org.jenkins-ci.tools maven-hpi-plugin - 2.1 + 3.48 maven-enforcer-plugin From 87b1f2ec5834604b1291c97806c8bad8e69b2c45 Mon Sep 17 00:00:00 2001 From: sitay Date: Mon, 1 Apr 2024 13:58:34 +0300 Subject: [PATCH 12/15] remove cloudset --- .../hudson/plugins/spotinst/cloud/SpotinstCloudSet.java | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 src/main/java/hudson/plugins/spotinst/cloud/SpotinstCloudSet.java diff --git a/src/main/java/hudson/plugins/spotinst/cloud/SpotinstCloudSet.java b/src/main/java/hudson/plugins/spotinst/cloud/SpotinstCloudSet.java deleted file mode 100644 index cfac291..0000000 --- a/src/main/java/hudson/plugins/spotinst/cloud/SpotinstCloudSet.java +++ /dev/null @@ -1,8 +0,0 @@ -//package hudson.plugins.spotinst.cloud; -// -//import hudson.Extension; -//import jenkins.agents.CloudSet; -// -//@Extension -//public class SpotinstCloudSet extends CloudSet { -//} From 71c77f4fda556944d1200f7aa35208ac7d8c2156 Mon Sep 17 00:00:00 2001 From: sitay Date: Mon, 1 Apr 2024 14:09:31 +0300 Subject: [PATCH 13/15] update tests --- .../spotinst/cloud/BaseSpotinstCloud.java | 10 +++ .../plugins/spotinst/SpotinstCloudTest.java | 65 ++++++++++--------- 2 files changed, 43 insertions(+), 32 deletions(-) diff --git a/src/main/java/hudson/plugins/spotinst/cloud/BaseSpotinstCloud.java b/src/main/java/hudson/plugins/spotinst/cloud/BaseSpotinstCloud.java index 35aa109..690a911 100644 --- a/src/main/java/hudson/plugins/spotinst/cloud/BaseSpotinstCloud.java +++ b/src/main/java/hudson/plugins/spotinst/cloud/BaseSpotinstCloud.java @@ -173,6 +173,11 @@ public Collection provision(Label label, int excessWorkload) { return Collections.emptyList(); } + @Override + public Collection provision(CloudState state, int excessWorkload) { + return this.provision(state.getLabel(), excessWorkload); + } + @Override public boolean canProvision(Label label) { boolean canProvision = true; @@ -189,6 +194,11 @@ public boolean canProvision(Label label) { return canProvision; } + @Override + public boolean canProvision(CloudState state) { + return this.canProvision(state.getLabel()); + } + @Override public DescriptorImpl getDescriptor() { return (DescriptorImpl) super.getDescriptor(); diff --git a/src/test/java/hudson/plugins/spotinst/SpotinstCloudTest.java b/src/test/java/hudson/plugins/spotinst/SpotinstCloudTest.java index 3447005..e8aabc6 100644 --- a/src/test/java/hudson/plugins/spotinst/SpotinstCloudTest.java +++ b/src/test/java/hudson/plugins/spotinst/SpotinstCloudTest.java @@ -1,5 +1,6 @@ package hudson.plugins.spotinst; +import hudson.model.Label; import hudson.model.Node; import hudson.plugins.spotinst.api.infra.ApiResponse; import hudson.plugins.spotinst.cloud.*; @@ -94,7 +95,7 @@ public void testAwsProvision_whenThereArePendingInsatcnesForAllExecutors_thenSho Map pendingInstances = new HashMap<>(); pendingInstances.put("sir-1", buildPendingInstance("sir-1", 2)); spotinstCloud.setPendingInstances(pendingInstances); - spotinstCloud.provision(null, 2); + spotinstCloud.provision((Label)null, 2); Mockito.verify(RepoManager.getInstance().getAwsGroupRepo(), Mockito.never()) .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString()); } @@ -122,7 +123,7 @@ public void testAwsProvision_whenThereArePendingInsatcnesForPartOfTheExecutors_t .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(result)); - spotinstCloud.provision(null, 4); + spotinstCloud.provision((Label)null, 4); ArgumentCaptor groupCapture = ArgumentCaptor.forClass(String.class); ArgumentCaptor unitsCapture = ArgumentCaptor.forClass(Integer.class); @@ -156,7 +157,7 @@ public void testAwCloud_whenNoConnectionMethodIsProvided_thenDefaultIsJNLP() { .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(result)); - spotCloud.provision(null, 2); + spotCloud.provision((Label)null, 2); List allNodes = Jenkins.get().getNodes(); @@ -206,7 +207,7 @@ public void testAwsCloud_whenSshConnectionMethod_andIpIsAvailable_thenCreateSshL .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - spotCloud.provision(null, 1); + spotCloud.provision((Label)null, 1); spotCloud.monitorInstances(); SpotinstSlave agent = (SpotinstSlave) Jenkins.get().getNode(incomingInstance.getInstanceId()); @@ -253,7 +254,7 @@ public void testAwsCloud_whenSshConnectionMethod_andIpIsNotAvailable_thenDoNotCo .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - spotCloud.provision(null, 1); + spotCloud.provision((Label)null, 1); spotCloud.monitorInstances(); @@ -307,7 +308,7 @@ public void testGcpProvision_whenThereArePendingInsatcnesForAllExecutors_thenSho Map pendingInstances = new HashMap<>(); pendingInstances.put("sin-1", buildPendingInstance("sin-1", 2)); spotinstCloud.setPendingInstances(pendingInstances); - spotinstCloud.provision(null, 2); + spotinstCloud.provision((Label)null, 2); Mockito.verify(RepoManager.getInstance().getGcpGroupRepo(), Mockito.never()) .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString()); } @@ -334,7 +335,7 @@ public void testGcpProvision_whenThereArePendingInsatcnesForPartOfTheExecutors_t .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(result)); - spotinstCloud.provision(null, 4); + spotinstCloud.provision((Label)null, 4); ArgumentCaptor groupCapture = ArgumentCaptor.forClass(String.class); ArgumentCaptor unitsCapture = ArgumentCaptor.forClass(Integer.class); @@ -357,7 +358,7 @@ public void testAzureProvision_whenThereArePendingInsatcnesForAllExecutors_thenS pendingInstances.put("q3213", buildPendingInstance(groupId, 1)); pendingInstances.put("41234", buildPendingInstance(groupId, 1)); spotinstCloud.setPendingInstances(pendingInstances); - spotinstCloud.provision(null, 2); + spotinstCloud.provision((Label)null, 2); Mockito.verify(RepoManager.getInstance().getAzureGroupRepo(), Mockito.never()) .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString()); } @@ -378,7 +379,7 @@ public void testAzureProvision_whenThereArePendingInsatcnesForPartOfTheExecutors .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(Boolean.TRUE)); - spotinstCloud.provision(null, 4); + spotinstCloud.provision((Label)null, 4); ArgumentCaptor groupCapture = ArgumentCaptor.forClass(String.class); ArgumentCaptor unitsCapture = ArgumentCaptor.forClass(Integer.class); @@ -401,7 +402,7 @@ public void testAzureV3Provision_whenThereArePendingInstancesForAllExecutors_the Map pendingInstances = new HashMap<>(); pendingInstances.put("vm-1", buildPendingInstance("vm-1", 2)); spotinstCloud.setPendingInstances(pendingInstances); - spotinstCloud.provision(null, 2); + spotinstCloud.provision((Label)null, 2); Mockito.verify(RepoManager.getInstance().getAzureVmGroupRepo(), Mockito.never()) .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString()); @@ -430,7 +431,7 @@ public void testAzureV3Provision_whenThereArePendingInstancesForPartOfTheExecuto .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(vms)); - spotinstCloud.provision(null, 4); + spotinstCloud.provision((Label)null, 4); ArgumentCaptor groupCapture = ArgumentCaptor.forClass(String.class); ArgumentCaptor unitsCapture = ArgumentCaptor.forClass(Integer.class); @@ -461,7 +462,7 @@ public void testAzureV3Provision_whenUnrecognizedVmSize_thenDefaultTo1Executor() .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(vms)); - spotinstCloud.provision(null, 4); + spotinstCloud.provision((Label)null, 4); Node node = Jenkins.get().getNode("vm-2"); assertNotNull(node); @@ -495,7 +496,7 @@ public void testAzureV3Provision_whenNewInstancesAreLaunched_thenTheirSizeIsAcco .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(vms)); - spotinstCloud.provision(null, 4); + spotinstCloud.provision((Label)null, 4); List allNodes = Jenkins.get().getNodes(); @@ -536,8 +537,8 @@ public void testAzureV3Provision_whenNewInstancesAreLaunched_thenTheirSizeIsAcco .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(vms)); - spotinstCloud.provision(null, 3); - spotinstCloud.provision(null, 2); + spotinstCloud.provision((Label)null, 3); + spotinstCloud.provision((Label)null, 2); Mockito.verify(RepoManager.getInstance().getAzureVmGroupRepo(), Mockito.times(1)) .scaleUp(groupId, 1, accountId); @@ -567,7 +568,7 @@ public void testAzureV3Cloud_whenNoConnectionMethodIsProvided_thenDefaultIsJNLP( .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(vms)); - spotCloud.provision(null, 2); + spotCloud.provision((Label)null, 2); List allNodes = Jenkins.get().getNodes(); @@ -630,7 +631,7 @@ public void testGlobalExecutorOverride_whenIsEnabledAndInstanceTypeIsMatchedInEn .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - cloud.provision(null, 1); + cloud.provision((Label)null, 1); SpotinstSlave agent = (SpotinstSlave) Jenkins.get().getNode(newSpot.getInstanceId()); assertNotNull(agent); @@ -671,7 +672,7 @@ public void testGlobalExecutorOverride_whenIsEnabledAndInstanceTypeIsNotMatchedI .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - cloud.provision(null, 1); + cloud.provision((Label)null, 1); SpotinstSlave agent = (SpotinstSlave) Jenkins.get().getNode(newSpot.getInstanceId()); assertNotNull(agent); @@ -718,7 +719,7 @@ null, accountId, ConnectionMethodEnum.SSH, getSSHConnector(), false, .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - cloud.provision(null, 1); + cloud.provision((Label)null, 1); SpotinstSlave agent = (SpotinstSlave) Jenkins.get().getNode(newSpot.getInstanceId()); assertNotNull(agent); @@ -761,7 +762,7 @@ public void testGlobalExecutorOverride_whenIsDisabledAndInstanceTypeIsNotMatched .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - cloud.provision(null, 1); + cloud.provision((Label)null, 1); SpotinstSlave agent = (SpotinstSlave) Jenkins.get().getNode(newSpot.getInstanceId()); assertNotNull(agent); @@ -802,7 +803,7 @@ public void testGlobalExecutorOverride_whenIsDisabledAndInstanceTypeIsMatchedInE .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - cloud.provision(null, 1); + cloud.provision((Label)null, 1); SpotinstSlave agent = (SpotinstSlave) Jenkins.get().getNode(newSpot.getInstanceId()); assertNotNull(agent); @@ -850,7 +851,7 @@ null, accountId, ConnectionMethodEnum.SSH, getSSHConnector(), false, .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - cloud.provision(null, 1); + cloud.provision((Label)null, 1); SpotinstSlave agent = (SpotinstSlave) Jenkins.get().getNode(newSpot.getInstanceId()); assertNotNull(agent); @@ -892,7 +893,7 @@ public void testGlobalExecutorOverride_whenIsInvalidNegativeAndInstanceTypeIsMat .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - cloud.provision(null, 1); + cloud.provision((Label)null, 1); SpotinstSlave agent = (SpotinstSlave) Jenkins.get().getNode(newSpot.getInstanceId()); assertNotNull(agent); @@ -933,7 +934,7 @@ public void testGlobalExecutorOverride_whenIsInvalidNegativeAndInstanceTypeIsNot .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - cloud.provision(null, 1); + cloud.provision((Label)null, 1); SpotinstSlave agent = (SpotinstSlave) Jenkins.get().getNode(newSpot.getInstanceId()); assertNotNull(agent); @@ -981,7 +982,7 @@ null, accountId, ConnectionMethodEnum.SSH, getSSHConnector(), false, .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - cloud.provision(null, 1); + cloud.provision((Label)null, 1); SpotinstSlave agent = (SpotinstSlave) Jenkins.get().getNode(newSpot.getInstanceId()); assertNotNull(agent); @@ -1022,7 +1023,7 @@ public void testGlobalExecutorOverride_whenIsInvalidNullAndInstanceTypeIsMatched .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - cloud.provision(null, 1); + cloud.provision((Label)null, 1); SpotinstSlave agent = (SpotinstSlave) Jenkins.get().getNode(newSpot.getInstanceId()); assertNotNull(agent); @@ -1063,7 +1064,7 @@ public void testGlobalExecutorOverride_whenIsInvalidNullAndInstanceTypeIsNotMatc .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - cloud.provision(null, 1); + cloud.provision((Label)null, 1); SpotinstSlave agent = (SpotinstSlave) Jenkins.get().getNode(newSpot.getInstanceId()); assertNotNull(agent); @@ -1111,7 +1112,7 @@ null, accountId, ConnectionMethodEnum.SSH, getSSHConnector(), false, .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - cloud.provision(null, 1); + cloud.provision((Label)null, 1); SpotinstSlave agent = (SpotinstSlave) Jenkins.get().getNode(newSpot.getInstanceId()); assertNotNull(agent); @@ -1153,7 +1154,7 @@ public void testGlobalExecutorOverride_whenIsNullAndInstanceTypeIsMatchedInEnum_ .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - cloud.provision(null, 1); + cloud.provision((Label)null, 1); SpotinstSlave agent = (SpotinstSlave) Jenkins.get().getNode(newSpot.getInstanceId()); assertNotNull(agent); @@ -1193,7 +1194,7 @@ public void testGlobalExecutorOverride_whenIsNullAndInstanceTypeIsNotMatchedInEn .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - cloud.provision(null, 1); + cloud.provision((Label)null, 1); SpotinstSlave agent = (SpotinstSlave) Jenkins.get().getNode(newSpot.getInstanceId()); assertNotNull(agent); @@ -1241,7 +1242,7 @@ null, accountId, ConnectionMethodEnum.SSH, getSSHConnector(), false, .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - cloud.provision(null, 1); + cloud.provision((Label)null, 1); SpotinstSlave agent = (SpotinstSlave) Jenkins.get().getNode(newSpot.getInstanceId()); assertNotNull(agent); @@ -1288,7 +1289,7 @@ public void testSpotinstSlaveTermination_ifAgentInPendingInstances_thenAgentIsRe .scaleUp(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString())) .thenReturn(new ApiResponse<>(scaleUpResult)); - cloud.provision(null, 1); + cloud.provision((Label)null, 1); Boolean detachResult = true; Mockito.when( From 3ca9513bd9d76510d80b763a9c749ac53e50e8bb Mon Sep 17 00:00:00 2001 From: sitay Date: Mon, 1 Apr 2024 15:26:16 +0300 Subject: [PATCH 14/15] update tests --- pom.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e2df84b..0ff7ad5 100644 --- a/pom.xml +++ b/pom.xml @@ -45,6 +45,7 @@ 11 11 11 + 11 1.33 @@ -301,7 +302,8 @@ org.jenkins-ci.main jenkins-test-harness - 2182.v0138ccb_c0b_cb_ + 2.31 + test org.jenkins-ci From 4826611a8fcb33208bb31020844d107b67f4f354 Mon Sep 17 00:00:00 2001 From: sitay Date: Tue, 2 Apr 2024 09:18:11 +0300 Subject: [PATCH 15/15] update tests --- pom.xml | 26 +++++----------- .../spotinst/cloud/AwsSpotinstCloud.java | 26 ++++++++++------ .../plugins/spotinst/SpotinstCloudTest.java | 30 ++++++++++++------- 3 files changed, 44 insertions(+), 38 deletions(-) diff --git a/pom.xml b/pom.xml index 0ff7ad5..3bcf371 100644 --- a/pom.xml +++ b/pom.xml @@ -302,7 +302,7 @@ org.jenkins-ci.main jenkins-test-harness - 2.31 + 2182.v0138ccb_c0b_cb_ test @@ -374,6 +374,11 @@ mojo-executor 2.4.0 + + javax.inject + javax.inject + 1 + @@ -415,19 +420,11 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M4 - - - org.apache.maven.surefire - surefire-junit-platform - 3.0.0-M4 - - + 3.2.5 --illegal-access=permit - true @@ -438,7 +435,6 @@ --illegal-access=permit - true @@ -457,17 +453,9 @@ - - true - org.codehaus.mojo findbugs-maven-plugin 3.0.5 - - - none - - diff --git a/src/main/java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java b/src/main/java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java index e99032b..a5550ff 100644 --- a/src/main/java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java +++ b/src/main/java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java @@ -274,26 +274,34 @@ protected BlResponse checkIsStatefulGroup() { ApiResponse groupResponse = awsGroupRepo.getGroup(groupId, this.accountId); if (groupResponse.isRequestSucceed()) { - Boolean result = false; - AwsGroup awsGroup = groupResponse.getValue(); + Boolean result = getIsStatefulFromGroup(groupResponse.getValue()); + + retVal = new BlResponse<>(result); + } + else { + LOGGER.error(String.format("Failed to get group %s. Errors: %s", groupId, groupResponse.getErrors())); + retVal = new BlResponse<>(false); + } + + return retVal; + } + + private static Boolean getIsStatefulFromGroup(AwsGroup awsGroup) { + boolean retVal = false; + + if(awsGroup != null) { AwsGroupStrategy groupStrategy = awsGroup.getStrategy(); if (groupStrategy != null) { AwsGroupPersistence groupPersistence = groupStrategy.getPersistence(); if (groupPersistence != null) { - result = BooleanUtils.isTrue(groupPersistence.getShouldPersistPrivateIp()) || + retVal = BooleanUtils.isTrue(groupPersistence.getShouldPersistPrivateIp()) || BooleanUtils.isTrue(groupPersistence.getShouldPersistBlockDevices()) || BooleanUtils.isTrue(groupPersistence.getShouldPersistRootDevice()) || StringUtils.isNotEmpty(groupPersistence.getBlockDevicesMode()); } } - - retVal = new BlResponse<>(result); - } - else { - LOGGER.error(String.format("Failed to get group %s. Errors: %s", groupId, groupResponse.getErrors())); - retVal = new BlResponse<>(false); } return retVal; diff --git a/src/test/java/hudson/plugins/spotinst/SpotinstCloudTest.java b/src/test/java/hudson/plugins/spotinst/SpotinstCloudTest.java index e8aabc6..66636b5 100644 --- a/src/test/java/hudson/plugins/spotinst/SpotinstCloudTest.java +++ b/src/test/java/hudson/plugins/spotinst/SpotinstCloudTest.java @@ -89,9 +89,10 @@ private PendingInstance buildPendingInstance(String id, Integer executors) { @Test public void testAwsProvision_whenThereArePendingInsatcnesForAllExecutors_thenShouldNotSacleUp() { String groupId = "sig-1"; + String accountId = "act-111"; BaseSpotinstCloud spotinstCloud = new AwsSpotinstCloud(groupId, "", "20", "/tmp", null, SlaveUsageEnum.NORMAL, "", false, true, "", null, - null, null, null, null, null, null, null); + null, accountId, null, null, null, null, null); Map pendingInstances = new HashMap<>(); pendingInstances.put("sir-1", buildPendingInstance("sir-1", 2)); spotinstCloud.setPendingInstances(pendingInstances); @@ -137,8 +138,9 @@ public void testAwsProvision_whenThereArePendingInsatcnesForPartOfTheExecutors_t @Test public void testAwCloud_whenNoConnectionMethodIsProvided_thenDefaultIsJNLP() { String groupId = "sig-1"; + String accountId = "act-111"; BaseSpotinstCloud spotCloud = - new AwsSpotinstCloud(groupId, "", "20", "/tmp", null, null, "", true, null, null, null, null, null, + new AwsSpotinstCloud(groupId, "", "20", "/tmp", null, null, "", true, null, null, null, null, accountId, null, null, false, null, null); jenkinsRule.jenkins.clouds.add(spotCloud); assertEquals(spotCloud.getConnectionMethod(), ConnectionMethodEnum.JNLP); @@ -270,8 +272,9 @@ public void testAwsCloud_whenSshConnectionMethod_andIpIsNotAvailable_thenDoNotCo @Test public void testAwCloud_whenUsePrivateIpIsNull_thenUsePublicIp() { String groupId = "sig-1"; + String accountId = "act-111"; BaseSpotinstCloud spotCloud = - new AwsSpotinstCloud(groupId, "", "20", "/tmp", null, null, "", true, null, null, null, null, null, + new AwsSpotinstCloud(groupId, "", "20", "/tmp", null, null, "", true, null, null, null, null, accountId, null, null, null, null, null); assertFalse(spotCloud.getShouldUsePrivateIp()); @@ -280,8 +283,9 @@ public void testAwCloud_whenUsePrivateIpIsNull_thenUsePublicIp() { @Test public void testAwCloud_whenUsePrivateIpIsTrue_thenUsePrivateIp() { String groupId = "sig-1"; + String accountId = "act-111"; BaseSpotinstCloud spotCloud = - new AwsSpotinstCloud(groupId, "", "20", "/tmp", null, null, "", true, null, null, null, null, null, + new AwsSpotinstCloud(groupId, "", "20", "/tmp", null, null, "", true, null, null, null, null, accountId, null, null, true, null, null); assertTrue(spotCloud.getShouldUsePrivateIp()); @@ -290,8 +294,9 @@ public void testAwCloud_whenUsePrivateIpIsTrue_thenUsePrivateIp() { @Test public void testAwCloud_whenUsePrivateIpIsFalse_thenUsePublicIp() { String groupId = "sig-1"; + String accountId = "act-111"; BaseSpotinstCloud spotCloud = - new AwsSpotinstCloud(groupId, "", "20", "/tmp", null, null, "", true, null, null, null, null, null, + new AwsSpotinstCloud(groupId, "", "20", "/tmp", null, null, "", true, null, null, null, null, accountId, null, null, false, null, null); assertFalse(spotCloud.getShouldUsePrivateIp()); @@ -302,8 +307,9 @@ public void testAwCloud_whenUsePrivateIpIsFalse_thenUsePublicIp() { @Test public void testGcpProvision_whenThereArePendingInsatcnesForAllExecutors_thenShouldNotSacleUp() { String groupId = "sig-1"; + String accountId = "act-111"; BaseSpotinstCloud spotinstCloud = - new GcpSpotinstCloud(groupId, "", "20", "/tmp", null, "", false, true, "", null, null, null, null, null, + new GcpSpotinstCloud(groupId, "", "20", "/tmp", null, "", false, true, "", null, null, accountId, null, null, null, null, null); Map pendingInstances = new HashMap<>(); pendingInstances.put("sin-1", buildPendingInstance("sin-1", 2)); @@ -351,8 +357,9 @@ public void testGcpProvision_whenThereArePendingInsatcnesForPartOfTheExecutors_t @Test public void testAzureProvision_whenThereArePendingInsatcnesForAllExecutors_thenShouldNotSacleUp() { String groupId = "sig-1"; + String accountId = "act-111"; BaseSpotinstCloud spotinstCloud = - new AzureSpotinstCloud(groupId, "", "20", "/tmp", null, "", false, false, "", null, null, null, null, + new AzureSpotinstCloud(groupId, "", "20", "/tmp", null, "", false, false, "", null, null, accountId, null, null, null, null, null); Map pendingInstances = new HashMap<>(); pendingInstances.put("q3213", buildPendingInstance(groupId, 1)); @@ -395,8 +402,9 @@ public void testAzureProvision_whenThereArePendingInsatcnesForPartOfTheExecutors @Test public void testAzureV3Provision_whenThereArePendingInstancesForAllExecutors_thenShouldNotScaleUp() { String groupId = "sig-1"; + String accountId = "act-111"; BaseSpotinstCloud spotinstCloud = - new AzureSpotCloud(groupId, "", "20", "/tmp", null, "", false, true, "", null, null, null, null, null, + new AzureSpotCloud(groupId, "", "20", "/tmp", null, "", false, true, "", null, null, accountId, null, null, null, null, null); Map pendingInstances = new HashMap<>(); @@ -549,8 +557,9 @@ public void testAzureV3Provision_whenNewInstancesAreLaunched_thenTheirSizeIsAcco @Test public void testAzureV3Cloud_whenNoConnectionMethodIsProvided_thenDefaultIsJNLP() { String groupId = "sig-1"; + String accountId = "act-111"; BaseSpotinstCloud spotCloud = - new AzureSpotCloud(groupId, "", "20", "/tmp", null, "", false, true, "", null, null, null, null, null, + new AzureSpotCloud(groupId, "", "20", "/tmp", null, "", false, true, "", null, null, accountId, null, null, null, null, null); jenkinsRule.jenkins.clouds.add(spotCloud); @@ -585,9 +594,10 @@ public void testAzureV3Cloud_whenNoConnectionMethodIsProvided_thenDefaultIsJNLP( @Test public void testGlobalExecutorOverride_whenIsPassedAsNullInCloudConstructor_ThenDefaultIsNotEnabledAndExecutors1() { String groupId = "sig-1"; + String accountId = "act-111"; SpotGlobalExecutorOverride globalOverride = null; BaseSpotinstCloud cloud = - new AwsSpotinstCloud(groupId, "", "20", "/tmp", null, null, "", true, null, null, null, null, null, + new AwsSpotinstCloud(groupId, "", "20", "/tmp", null, null, "", true, null, null, null, null, accountId, ConnectionMethodEnum.SSH, getSSHConnector(), false, globalOverride, null); jenkinsRule.jenkins.clouds.add(cloud);