From df0bd83055faf9e89a110add6358aedbdac1735e Mon Sep 17 00:00:00 2001 From: Tom Proctor Date: Tue, 22 Sep 2026 14:23:44 +0100 Subject: [PATCH] cmd/k8s-operator/e2e: allow concurrent and partially torn down tests (#21416) Loosens the connector route assertion to allow concurrent tests against the same tailnet to more reliably pass, while still asserting the client itself is advertising those routes and they're recognised in the API. Also make createOrUpdate more resilient to a test that didn't fully tear down on the same cluster previously. By respecting the existing resource version and finalizers, we can update resources that didn't get deleted from a previous run. Updates tailscale/corp#45426 Signed-off-by: Tom Proctor --- cmd/k8s-operator/e2e/connector_test.go | 3 --- cmd/k8s-operator/e2e/setup.go | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/k8s-operator/e2e/connector_test.go b/cmd/k8s-operator/e2e/connector_test.go index 8f1d5ef47..d413b9022 100644 --- a/cmd/k8s-operator/e2e/connector_test.go +++ b/cmd/k8s-operator/e2e/connector_test.go @@ -155,9 +155,6 @@ func TestConnectorSubnetRouter(t *testing.T) { if !slices.Contains(routes.Advertised, route) { return fmt.Errorf("device %s does not advertise %s: %v", deviceID, route, routes.Advertised) } - if !slices.Contains(routes.Enabled, route) { - return fmt.Errorf("route %s not yet enabled on device %s: %v", route, deviceID, routes.Enabled) - } return nil }); err != nil { t.Fatalf("verifying subnet router routes: %v", err) diff --git a/cmd/k8s-operator/e2e/setup.go b/cmd/k8s-operator/e2e/setup.go index 9762e5fb5..8be5f66bf 100644 --- a/cmd/k8s-operator/e2e/setup.go +++ b/cmd/k8s-operator/e2e/setup.go @@ -1086,6 +1086,12 @@ func createOrUpdate(ctx context.Context, cl client.Client, obj client.Object) er if !apierrors.IsAlreadyExists(err) { return err } + current := obj.DeepCopyObject().(client.Object) + if err := cl.Get(ctx, client.ObjectKeyFromObject(obj), current); err != nil { + return err + } + obj.SetResourceVersion(current.GetResourceVersion()) + obj.SetFinalizers(current.GetFinalizers()) return cl.Update(ctx, obj) } return nil