From 40f0b7a4d3bf9b3dc9e0c379af81b7bada7f3935 Mon Sep 17 00:00:00 2001 From: Preslav Date: Thu, 9 Nov 2023 19:13:39 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Fix=20flaky=20variant=20cycle=20?= =?UTF-8?q?test.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- policy/bundle.go | 2 +- policy/policy_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/policy/bundle.go b/policy/bundle.go index ca49637b..6497de9f 100644 --- a/policy/bundle.go +++ b/policy/bundle.go @@ -612,7 +612,7 @@ const ( ) var ErrVariantCycleDetected = func(mrn string) error { - return fmt.Errorf("variant cycle in %s detected", mrn) + return fmt.Errorf("variant cycle detected in %s", mrn) } func detectVariantCycles(queries map[string]*explorer.Mquery) error { diff --git a/policy/policy_test.go b/policy/policy_test.go index 6f76aba7..ad278054 100644 --- a/policy/policy_test.go +++ b/policy/policy_test.go @@ -369,7 +369,7 @@ queries: pInitial := bundleInitial.Policies[0] pInitial.InvalidateLocalChecksums() _, err = bundleInitial.Compile(context.Background(), schema, nil) - require.Equal(t, policy.ErrVariantCycleDetected("//local.cnspec.io/run/local-execution/queries/variant1"), err) + require.Contains(t, err.Error(), "variant cycle detected") } { @@ -401,6 +401,6 @@ queries: pInitial := bundleInitial.Policies[0] pInitial.InvalidateLocalChecksums() _, err = bundleInitial.Compile(context.Background(), schema, nil) - require.Equal(t, policy.ErrVariantCycleDetected("//local.cnspec.io/run/local-execution/queries/variant1"), err) + require.Contains(t, err.Error(), "variant cycle detected") } }