From 0e0ebd7ae910ec858a2cd4c8c47db932555bea89 Mon Sep 17 00:00:00 2001 From: Jason Vigil Date: Tue, 17 Sep 2024 00:04:16 +0000 Subject: [PATCH] fix: Fix shouldSkipDriftDetection to handle direct resources --- .../dynamic/dynamic_controller_integration_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/controller/dynamic/dynamic_controller_integration_test.go b/pkg/controller/dynamic/dynamic_controller_integration_test.go index 091dbcae12..ab46db9449 100644 --- a/pkg/controller/dynamic/dynamic_controller_integration_test.go +++ b/pkg/controller/dynamic/dynamic_controller_integration_test.go @@ -514,10 +514,14 @@ func shouldSkipDriftDetection(t *testing.T, resourceContext contexts.ResourceCon t.Fatalf("error parsing `resourceID` field schema: %v", err) } return isServerGenerated + } else if resourceContext.IsTFResource { + // Skip drift detection test for tf-based resources with server-generated id. + rc := testservicemapping.GetResourceConfig(t, smLoader, u) + return hasServerGeneratedId(*rc) + } else { + // Drift detection tests are enabled by default for direct resources. + return false } - // Skip drift detection test for tf-based resources with server-generated id. - rc := testservicemapping.GetResourceConfig(t, smLoader, u) - return hasServerGeneratedId(*rc) } func hasServerGeneratedId(rc v1alpha1.ResourceConfig) bool {