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 <tomhjp@users.noreply.github.com>
This commit is contained in:
Tom Proctor authored and GitHub committed 2026-09-22 14:23:44 +01:00
1 parent b26751eafc
commit df0bd83055
2 files changed
+6 -3

No files matched your search

-3
View File
@@ -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)
+6
View File
@@ -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