Skip to content

Commit ab14b18

Browse files
authored
test: Improve the assertions for the restarter-no-unneeded-restart test (#395)
* test: Improve the assertions for the restarter-no-unneeded-restart test * Remove generation = 3 assertion
1 parent ee043d0 commit ab14b18

2 files changed

Lines changed: 15 additions & 42 deletions

File tree

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,8 @@
11
---
2-
apiVersion: kuttl.dev/v1beta1
3-
kind: TestAssert
4-
timeout: 180
5-
commands:
6-
- script: |
7-
kubectl -n $NAMESPACE rollout status sts/early --timeout=5m
8-
9-
read n1 t1 n2 t2 n3 t3 < <(
10-
kubectl -n $NAMESPACE get pod early-{1,2,0} \
11-
-o jsonpath='{range .items[*]}{.metadata.name}{" "}{.metadata.creationTimestamp}{" "}{end}'
12-
)
13-
14-
if [[ "$t1" > "$t2" || "$t2" > "$t3" ]]; then
15-
echo "ERROR: Pod creation order invalid:"
16-
printf " %s: %s\n %s: %s\n %s: %s\n" "$n1" "$t1" "$n2" "$t2" "$n3" "$t3"
17-
exit 1
18-
fi
19-
20-
echo "OK: Pod creation order verified:"
21-
printf " %s (%s)\n %s (%s)\n %s (%s)\n" "$n1" "$t1" "$n2" "$t2" "$n3" "$t3"
22-
echo " Asserted: $n1 <= $n2 <= $n3"
2+
apiVersion: apps/v1
3+
kind: StatefulSet
4+
metadata:
5+
name: early
6+
status:
7+
readyReplicas: 3
8+
replicas: 3
Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
11
---
2-
apiVersion: kuttl.dev/v1beta1
3-
kind: TestAssert
4-
timeout: 180
5-
commands:
6-
- script: |
7-
kubectl -n $NAMESPACE rollout status sts/late --timeout=5m
8-
9-
read n0 t0 n1 t1 n2 t2 < <(
10-
kubectl -n $NAMESPACE get pod late-{0,1,2} \
11-
-o jsonpath='{range .items[*]}{.metadata.name}{" "}{.metadata.creationTimestamp}{" "}{end}'
12-
)
13-
14-
if [[ "$t0" > "$t1" || "$t1" > "$t2" ]]; then
15-
echo "ERROR: Pod creation order invalid:"
16-
printf " %s: %s\n %s: %s\n %s: %s\n" "$n0" "$t0" "$n1" "$t1" "$n2" "$t2"
17-
exit 1
18-
fi
19-
20-
echo "OK: Pod creation order verified:"
21-
printf " %s (%s)\n %s (%s)\n %s (%s)\n" "$n0" "$t0" "$n1" "$t1" "$n2" "$t2"
22-
echo " Asserted: $n0 <= $n1 <= $n2"
2+
apiVersion: apps/v1
3+
kind: StatefulSet
4+
metadata:
5+
name: late
6+
generation: 1
7+
status:
8+
readyReplicas: 3
9+
replicas: 3

0 commit comments

Comments
 (0)