Skip to content

Commit 9966fd8

Browse files
authored
Merge pull request #498 from linode/fix-flaky-udp-e2etest
[test][fix] reduce flakiness with e2e test
2 parents 882e025 + 5146a6e commit 9966fd8

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ generate-capl-cluster-manifests:
165165
create-capl-cluster:
166166
# Create a CAPL cluster with updated CCM and wait for it to be ready
167167
kubectl apply -f $(MANIFEST_NAME).yaml
168-
kubectl wait --for=condition=ControlPlaneReady cluster/$(CLUSTER_NAME) --timeout=600s || (kubectl get cluster -o yaml; kubectl get linodecluster -o yaml; kubectl get linodemachines -o yaml)
168+
kubectl wait --for=condition=ControlPlaneReady cluster/$(CLUSTER_NAME) --timeout=600s || (kubectl get cluster -o yaml; kubectl get linodecluster -o yaml; kubectl get linodemachines -o yaml; kubectl logs -n capl-system deployments/capl-controller-manager --tail=50)
169169
kubectl wait --for=condition=NodeHealthy=true machines -l cluster.x-k8s.io/cluster-name=$(CLUSTER_NAME) --timeout=900s
170170
clusterctl get kubeconfig $(CLUSTER_NAME) > $(KUBECONFIG_PATH)
171171
KUBECONFIG=$(KUBECONFIG_PATH) kubectl wait --for=condition=Ready nodes --all --timeout=600s

e2e/test/lb-with-udp-ports-stickiness/chainsaw-test.yaml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,33 @@ spec:
4747
echo "Nodebalancer config found, updating config stickiness"
4848
4949
kubectl annotate --overwrite svc svc-test -n $NAMESPACE service.beta.kubernetes.io/linode-loadbalancer-default-stickiness=source_ip
50-
sleep 5s
51-
52-
echo "Verifying that stickiness is set to source_ip"
53-
nbconfig=$(LINODE_TOKEN=$LINODE_TOKEN NBID=$nbid ../scripts/get-nb-config.sh)
54-
stickiness=$(echo $nbconfig | jq -r '.stickiness')
55-
echo "stickiness is $stickiness"
50+
51+
echo "Waiting for stickiness to be updated to source_ip..."
52+
max_attempts=12
53+
for i in $(seq 1 $max_attempts); do
54+
echo "Attempt $i/$max_attempts: Checking stickiness..."
55+
nbconfig=$(LINODE_TOKEN=$LINODE_TOKEN NBID=$nbid ../scripts/get-nb-config.sh)
56+
stickiness=$(echo $nbconfig | jq -r '.stickiness')
57+
echo "Current stickiness: $stickiness"
58+
59+
if [[ "$stickiness" == "source_ip" ]]; then
60+
echo "Stickiness successfully updated to source_ip"
61+
break
62+
fi
63+
64+
if [[ $i -eq $max_attempts ]]; then
65+
echo "Timeout: Stickiness was not updated to source_ip after $max_attempts attempts"
66+
exit 1
67+
fi
68+
69+
echo "Waiting 10 seconds before next check..."
70+
sleep 10
71+
done
5672
check:
5773
($error == null): true
58-
(contains($stdout, 'stickiness is source_ip')): true
74+
(contains($stdout, 'Stickiness successfully updated to source_ip')): true
75+
catch:
76+
- script:
77+
content: |
78+
echo "Test failed. Fetching CCM logs..."
79+
kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-with-udp-ports-stickiness"

e2e/test/lb-with-udp-ports-stickiness/create-pods-services.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ metadata:
3535
name: svc-test
3636
labels:
3737
app: lb-with-udp-ports-stickiness
38+
annotations:
39+
service.beta.kubernetes.io/linode-loadbalancer-default-algorithm: ring_hash
3840
spec:
3941
type: LoadBalancer
4042
selector:

0 commit comments

Comments
 (0)