Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit e2ea2bb

Browse files
Bump minimum jenkins version and fix failing tests (#381)
* bump min jenkins version and fix failing tests * fix url warning in pom * update email in pom.xml
1 parent a7cb770 commit e2ea2bb

8 files changed

+213
-189
lines changed

pom.xml

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,61 +4,74 @@
44
<parent>
55
<groupId>org.jenkins-ci.plugins</groupId>
66
<artifactId>plugin</artifactId>
7-
<version>3.57</version>
7+
<version>4.75</version>
88
<relativePath />
99
</parent>
10+
1011
<artifactId>matlab</artifactId>
1112
<version>2.15.1-SNAPSHOT</version>
1213
<packaging>hpi</packaging>
14+
15+
<name>MATLAB Plugin</name>
16+
<url>https://github.com/jenkinsci/matlab-plugin</url>
17+
<description>Jenkins plugin for MATLAB</description>
18+
1319
<developers>
1420
<developer>
1521
<id>mathworks_ci_team</id>
1622
<name>MathWorks</name>
17-
<email>nbhoski@mathworks.com</email>
23+
<email>continuous-integration@mathworks.com</email>
1824
</developer>
1925
</developers>
20-
<properties>
21-
<jenkins.version>2.164.3</jenkins.version>
22-
<java.level>8</java.level>
23-
</properties>
24-
<name>MATLAB Plugin</name>
25-
<description>Jenkins plugin for MATLAB</description>
26-
<url>https://github.com/jenkinsci/matlab-plugin</url>
26+
2727
<licenses>
2828
<license>
2929
<name>MIT License</name>
3030
<url>https://opensource.org/licenses/MIT</url>
3131
</license>
3232
</licenses>
33+
3334
<repositories>
3435
<repository>
3536
<id>repo.jenkins-ci.org</id>
3637
<url>https://repo.jenkins-ci.org/public/</url>
3738
</repository>
3839
</repositories>
40+
3941
<pluginRepositories>
4042
<pluginRepository>
4143
<id>repo.jenkins-ci.org</id>
4244
<url>https://repo.jenkins-ci.org/public/</url>
4345
</pluginRepository>
4446
</pluginRepositories>
47+
4548
<scm>
4649
<connection>scm:git:ssh://github.com/jenkinsci/matlab-plugin.git</connection>
4750
<developerConnection>scm:git:ssh://[email protected]/jenkinsci/matlab-plugin.git</developerConnection>
48-
<url>http://github.com/jenkinsci/matlab-plugin</url>
51+
<url>https://github.com/jenkinsci/matlab-plugin</url>
4952
<tag>HEAD</tag>
5053
</scm>
54+
55+
<properties>
56+
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
57+
<jenkins.baseline>2.387</jenkins.baseline>
58+
<jenkins.version>${jenkins.baseline}.3</jenkins.version>
59+
<!-- TODO fix violations -->
60+
<spotbugs.threshold>High</spotbugs.threshold>
61+
</properties>
62+
5163
<dependencyManagement>
5264
<dependencies>
5365
<dependency>
5466
<groupId>io.jenkins.tools.bom</groupId>
55-
<artifactId>bom-2.164.x</artifactId>
56-
<version>4</version>
57-
<scope>import</scope>
67+
<artifactId>bom-${jenkins.baseline}.x</artifactId>
68+
<version>2543.vfb_1a_5fb_9496d</version>
5869
<type>pom</type>
70+
<scope>import</scope>
5971
</dependency>
6072
</dependencies>
6173
</dependencyManagement>
74+
6275
<dependencies>
6376
<!-- JSON Parser -->
6477
<dependency>
@@ -100,16 +113,25 @@
100113
<artifactId>workflow-job</artifactId>
101114
<scope>test</scope>
102115
</dependency>
103-
<!-- Mockito -->
104-
<dependency>
105-
<groupId>org.mockito</groupId>
106-
<artifactId>mockito-core</artifactId>
107-
<version>3.1.0</version>
108-
<scope>test</scope>
109-
</dependency>
116+
<dependency>
117+
<groupId>org.mockito</groupId>
118+
<artifactId>mockito-core</artifactId>
119+
<version>3.1.0</version>
120+
<scope>test</scope>
121+
</dependency>
122+
<dependency>
123+
<groupId>org.eclipse.jetty</groupId>
124+
<artifactId>jetty-util</artifactId>
125+
<version>11.0.24</version>
126+
<scope>test</scope>
127+
</dependency>
110128
</dependencies>
111129
<build>
112130
<plugins>
131+
<plugin>
132+
<groupId>org.jenkins-ci.tools</groupId>
133+
<artifactId>maven-hpi-plugin</artifactId>
134+
</plugin>
113135
<!-- Plugin to download the matlab run scripts and keep it under class
114136
resource folder -->
115137
<plugin>

src/test/java/integ/com/mathworks/ci/RunMatlabBuildBuilderTest.java

Lines changed: 56 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -305,56 +305,62 @@ public void verifyDefaultMatlabNotPicked() throws Exception {
305305
jenkins.assertLogContains("MatlabNotFoundError", build);
306306
}
307307

308-
/*
309-
* Test to verify if Matrix build fails when MATLAB is not available.
310-
*
308+
/*
309+
* Test to verify if Matrix build fails when MATLAB is not available.
310+
*
311311
* NOTE: This test assumes there is no MATLAB installed and is not on System Path.
312312
*
313-
*/
314-
@Test
315-
public void verifyMatrixBuildFails() throws Exception {
316-
MatrixProject matrixProject = jenkins.createProject(MatrixProject.class);
317-
Axis axes = new Axis("VERSION", "R2018a", "R2015b");
318-
matrixProject.setAxes(new AxisList(axes));
319-
String matlabRoot = getMatlabroot("R2018b");
320-
this.buildWrapper.setMatlabBuildWrapperContent(new MatlabBuildWrapperContent(Message.getValue("matlab.custom.location"), matlabRoot.replace("R2018b", "$VERSION")));
321-
matrixProject.getBuildWrappersList().add(this.buildWrapper);
322-
323-
scriptBuilder.setTasks("");
324-
matrixProject.getBuildersList().add(scriptBuilder);
325-
Map<String, String> vals = new HashMap<String, String>();
326-
vals.put("VERSION", "R2018a");
327-
Combination c1 = new Combination(vals);
328-
MatrixRun build = matrixProject.scheduleBuild2(0).get().getRun(c1);
329-
jenkins.assertLogContains("buildtool", build);
330-
jenkins.assertBuildStatus(Result.FAILURE, build);
331-
vals.put("VERSION", "R2015b");
332-
Combination c2 = new Combination(vals);
333-
MatrixRun build2 = matrixProject.scheduleBuild2(0).get().getRun(c2);
334-
jenkins.assertLogContains("MatlabNotFoundError", build2);
335-
jenkins.assertBuildStatus(Result.FAILURE, build2);
336-
}
337-
338-
/*
339-
* Test to verify if Matrix build passes (mock MATLAB).
340-
*/
341-
@Test
342-
public void verifyMatrixBuildPasses() throws Exception {
343-
MatrixProject matrixProject = jenkins.createProject(MatrixProject.class);
344-
Axis axes = new Axis("VERSION", "R2018a", "R2018b");
345-
matrixProject.setAxes(new AxisList(axes));
346-
String matlabRoot = getMatlabroot("R2018b");
347-
this.buildWrapper.setMatlabBuildWrapperContent(new MatlabBuildWrapperContent(Message.getValue("matlab.custom.location"), matlabRoot.replace("R2018b", "$VERSION")));
348-
matrixProject.getBuildWrappersList().add(this.buildWrapper);
349-
RunMatlabBuildBuilderTester tester = new RunMatlabBuildBuilderTester(matlabExecutorAbsolutePath,
350-
"-positive");
351-
352-
tester.setTasks("");
353-
matrixProject.getBuildersList().add(tester);
354-
MatrixBuild build = matrixProject.scheduleBuild2(0).get();
355-
356-
jenkins.assertLogContains("R2018a completed", build);
357-
jenkins.assertLogContains("R2018b completed", build);
358-
jenkins.assertBuildStatus(Result.SUCCESS, build);
359-
}
313+
*/
314+
@Test
315+
public void verifyMatrixBuildFails() throws Exception {
316+
MatrixProject matrixProject = jenkins.createProject(MatrixProject.class);
317+
Axis axes = new Axis("VERSION", "R2018a", "R2015b");
318+
matrixProject.setAxes(new AxisList(axes));
319+
String matlabRoot = getMatlabroot("R2018b");
320+
this.buildWrapper.setMatlabBuildWrapperContent(new MatlabBuildWrapperContent(Message.getValue("matlab.custom.location"), matlabRoot.replace("R2018b", "$VERSION")));
321+
matrixProject.getBuildWrappersList().add(this.buildWrapper);
322+
323+
scriptBuilder.setTasks("");
324+
matrixProject.getBuildersList().add(scriptBuilder);
325+
326+
// Check for first matrix combination.
327+
Map<String, String> vals = new HashMap<String, String>();
328+
vals.put("VERSION", "R2018a");
329+
Combination c1 = new Combination(vals);
330+
MatrixRun build1 = matrixProject.scheduleBuild2(0).get().getRun(c1);
331+
332+
jenkins.assertLogContains("buildtool", build1);
333+
jenkins.assertBuildStatus(Result.FAILURE, build1);
334+
335+
// Check for second Matrix combination
336+
vals.put("VERSION", "R2015b");
337+
Combination c2 = new Combination(vals);
338+
MatrixRun build2 = matrixProject.scheduleBuild2(0).get().getRun(c2);
339+
340+
jenkins.assertLogContains("MatlabNotFoundError", build2);
341+
jenkins.assertBuildStatus(Result.FAILURE, build2);
342+
}
343+
344+
/*
345+
* Test to verify if Matrix build passes (mock MATLAB).
346+
*/
347+
@Test
348+
public void verifyMatrixBuildPasses() throws Exception {
349+
MatrixProject matrixProject = jenkins.createProject(MatrixProject.class);
350+
Axis axes = new Axis("VERSION", "R2018a", "R2018b");
351+
matrixProject.setAxes(new AxisList(axes));
352+
String matlabRoot = getMatlabroot("R2018b");
353+
this.buildWrapper.setMatlabBuildWrapperContent(new MatlabBuildWrapperContent(Message.getValue("matlab.custom.location"), matlabRoot.replace("R2018b", "$VERSION")));
354+
matrixProject.getBuildWrappersList().add(this.buildWrapper);
355+
RunMatlabBuildBuilderTester tester = new RunMatlabBuildBuilderTester(matlabExecutorAbsolutePath,
356+
"-positive");
357+
358+
tester.setTasks("");
359+
matrixProject.getBuildersList().add(tester);
360+
MatrixBuild build = matrixProject.scheduleBuild2(0).get();
361+
362+
jenkins.assertLogContains("R2018a completed", build);
363+
jenkins.assertLogContains("R2018b completed", build);
364+
jenkins.assertBuildStatus(Result.SUCCESS, build);
365+
}
360366
}

