From b0bddf27cc68457ad0159779d73a9d574e519252 Mon Sep 17 00:00:00 2001 From: Karl Isenberg Date: Mon, 31 Jul 2023 12:38:42 -0700 Subject: [PATCH] fix: TestCRDDeleteBeforeRemoveCustomResourceV1 Wait for maagement conflict metric after manual change, with the current sync labels. --- e2e/testcases/custom_resources_test.go | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/e2e/testcases/custom_resources_test.go b/e2e/testcases/custom_resources_test.go index 8342a720a8..66c5de6075 100644 --- a/e2e/testcases/custom_resources_test.go +++ b/e2e/testcases/custom_resources_test.go @@ -218,6 +218,22 @@ func TestCRDDeleteBeforeRemoveCustomResourceV1(t *testing.T) { nt.T.Fatal(err) } + rootSyncLabels, err := nomostest.MetricLabelsForRootSync(nt, rootSyncNN) + if err != nil { + nt.T.Fatal(err) + } + + err = nomostest.ValidateMetrics(nt, + nomostest.ReconcilerErrorMetrics(nt, rootSyncLabels, firstCommitHash, metrics.ErrorSummary{ + // Remediator conflict after the first commit, because the declared + // Anvil was deleted by another client after successful sync. + // TODO: distinguish between management conflict (spec/generation drift) and concurrent status update conflict (resource version change) + Conflicts: 1, + })) + if err != nil { + nt.T.Fatal(err) + } + // Reset discovery client to invalidate the cached Anvil CRD nt.RenewClient() @@ -230,17 +246,12 @@ func TestCRDDeleteBeforeRemoveCustomResourceV1(t *testing.T) { nt.WaitForRootSyncSourceError(configsync.RootSyncName, status.UnknownKindErrorCode, "") - rootSyncLabels, err := nomostest.MetricLabelsForRootSync(nt, rootSyncNN) + rootSyncLabels, err = nomostest.MetricLabelsForRootSync(nt, rootSyncNN) if err != nil { nt.T.Fatal(err) } err = nomostest.ValidateMetrics(nt, - nomostest.ReconcilerErrorMetrics(nt, rootSyncLabels, firstCommitHash, metrics.ErrorSummary{ - // Remediator conflict after the first commit, because the declared - // Anvil was deleted by another client after successful sync. - Conflicts: 1, - }), nomostest.ReconcilerErrorMetrics(nt, rootSyncLabels, secondCommitHash, metrics.ErrorSummary{ // No remediator conflict after the second commit, because the // reconciler hasn't been updated with the latest declared resources,