Skip to content

Commit b8da99e

Browse files
author
Mor Cohen
committed
Create a test
1 parent dd061ba commit b8da99e

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

src/test/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/KubernetesDeclarativeAgentTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ public void declarativeWithNonexistentDockerImage() throws Exception {
179179
r.assertLogContains("ERROR: Unable to pull Docker image", b);
180180
}
181181

182+
@Test
183+
public void declarativeWithCreateContainerError() throws Exception {
184+
assertNotNull(createJobThenScheduleRun());
185+
r.assertBuildStatus(Result.ABORTED, r.waitForCompletion(b));
186+
r.assertLogContains("ERROR: Container creation error", b);
187+
}
188+
182189
@Issue("JENKINS-61360")
183190
@Test
184191
public void declarativeShowRawYamlFalse() throws Exception {
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
pipeline {
2+
agent {
3+
kubernetes {
4+
yaml '''
5+
apiVersion: v1
6+
kind: Pod
7+
metadata:
8+
labels:
9+
some-label: some-label-value
10+
spec:
11+
containers:
12+
- name: busybox
13+
image: busybox
14+
tty: true
15+
command: ['sh', '-c', "thiscommandshouldcreateanerror;"]
16+
'''
17+
}
18+
}
19+
stages {
20+
stage('Run') {
21+
steps {
22+
container('busybox') {
23+
sh """
24+
will never run
25+
"""
26+
}
27+
}
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)