src/test/java/integ/com/mathworks/ci/RunMatlabBuildStepTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void verifyMATLABPathNotSet() throws Exception {
5151
public void verifyMATLABstartsInWorkspace() throws Exception {
5252
DumbSlave s = j.createOnlineSlave();
5353
project.setDefinition(
54-
new CpsFlowDefinition("node('!master') { runMATLABBuild() }", true));
54+
new CpsFlowDefinition("node('!built-in') { runMATLABBuild() }", true));
5555

5656
FilePath workspace = s.getWorkspaceFor(project);
5757
String workspaceName = workspace.getName();
@@ -78,7 +78,7 @@ public void verifyMATLABstartsInWorkspace() throws Exception {
7878
public void verifyPipelineOnSlave() throws Exception {
7979
DumbSlave s = j.createOnlineSlave();
8080
project.setDefinition(new CpsFlowDefinition(
81-
"node('!master') { runMATLABBuild() }", true));
81+
"node('!built-in') { runMATLABBuild() }", true));
8282

8383
s.getWorkspaceFor(project);
8484
WorkflowRun build = project.scheduleBuild2(0).get();

src/test/java/integ/com/mathworks/ci/RunMatlabCommandBuilderTest.java

Lines changed: 51 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
*
88
*/
99

10-
import com.gargoylesoftware.htmlunit.WebAssert;
11-
import com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput;
12-
import com.gargoylesoftware.htmlunit.html.HtmlPage;
10+
import org.htmlunit.WebAssert;
11+
import org.htmlunit.html.HtmlCheckBoxInput;
12+
import org.htmlunit.html.HtmlPage;
1313
import java.io.File;
1414
import java.io.IOException;
1515
import java.net.URISyntaxException;
@@ -306,65 +306,63 @@ public void verifyDefaultMatlabNotPicked() throws Exception {
306306
jenkins.assertLogContains("MatlabNotFoundError", build);
307307
}
308308

309-
/*
310-
* Test to verify if Matrix build fails when MATLAB is not available.
309+
/*
310+
* Test to verify if Matrix build fails when MATLAB is not available.
311311
*
312312
* NOTE: This test assumes there is no MATLAB installed and is not on System Path.
313313
*
314-
*/
315-
@Test
316-
public void verifyMatrixBuildFails() throws Exception {
317-
MatrixProject matrixProject = jenkins.createProject(MatrixProject.class);
318-
Axis axes = new Axis("VERSION", "R2018a", "R2015b");
319-
matrixProject.setAxes(new AxisList(axes));
320-
String matlabRoot = getMatlabroot("R2018b");
321-
this.buildWrapper.setMatlabBuildWrapperContent(new MatlabBuildWrapperContent(Message.getValue("matlab.custom.location"), matlabRoot.replace("R2018b", "$VERSION")));
322-
matrixProject.getBuildWrappersList().add(this.buildWrapper);
323-
324-
scriptBuilder.setMatlabCommand("pwd");
325-
matrixProject.getBuildersList().add(scriptBuilder);
326-
Map<String, String> vals = new HashMap<String, String>();
327-
vals.put("VERSION", "R2018a");
328-
Combination c1 = new Combination(vals);
329-
MatrixRun build = matrixProject.scheduleBuild2(0).get().getRun(c1);
330-
jenkins.assertLogContains("run-matlab-command", build);
331-
jenkins.assertBuildStatus(Result.FAILURE, build);
332-
vals.put("VERSION", "R2015b");
333-
Combination c2 = new Combination(vals);
334-
MatrixRun build2 = matrixProject.scheduleBuild2(0).get().getRun(c2);
335-
jenkins.assertLogContains("MatlabNotFoundError", build2);
336-
jenkins.assertBuildStatus(Result.FAILURE, build2);
337-
}
314+
*/
315+
@Test
316+
public void verifyMatrixBuildFails() throws Exception {
317+
MatrixProject matrixProject = jenkins.createProject(MatrixProject.class);
318+
Axis axes = new Axis("VERSION", "R2018a", "R2015b");
319+
matrixProject.setAxes(new AxisList(axes));
320+
String matlabRoot = getMatlabroot("R2018b");
321+
this.buildWrapper.setMatlabBuildWrapperContent(new MatlabBuildWrapperContent(Message.getValue("matlab.custom.location"), matlabRoot.replace("R2018b", "$VERSION")));
322+
matrixProject.getBuildWrappersList().add(this.buildWrapper);
323+
324+
scriptBuilder.setMatlabCommand("pwd");
325+
matrixProject.getBuildersList().add(scriptBuilder);
326+
Map<String, String> vals = new HashMap<String, String>();
327+
vals.put("VERSION", "R2018a");
328+
Combination c1 = new Combination(vals);
329+
MatrixRun build = matrixProject.scheduleBuild2(0).get().getRun(c1);
330+
jenkins.assertLogContains("run-matlab-command", build);
331+
jenkins.assertBuildStatus(Result.FAILURE, build);
332+
vals.put("VERSION", "R2015b");
333+
Combination c2 = new Combination(vals);
334+
MatrixRun build2 = matrixProject.scheduleBuild2(0).get().getRun(c2);
335+
jenkins.assertLogContains("MatlabNotFoundError", build2);
336+
jenkins.assertBuildStatus(Result.FAILURE, build2);
337+
}
338338

339-
/*
340-
* Test to verify if Matrix build passes (mock MATLAB).
341-
*/
342-
@Test
343-
public void verifyMatrixBuildPasses() throws Exception {
344-
MatrixProject matrixProject = jenkins.createProject(MatrixProject.class);
345-
Axis axes = new Axis("VERSION", "R2018a", "R2018b");
346-
matrixProject.setAxes(new AxisList(axes));
347-
String matlabRoot = getMatlabroot("R2018b");
348-
this.buildWrapper.setMatlabBuildWrapperContent(new MatlabBuildWrapperContent(Message.getValue("matlab.custom.location"), matlabRoot.replace("R2018b", "$VERSION")));
349-
matrixProject.getBuildWrappersList().add(this.buildWrapper);
350-
RunMatlabCommandBuilderTester tester = new RunMatlabCommandBuilderTester(matlabExecutorAbsolutePath,
351-
"-positive");
352-
353-
tester.setMatlabCommand("pwd");
354-
matrixProject.getBuildersList().add(tester);
355-
MatrixBuild build = matrixProject.scheduleBuild2(0).get();
356-
357-
jenkins.assertLogContains("R2018a completed", build);
358-
jenkins.assertLogContains("R2018b completed", build);
359-
jenkins.assertBuildStatus(Result.SUCCESS, build);
339+
/*
340+
* Test to verify if Matrix build passes (mock MATLAB).
341+
*/
342+
@Test
343+
public void verifyMatrixBuildPasses() throws Exception {
344+
MatrixProject matrixProject = jenkins.createProject(MatrixProject.class);
345+
Axis axes = new Axis("VERSION", "R2018a", "R2018b");
346+
matrixProject.setAxes(new AxisList(axes));
347+
String matlabRoot = getMatlabroot("R2018b");
348+
this.buildWrapper.setMatlabBuildWrapperContent(new MatlabBuildWrapperContent(Message.getValue("matlab.custom.location"), matlabRoot.replace("R2018b", "$VERSION")));
349+
matrixProject.getBuildWrappersList().add(this.buildWrapper);
350+
RunMatlabCommandBuilderTester tester = new RunMatlabCommandBuilderTester(matlabExecutorAbsolutePath,
351+
"-positive");
352+
353+
tester.setMatlabCommand("pwd");
354+
matrixProject.getBuildersList().add(tester);
355+
MatrixBuild build = matrixProject.scheduleBuild2(0).get();
356+
357+
jenkins.assertLogContains("R2018a completed", build);
358+
jenkins.assertLogContains("R2018b completed", build);
359+
jenkins.assertBuildStatus(Result.SUCCESS, build);
360360
}
361361

362-
/*
362+
/*
363363
* Test to verify if command parses succesfully when multiple combinations of
364364
* characters are passed. (candidate for integ-tests once integrated)
365365
*/
366-
367-
368366
public void verifyMultispecialChar() throws Exception {
369367
final String actualCommand =
370368
"!\"\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
@@ -384,7 +382,6 @@ public void verifyMultispecialChar() throws Exception {
384382
/*
385383
* Test to verify error message when command is empty.
386384
*/
387-
388385
@Test
389386
public void verifyErrorMessageOnEmptyCommand() throws Exception {
390387
this.buildWrapper.setMatlabBuildWrapperContent(new MatlabBuildWrapperContent(Message.getValue("matlab.custom.location"), getMatlabroot("R2017a")));

0 commit comments

Comments
 (0)