Skip to content

Commit ae0e479

Browse files
committed
DockerDSLTest.firstDoNoHarm flaky just like jenkinsci/credentials-binding-plugin#279
1 parent de51b4c commit ae0e479

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/test/java/org/jenkinsci/plugins/docker/workflow/DockerDSLTest.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
import org.jvnet.hudson.test.RestartableJenkinsRule;
4747

4848
import java.io.File;
49+
import java.io.FileNotFoundException;
4950
import java.io.IOException;
51+
import java.nio.charset.StandardCharsets;
52+
import java.nio.file.NoSuchFileException;
5053
import java.util.Collections;
5154
import java.util.Set;
5255
import java.util.TreeSet;
@@ -100,8 +103,14 @@ private static void grep(File dir, String text, String prefix, Set<String> match
100103
String qualifiedName = prefix + kid.getName();
101104
if (kid.isDirectory()) {
102105
grep(kid, text, qualifiedName + "/", matches);
103-
} else if (kid.isFile() && FileUtils.readFileToString(kid).contains(text)) {
104-
matches.add(qualifiedName);
106+
} else {
107+
try {
108+
if (FileUtils.readFileToString(kid, StandardCharsets.UTF_8).contains(text)) {
109+
matches.add(qualifiedName);
110+
}
111+
} catch (FileNotFoundException | NoSuchFileException x) {
112+
// ignore, e.g. tmp file
113+
}
105114
}
106115
}
107116
}

src/test/java/org/jenkinsci/plugins/docker/workflow/RegistryEndpointStepTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ void register(String name) throws Exception{
270270
}
271271
}
272272

273-
274273
public static class MockLauncherStep extends Step {
275274

276275
@DataBoundConstructor

0 commit comments

Comments
 (0)