Skip to content

Commit 044bc98

Browse files
committed
add another test regexp around the content of KUEBCONFIG
1 parent e15ca59 commit 044bc98

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/test/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildStepTest.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,13 @@ public void testEnvVariableFormat() throws Exception {
131131

132132
assertNotNull(b);
133133
assertBuildStatus(b, Result.SUCCESS);
134-
String regExp = "Using temporary file '(.+).kube(.+)config'";
135-
Pattern kubeConfigPathRegexp = Pattern.compile(regExp);
136-
assertTrue("No line in the logs matched the regular expression '" + regExp + "': " + r.getLog(b), kubeConfigPathRegexp.matcher(r.getLog(b)).find());
134+
String regExpGroovy = "Using temporary file '(.+).kube(.+)config'";
135+
Pattern kubeConfigPathRegexpGroovy = Pattern.compile(regExpGroovy);
136+
assertTrue("No line in the logs matched the regular expression '" + regExpGroovy + "': " + r.getLog(b), kubeConfigPathRegexpGroovy.matcher(r.getLog(b)).find());
137+
138+
String regExpShell = "BEGIN:(.+).kube(.+)config:END";
139+
Pattern kubeConfigPathRegexpShell = Pattern.compile(regExpShell);
140+
assertTrue("No line in the logs matched the regular expression '" + regExpShell + "': " + r.getLog(b), kubeConfigPathRegexpShell.matcher(r.getLog(b)).find());
137141
}
138142

139143
private void assertBuildStatus(WorkflowRun b, Result result) throws Exception {

src/test/resources/org/jenkinsci/plugins/kubernetes/cli/withKubeConfigPipelineEchoPath.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ node{
22
stage('Run') {
33
withKubeConfig([credentialsId: 'test-credentials', serverUrl: 'https://localhost:6443']) {
44
echo "Using temporary file '${env.KUBECONFIG}'"
5+
sh 'echo "BEGIN:${KUBECONFIG}:END"'
56
}
67
}
78
}

0 commit comments

Comments
 (0)