Skip to content

Commit c7df1b3

Browse files
cbandyandrewlecuyer
authored andcommitted
Wait for Patroni labels in tests that switchover
1 parent d352e1d commit c7df1b3

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

testing/kuttl/e2e/delete/10-assert.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
apiVersion: postgres-operator.crunchydata.com/v1beta1
23
kind: PostgresCluster
34
metadata:
@@ -9,6 +10,22 @@ status:
910
replicas: 2
1011
updatedReplicas: 2
1112
---
13+
# Patroni labels and readiness happen separately.
14+
# The next step expects to find pods by their role label; wait for them here.
15+
apiVersion: v1
16+
kind: Pod
17+
metadata:
18+
labels:
19+
postgres-operator.crunchydata.com/cluster: delete-switchover
20+
postgres-operator.crunchydata.com/role: master
21+
---
22+
apiVersion: v1
23+
kind: Pod
24+
metadata:
25+
labels:
26+
postgres-operator.crunchydata.com/cluster: delete-switchover
27+
postgres-operator.crunchydata.com/role: replica
28+
---
1229
apiVersion: batch/v1
1330
kind: Job
1431
metadata:

testing/kuttl/e2e/delete/11-annotate.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
apiVersion: kuttl.dev/v1beta1
33
kind: TestStep
44
commands:
5-
# Label instance pods with their current role for assert
5+
# Label instance pods with their current role. These labels will stick around
6+
# because switchover does not recreate any pods.
67
- script: |
78
kubectl label --namespace="${NAMESPACE}" pods \
89
--selector='postgres-operator.crunchydata.com/role=master' \

testing/kuttl/e2e/delete/12-assert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
# After switchover, a former replica should now be the primary.
2+
# Wait for switchover to finish. A former replica should now be the primary.
33
apiVersion: v1
44
kind: Pod
55
metadata:

testing/kuttl/e2e/switchover/01-assert.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,19 @@ status:
99
replicas: 2
1010
readyReplicas: 2
1111
updatedReplicas: 2
12+
---
13+
# Patroni labels and readiness happen separately.
14+
# The next step expects to find pods by their role label; wait for them here.
15+
apiVersion: v1
16+
kind: Pod
17+
metadata:
18+
labels:
19+
postgres-operator.crunchydata.com/cluster: switchover
20+
postgres-operator.crunchydata.com/role: master
21+
---
22+
apiVersion: v1
23+
kind: Pod
24+
metadata:
25+
labels:
26+
postgres-operator.crunchydata.com/cluster: switchover
27+
postgres-operator.crunchydata.com/role: replica

0 commit comments

Comments
 (0)