Skip to content

Commit 89bfe4e

Browse files
authored
Merge pull request #1475 from kubernetes-sigs/copilot/add-unit-tests-simulation-configs
Add unit tests for pod/general simulation configurations
2 parents 9914957 + d8c6811 commit 89bfe4e

14 files changed

+494
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: pod-complete
5+
ownerReferences:
6+
- apiVersion: batch/v1
7+
kind: Job
8+
name: job
9+
uid: uid
10+
spec:
11+
containers:
12+
- name: container
13+
image: image
14+
nodeName: node
15+
status:
16+
conditions:
17+
- lastProbeTime: null
18+
lastTransitionTime: "2006-01-02T15:04:05Z"
19+
status: "True"
20+
type: Initialized
21+
- lastProbeTime: null
22+
lastTransitionTime: "2006-01-02T15:04:05Z"
23+
message: ''
24+
reason: ''
25+
status: "True"
26+
type: Ready
27+
- lastProbeTime: null
28+
lastTransitionTime: "2006-01-02T15:04:05Z"
29+
message: ''
30+
reason: ''
31+
status: "True"
32+
type: ContainersReady
33+
containerStatuses:
34+
- image: image
35+
name: container
36+
ready: true
37+
restartCount: 0
38+
started: true
39+
state:
40+
running:
41+
startedAt: "2006-01-02T15:04:05Z"
42+
hostIP: 10.0.0.1
43+
podIP: 10.0.0.2
44+
phase: Running
45+
startTime: "2006-01-02T15:04:05Z"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiGroup: v1
2+
kind: Pod
3+
name: pod-complete
4+
stages:
5+
- delay:
6+
- 1000000000
7+
- 5000000000
8+
next:
9+
- data:
10+
status:
11+
containerStatuses:
12+
- image: image
13+
name: container
14+
ready: true
15+
restartCount: 0
16+
started: false
17+
state:
18+
terminated:
19+
exitCode: 0
20+
finishedAt: <Now>
21+
reason: Completed
22+
startedAt: <Now>
23+
phase: Succeeded
24+
kind: patch
25+
subresource: status
26+
type: application/merge-patch+json
27+
stage: pod-complete
28+
weight: 1
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: pod-create-with-init
5+
spec:
6+
initContainers:
7+
- name: init-container
8+
image: init-image
9+
containers:
10+
- name: container
11+
image: image
12+
nodeName: node
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
apiGroup: v1
2+
kind: Pod
3+
name: pod-create-with-init
4+
stages:
5+
- delay:
6+
- 1000000000
7+
- 5000000000
8+
next:
9+
- data:
10+
status:
11+
conditions:
12+
- lastProbeTime: null
13+
lastTransitionTime: <Now>
14+
message: 'containers with incomplete status: [ init-container ]'
15+
reason: ContainersNotInitialized
16+
status: "False"
17+
type: Initialized
18+
- lastProbeTime: null
19+
lastTransitionTime: <Now>
20+
message: 'containers with unready status: [ container ]'
21+
reason: ContainersNotReady
22+
status: "False"
23+
type: Ready
24+
- lastProbeTime: null
25+
lastTransitionTime: <Now>
26+
message: 'containers with unready status: [ container ]'
27+
reason: ContainersNotReady
28+
status: "False"
29+
type: ContainersReady
30+
containerStatuses:
31+
- image: image
32+
name: container
33+
ready: false
34+
restartCount: 0
35+
started: false
36+
state:
37+
waiting:
38+
reason: PodInitializing
39+
hostIP: <NodeIPWith("node")>
40+
initContainerStatuses:
41+
- image: init-image
42+
name: init-container
43+
ready: false
44+
restartCount: 0
45+
started: false
46+
state:
47+
waiting:
48+
reason: PodInitializing
49+
phase: Pending
50+
podIP: <PodIPWith("node", false, "", "pod-create-with-init", "")>
51+
kind: patch
52+
subresource: status
53+
type: application/merge-patch+json
54+
stage: pod-create
55+
weight: 1
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: pod-create
5+
spec:
6+
containers:
7+
- name: container
8+
image: image
9+
nodeName: node
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
apiGroup: v1
2+
kind: Pod
3+
name: pod-create
4+
stages:
5+
- delay:
6+
- 1000000000
7+
- 5000000000
8+
next:
9+
- data:
10+
status:
11+
conditions:
12+
- lastProbeTime: null
13+
lastTransitionTime: <Now>
14+
status: "True"
15+
type: Initialized
16+
- lastProbeTime: null
17+
lastTransitionTime: <Now>
18+
message: 'containers with unready status: [ container ]'
19+
reason: ContainersNotReady
20+
status: "False"
21+
type: Ready
22+
- lastProbeTime: null
23+
lastTransitionTime: <Now>
24+
message: 'containers with unready status: [ container ]'
25+
reason: ContainersNotReady
26+
status: "False"
27+
type: ContainersReady
28+
containerStatuses:
29+
- image: image
30+
name: container
31+
ready: false
32+
restartCount: 0
33+
started: false
34+
state:
35+
waiting:
36+
reason: ContainerCreating
37+
hostIP: <NodeIPWith("node")>
38+
phase: Pending
39+
podIP: <PodIPWith("node", false, "", "pod-create", "")>
40+
kind: patch
41+
subresource: status
42+
type: application/merge-patch+json
43+
stage: pod-create
44+
weight: 1
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: pod-delete
5+
deletionTimestamp: "2006-01-02T15:04:05Z"
6+
spec:
7+
containers:
8+
- name: container
9+
image: image
10+
nodeName: node
11+
status:
12+
conditions:
13+
- lastProbeTime: null
14+
lastTransitionTime: "2006-01-02T15:04:05Z"
15+
status: "True"
16+
type: Initialized
17+
- lastProbeTime: null
18+
lastTransitionTime: "2006-01-02T15:04:05Z"
19+
message: ''
20+
reason: ''
21+
status: "True"
22+
type: Ready
23+
- lastProbeTime: null
24+
lastTransitionTime: "2006-01-02T15:04:05Z"
25+
message: ''
26+
reason: ''
27+
status: "True"
28+
type: ContainersReady
29+
containerStatuses:
30+
- image: image
31+
name: container
32+
ready: true
33+
restartCount: 0
34+
started: true
35+
state:
36+
running:
37+
startedAt: "2006-01-02T15:04:05Z"
38+
hostIP: 10.0.0.1
39+
podIP: 10.0.0.2
40+
phase: Running
41+
startTime: "2006-01-02T15:04:05Z"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiGroup: v1
2+
kind: Pod
3+
name: pod-delete
4+
stages:
5+
- delay:
6+
- 0
7+
next:
8+
- kind: delete
9+
stage: pod-delete
10+
weight: 1
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: pod-init-container-completed
5+
spec:
6+
initContainers:
7+
- name: init-container
8+
image: init-image
9+
containers:
10+
- name: container
11+
image: image
12+
nodeName: node
13+
status:
14+
conditions:
15+
- lastProbeTime: null
16+
lastTransitionTime: "2006-01-02T15:04:05Z"
17+
message: 'containers with incomplete status: [ init-container ]'
18+
reason: ContainersNotInitialized
19+
status: "False"
20+
type: Initialized
21+
- lastProbeTime: null
22+
lastTransitionTime: "2006-01-02T15:04:05Z"
23+
message: 'containers with unready status: [ container ]'
24+
reason: ContainersNotReady
25+
status: "False"
26+
type: Ready
27+
- lastProbeTime: null
28+
lastTransitionTime: "2006-01-02T15:04:05Z"
29+
message: 'containers with unready status: [ container ]'
30+
reason: ContainersNotReady
31+
status: "False"
32+
type: ContainersReady
33+
initContainerStatuses:
34+
- image: init-image
35+
name: init-container
36+
ready: true
37+
restartCount: 0
38+
started: true
39+
state:
40+
running:
41+
startedAt: "2006-01-02T15:04:05Z"
42+
containerStatuses:
43+
- image: image
44+
name: container
45+
ready: false
46+
restartCount: 0
47+
started: false
48+
state:
49+
waiting:
50+
reason: PodInitializing
51+
hostIP: 10.0.0.1
52+
podIP: 10.0.0.2
53+
phase: Pending
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
apiGroup: v1
2+
kind: Pod
3+
name: pod-init-container-completed
4+
stages:
5+
- delay:
6+
- 1000000000
7+
- 5000000000
8+
next:
9+
- data:
10+
status:
11+
conditions:
12+
- lastProbeTime: null
13+
lastTransitionTime: <Now>
14+
reason: ""
15+
status: "True"
16+
type: Initialized
17+
containerStatuses:
18+
- image: image
19+
name: container
20+
ready: false
21+
restartCount: 0
22+
started: false
23+
state:
24+
waiting:
25+
reason: ContainerCreating
26+
initContainerStatuses:
27+
- image: init-image
28+
name: init-container
29+
ready: true
30+
restartCount: 0
31+
started: false
32+
state:
33+
terminated:
34+
exitCode: 0
35+
finishedAt: <Now>
36+
reason: Completed
37+
startedAt: <Now>
38+
kind: patch
39+
subresource: status
40+
type: application/merge-patch+json
41+
stage: pod-init-container-completed
42+
weight: 1

0 commit comments

Comments
 (0)