Skip to content

Commit ca2eaf3

Browse files
Merge pull request #484 from linode/e2e-tests
[test] e2e test fixes
2 parents 2079be9 + 85b478a commit ca2eaf3

File tree

4 files changed

+32
-15
lines changed

4 files changed

+32
-15
lines changed

e2e/test/lb-created-with-reserved-ip-change-ip-concurrently/chainsaw-test.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ spec:
2929
3030
if ! [[ $reserved_ip =~ $re ]]; then
3131
echo "Reserved ip [$reserved_ip] is incorrect, failed to create a reserved ip"
32+
exit 1
3233
fi
3334
3435
reserved_ip2=$(curl -s --request POST \
@@ -42,6 +43,7 @@ spec:
4243
4344
if ! [[ $reserved_ip2 =~ $re ]]; then
4445
echo "Reserved ip [$reserved_ip2] is incorrect, failed to create a reserved ip"
46+
exit 1
4547
fi
4648
4749
create_cm=$(kubectl -n $NAMESPACE create configmap reserved-ip-config --from-literal=ReservedIP=$reserved_ip --from-literal=ReservedIP2=$reserved_ip2 -o yaml --dry-run=client | kubectl apply -f -)
@@ -75,11 +77,13 @@ spec:
7577
reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE)
7678
if [ -z "$reserved_ip" ]; then
7779
echo "Error: No reserved ip found in configmap"
80+
exit 1
7881
fi
7982
8083
reserved_ip2=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP2}' -n $NAMESPACE)
8184
if [ -z "$reserved_ip2" ]; then
8285
echo "Error: No reserved ip found in configmap"
86+
exit 1
8387
fi
8488
8589
delete_rip=$(curl -s --request DELETE \
@@ -101,7 +105,7 @@ spec:
101105
if [[ "$delete_rip2" == "{}" ]]; then
102106
echo "Reserved IP $reserved_ip2 deleted successfully"
103107
else
104-
echo "Unable to delete reserved ip: $reserved_ip. Error: $delete_rip2"
108+
echo "Unable to delete reserved ip: $reserved_ip2. Error: $delete_rip2"
105109
fi
106110
107111
delete_cm=$(kubectl delete configmap reserved-ip-config -n $NAMESPACE)
@@ -142,11 +146,13 @@ spec:
142146
reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE)
143147
if [ -z "$reserved_ip" ]; then
144148
echo "Error: No reserved ip found in configmap"
149+
exit 1
145150
fi
146151
147152
reserved_ip2=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP2}' -n $NAMESPACE)
148153
if [ -z "$reserved_ip2" ]; then
149154
echo "Error: No reserved ip found in configmap"
155+
exit 1
150156
fi
151157
152158
parallel -j 2 patch_annotation ::: $reserved_ip2 "100.10.10.10"
@@ -187,16 +193,19 @@ spec:
187193
reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE)
188194
if [ -z "$reserved_ip" ]; then
189195
echo "Error: No reserved ip found in configmap"
196+
exit 1
190197
fi
191198
192199
reserved_ip2=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP2}' -n $NAMESPACE)
193200
if [ -z "$reserved_ip2" ]; then
194201
echo "Error: No reserved ip found in configmap"
202+
exit 1
195203
fi
196204
197205
service_ip=$(kubectl get svc svc-test -n $NAMESPACE -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
198206
if [ -z "$service_ip" ]; then
199207
echo "Error: No service ip found for service svc-test"
208+
exit 1
200209
fi
201210
echo "{\"service_ip\": $service_ip}"
202211
echo "{\"reserved_ip\": $reserved_ip}"

e2e/test/lb-created-with-reserved-ip-multiple-change-ip/chainsaw-test.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ spec:
2929
3030
if ! [[ $reserved_ip =~ $re ]]; then
3131
echo "Reserved ip [$reserved_ip] is incorrect, failed to create a reserved ip"
32+
exit 1
3233
fi
3334
3435
reserved_ip2=$(curl -s --request POST \
@@ -42,6 +43,7 @@ spec:
4243
4344
if ! [[ $reserved_ip2 =~ $re ]]; then
4445
echo "Reserved ip [$reserved_ip2] is incorrect, failed to create a reserved ip"
46+
exit 1
4547
fi
4648
4749
create_cm=$(kubectl -n $NAMESPACE create configmap reserved-ip-config --from-literal=ReservedIP=$reserved_ip --from-literal=ReservedIP2=$reserved_ip2 -o yaml --dry-run=client | kubectl apply -f -)
@@ -76,11 +78,13 @@ spec:
7678
reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE)
7779
if [ -z "$reserved_ip" ]; then
7880
echo "Error: No reserved ip found in configmap"
81+
exit 1
7982
fi
8083
8184
reserved_ip2=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP2}' -n $NAMESPACE)
8285
if [ -z "$reserved_ip2" ]; then
8386
echo "Error: No reserved ip found in configmap"
87+
exit 1
8488
fi
8589
8690
delete_rip=$(curl -s --request DELETE \
@@ -102,7 +106,7 @@ spec:
102106
if [[ "$delete_rip2" == "{}" ]]; then
103107
echo "Reserved IP $reserved_ip2 deleted successfully"
104108
else
105-
echo "Unable to delete reserved ip: $reserved_ip. Error: $delete_rip2"
109+
echo "Unable to delete reserved ip: $reserved_ip2. Error: $delete_rip2"
106110
fi
107111
108112
delete_cm=$(kubectl delete configmap reserved-ip-config -n $NAMESPACE)
@@ -221,4 +225,4 @@ spec:
221225
($error == null): true
222226
(contains($stdout, 'No reserved ip found in configmap')): false
223227
(contains($stdout, 'No service ip found for service svc-test')): false
224-
(contains($stdout, 'IPs do not match')): false
228+
(contains($stdout, 'IPs do not match')): false

e2e/test/lb-update-port/chainsaw-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ spec:
8585
8686
podnames=()
8787
88-
for i in {1..10}; do
88+
for i in {1..20}; do
8989
if [[ ${#podnames[@]} -lt 2 ]]; then
9090
output=$(curl -s $IP:8080 | jq -e .podName || true)
9191

e2e/test/lb-with-proxyprotocol-default-annotation/chainsaw-test.yaml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,23 @@ spec:
4747
4848
nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh)
4949
50-
nbconfig=$(curl -s \
51-
-H "Authorization: Bearer $LINODE_TOKEN" \
52-
-H "Content-Type: application/json" \
53-
"$LINODE_URL/v4/nodebalancers/$nbid/configs")
50+
for i in {1..20}; do
51+
nbconfig=$(curl -s \
52+
-H "Authorization: Bearer $LINODE_TOKEN" \
53+
-H "Content-Type: application/json" \
54+
"$LINODE_URL/v4/nodebalancers/$nbid/configs")
5455
55-
port_80_v2=$(echo $nbconfig | jq -r '.data[] | select(.port == 80) | .proxy_protocol == "v2"')
56-
port_8080_v2=$(echo $nbconfig | jq -r '.data[] | select(.port == 8080) | .proxy_protocol == "v2"')
56+
port_80_v2=$(echo $nbconfig | jq -r '.data[] | select(.port == 80) | .proxy_protocol == "v2"')
57+
port_8080_v2=$(echo $nbconfig | jq -r '.data[] | select(.port == 8080) | .proxy_protocol == "v2"')
5758
58-
if [[ $port_80_v2 == "true" && $port_8080_v2 == "true" ]]; then
59-
echo "Conditions met"
60-
else
61-
echo "Conditions not met"
62-
fi
59+
if [[ $port_80_v2 == "true" && $port_8080_v2 == "true" ]]; then
60+
echo "Conditions met"
61+
break
62+
else
63+
echo "Conditions not met"
64+
sleep 10
65+
fi
66+
done
6367
check:
6468
($error): ~
6569
(contains($stdout, 'Conditions met')): true

0 commit comments

Comments
 (0)