Skip to content

Commit 26dbcdd

Browse files
committed
[test]: Additional fixes for flaky tests
Signed-off-by: Moshe Vayner <moshe@vayner.me>
1 parent afe40f9 commit 26dbcdd

4 files changed

Lines changed: 61 additions & 34 deletions

File tree

e2e/test/lb-fw-delete-acl/chainsaw-test.yaml

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -68,42 +68,41 @@ spec:
6868
content: |
6969
set -euo pipefail
7070
71-
for i in {1..10}; do
72-
nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh)
71+
nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh)
7372
74-
fw=$(curl -s --request GET \
75-
-H "Authorization: Bearer $LINODE_TOKEN" \
76-
-H "Content-Type: application/json" --fail-early --retry 3 \
77-
-H "accept: application/json" \
78-
"$LINODE_URL/v4/nodebalancers/${nbid}/firewalls" || true)
79-
80-
fwid=$(echo $fw | jq -r '.data[].id')
73+
fw=$(curl -s --request GET \
74+
-H "Authorization: Bearer $LINODE_TOKEN" \
75+
-H "Content-Type: application/json" --fail-early --retry 3 \
76+
-H "accept: application/json" \
77+
"$LINODE_URL/v4/nodebalancers/${nbid}/firewalls" || true)
8178
82-
# Patch service to remove ACL annotation
83-
kubectl patch service svc-test -n $NAMESPACE --type=json -p='[{"op": "remove", "path": "/metadata/annotations/service.beta.kubernetes.io~1linode-loadbalancer-firewall-acl"}]'
84-
sleep 5
79+
fwid=$(echo $fw | jq -r '.data[].id')
8580
86-
# Check that firewall is no longer attached to nb
87-
fw=$(curl -s --request GET \
88-
-H "Authorization: Bearer $LINODE_TOKEN" \
89-
-H "Content-Type: application/json" --fail-early --retry 3 \
90-
-H "accept: application/json" \
91-
"$LINODE_URL/v4/nodebalancers/${nbid}/firewalls" || true)
92-
93-
fwCount=$(echo $fw | jq -r '.data | length')
81+
# Patch service to remove ACL annotation
82+
kubectl patch service svc-test -n $NAMESPACE --type=json -p='[{"op": "remove", "path": "/metadata/annotations/service.beta.kubernetes.io~1linode-loadbalancer-firewall-acl"}]'
9483
95-
# Check if firewall is deleted
96-
fwRespCode=$(curl -s -o /dev/null -w "%{http_code}" \
97-
--request GET \
98-
-H "Authorization: Bearer $LINODE_TOKEN" \
99-
-H "accept: application/json" \
100-
"$LINODE_URL/v4/networking/firewalls/${fwid}" || true)
101-
102-
if [[ $fwCount -eq 0 && $fwRespCode -eq "404" ]]; then
103-
echo "firewall detatched and deleted"
104-
break
105-
fi
106-
sleep 10
84+
for i in {1..10}; do
85+
# Check that firewall is no longer attached to nb
86+
fw=$(curl -s --request GET \
87+
-H "Authorization: Bearer $LINODE_TOKEN" \
88+
-H "Content-Type: application/json" --fail-early --retry 3 \
89+
-H "accept: application/json" \
90+
"$LINODE_URL/v4/nodebalancers/${nbid}/firewalls" || true)
91+
92+
fwCount=$(echo $fw | jq -r '.data | length')
93+
94+
# Check if firewall is deleted
95+
fwRespCode=$(curl -s -o /dev/null -w "%{http_code}" \
96+
--request GET \
97+
-H "Authorization: Bearer $LINODE_TOKEN" \
98+
-H "accept: application/json" \
99+
"$LINODE_URL/v4/networking/firewalls/${fwid}" || true)
100+
101+
if [[ $fwCount -eq 0 && $fwRespCode -eq "404" ]]; then
102+
echo "firewall detatched and deleted"
103+
break
104+
fi
105+
sleep 10
107106
done
108107
check:
109108
($error == null): true

e2e/test/lb-with-http-to-https/chainsaw-test.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ spec:
4343
kubectl patch svc svc-test -n $NAMESPACE --type='json' -p='[{"op": "add", "path": "/spec/ports/-", "value": {"name": "https", "port": 443, "targetPort": 8080, "protocol": "TCP"}}]'
4444
check:
4545
($error == null): true
46-
- name: Check endpoints
46+
- name: Check endpoints have addresses
4747
try:
4848
- assert:
4949
resource:
@@ -53,14 +53,22 @@ spec:
5353
name: svc-test
5454
(subsets[0].addresses != null): true
5555
(subsets[0].ports != null): true
56-
(length(subsets[0].ports)): 2
5756
catch:
5857
- describe:
5958
apiVersion: v1
6059
kind: Pod
6160
- describe:
6261
apiVersion: v1
6362
kind: Service
63+
- name: Check endpoints have two ports
64+
try:
65+
- assert:
66+
resource:
67+
apiVersion: v1
68+
kind: Endpoints
69+
metadata:
70+
name: svc-test
71+
(length(subsets[0].ports)): 2
6472
- name: Check that loadbalancer ip is assigned
6573
try:
6674
- assert:

e2e/test/lb-with-proxyprotocol-override/chainsaw-test.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ spec:
3636
name: svc-test
3737
(subsets[0].addresses != null): true
3838
(subsets[0].ports != null): true
39+
- name: Check that loadbalancer ip is assigned
40+
try:
41+
- assert:
42+
resource:
43+
apiVersion: v1
44+
kind: Service
45+
metadata:
46+
name: svc-test
47+
status:
48+
(loadBalancer.ingress[0].ip != null): true
3949
- name: Annotate service port 80 with v1 and 8080 with v2
4050
try:
4151
- script:

e2e/test/lb-with-proxyprotocol-port-specific/chainsaw-test.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ spec:
3636
name: svc-test
3737
(subsets[0].addresses != null): true
3838
(subsets[0].ports != null): true
39+
- name: Check that loadbalancer ip is assigned
40+
try:
41+
- assert:
42+
resource:
43+
apiVersion: v1
44+
kind: Service
45+
metadata:
46+
name: svc-test
47+
status:
48+
(loadBalancer.ingress[0].ip != null): true
3949
- name: Annotate service port 80 with v1 and 8080 with v2
4050
try:
4151
- script:

0 commit comments

Comments
 (0)