Skip to content

Commit 3dc5357

Browse files
authored
Merge pull request #138 from MarkEWaite/octopus
Do not require docker socket access in test
2 parents ab0407e + ef57773 commit 3dc5357

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

pom.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.jenkins-ci.plugins</groupId>
77
<artifactId>plugin</artifactId>
8-
<version>4.68</version>
8+
<version>4.70</version>
99
<relativePath/>
1010
</parent>
1111

@@ -62,7 +62,6 @@
6262
<dependency>
6363
<groupId>org.jenkins-ci.plugins</groupId>
6464
<artifactId>authentication-tokens</artifactId>
65-
<version>1.4</version>
6665
</dependency>
6766
<dependency>
6867
<groupId>org.jenkinsci.plugins</groupId>
@@ -156,7 +155,7 @@
156155
<dependency>
157156
<groupId>io.jenkins.tools.bom</groupId>
158157
<artifactId>bom-2.387.x</artifactId>
159-
<version>2163.v2d916d90c305</version>
158+
<version>2230.v0cb_4040cde55</version>
160159
<scope>import</scope>
161160
<type>pom</type>
162161
</dependency>

src/test/java/org/jenkinsci/plugins/docker/commons/tools/DockerToolInstallerTest.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ private FilePath downloadDocker(DumbSlave slave, FilePath toolDir, String versio
111111
ByteArrayOutputStream baos = new ByteArrayOutputStream();
112112
TeeOutputStream tee = new TeeOutputStream(baos, new PlainTextConsoleOutputStream(System.err));
113113
TaskListener l = new StreamTaskListener(tee);
114+
ByteArrayOutputStream errStream = new ByteArrayOutputStream();
114115

115116
FilePath exe = toolDir.child(version+"/bin/docker");
116117
// Download for first time:
@@ -124,9 +125,14 @@ private FilePath downloadDocker(DumbSlave slave, FilePath toolDir, String versio
124125
assertThat(baos.toString(), not(containsString(Messages.DockerToolInstaller_downloading_docker_client_(version))));
125126
// Version check:
126127
baos.reset();
127-
assertEquals(0, slave.createLauncher(l).launch().cmds(exe.getRemote(), "version", "--format", "{{.Client.Version}}").quiet(true).stdout(tee).stderr(System.err).join());
128-
if (!version.equals("latest")) {
129-
assertEquals(version, baos.toString().trim());
128+
if (slave.createLauncher(l).launch().cmds(exe.getRemote(), "version", "--format", "{{.Client.Version}}").quiet(true).stdout(tee).stderr(errStream).join() != 0) {
129+
/* Failure message should mention /var/run/docker.sock */
130+
assertThat(errStream.toString(), containsString("/var/run/docker.sock"));
131+
} else {
132+
/* Successful output should either be `latest` or include the docker version */
133+
if (!version.equals("latest")) {
134+
assertEquals(version, baos.toString().trim());
135+
}
130136
}
131137
return exe;
132138
}

0 commit comments

Comments
 (0)