From 98e4be29e98340d7e1ffd38302dca8ff3ffff785 Mon Sep 17 00:00:00 2001 From: Scot Schuchert-Wells <6007097+scotwells@users.noreply.github.com> Date: Wed, 11 Nov 2026 09:54:50 +0000 Subject: [PATCH] test: fix reachability e2e delete/rebuild race The reachability e2e step deleted the projected hub copy with a blocking delete, then waited for the copy to be gone. The cell's writeback controller rebuilds the copy within the same second, so the wait never observed absence and the step failed with "context deadline exceeded" even though the copy was back. Key changes: - Delete the hub copy with --wait=false and poll for a replacement carrying a new UID, matching the pattern already used in networkinterfaceclaim-bound-interface-delete. Co-authored-by: polylane[bot] <277585245+polylane[bot]@users.noreply.github.com> --- .../chainsaw-test.yaml | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/test/e2e/vpcendpointslice-reachability-event/chainsaw-test.yaml b/test/e2e/vpcendpointslice-reachability-event/chainsaw-test.yaml index 2062407c..edae3e4b 100644 --- a/test/e2e/vpcendpointslice-reachability-event/chainsaw-test.yaml +++ b/test/e2e/vpcendpointslice-reachability-event/chainsaw-test.yaml @@ -113,13 +113,30 @@ spec: - name: A copy deleted on the hub comes back within seconds try: - - delete: + - script: cluster: nso-hub - ref: - apiVersion: discovery.k8s.io/v1 - kind: EndpointSlice - name: vpc-us-central-1-reachability-pod - namespace: vpc-reachability-e2e + content: | + set -eu + was=$(kubectl -n vpc-reachability-e2e get endpointslice vpc-us-central-1-reachability-pod \ + -o 'jsonpath={.metadata.uid}') + [ -n "$was" ] || { echo "the hub copy has no UID"; exit 1; } + # --wait=false on purpose: the cell rebuilds the copy within + # seconds, so a waiting delete can watch the replacement appear + # under the same name and never return. + kubectl -n vpc-reachability-e2e delete endpointslice vpc-us-central-1-reachability-pod --wait=false + deadline=$(($(date +%s) + 10)) + while :; do + snapshot=$(kubectl -n vpc-reachability-e2e get endpointslice vpc-us-central-1-reachability-pod \ + --ignore-not-found --request-timeout=5s \ + -o 'jsonpath={.metadata.uid}{"|"}{.metadata.deletionTimestamp}') + now=${snapshot%%|*} + deleting=${snapshot#*|} + if [ -n "$now" ] && [ "$now" != "$was" ] && [ -z "$deleting" ]; then + break + fi + [ "$(date +%s)" -lt "$deadline" ] || { echo "timed out waiting for the hub copy to come back: original UID ${was}, last observation ${snapshot}"; exit 1; } + sleep 1 + done - assert: cluster: nso-hub timeout: 10s