From f24bf035a34a3aa7b77e4b9214bafd91e251b2bc Mon Sep 17 00:00:00 2001 From: Lance Bragstad Date: Fri, 3 Oct 2025 11:49:55 -0500 Subject: [PATCH] Use t.Error instead of t.Fatal for assertion checking The tests will fail if there are any discrepancies between the expected cluster state and the observed state. Using t.Fataf() or t.Fatal marks the test as failed, which is what we want, but it also stop execution of the test. Since we have some helper methods that process the mismatched results to generate assertion files and reports, we don't want to completely stop execution so that we can still produce those files. This commit updates those specific parts of the tests to use Error instead of Fatal so we perserve the behavior to mark the test as failed, but continue processing in the test to cleanup and generate reports. --- e2e_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/e2e_test.go b/e2e_test.go index c19f9f75..06fb79bd 100644 --- a/e2e_test.go +++ b/e2e_test.go @@ -169,7 +169,7 @@ func TestPlatformCompliance(t *testing.T) { if err = helpers.GenerateMismatchReport(tc, c, mismatchedAssertions, platformBindingName); err != nil { t.Fatalf("Failed to generate test report: %s", err) } - t.Fatal("Actual cluster compliance state didn't match expected state") + t.Error("Actual cluster compliance state didn't match expected state") } err = helpers.GenerateAssertionFileFromResults(tc, c, assertionFileName, initialResults, finalResults) @@ -282,7 +282,7 @@ func TestNodeCompliance(t *testing.T) { if err = helpers.GenerateMismatchReport(tc, c, mismatchedAssertions, nodeBindingName); err != nil { t.Fatalf("Failed to generate test report: %s", err) } - t.Fatal("Actual cluster compliance state didn't match expected state") + t.Error("Actual cluster compliance state didn't match expected state") } err = helpers.GenerateAssertionFileFromResults(tc, c, assertionFileName, initialResults, finalResults) @@ -352,7 +352,7 @@ func TestProfile(t *testing.T) { if err = helpers.GenerateMismatchReport(tc, c, mismatchedAssertions, bindingName); err != nil { t.Fatalf("Failed to generate test report: %s", err) } - t.Fatal("Actual cluster compliance state didn't match expected state") + t.Error("Actual cluster compliance state didn't match expected state") } err = helpers.GenerateAssertionFileFromResults(tc, c, assertionFileName, initialResults, nil) @@ -477,7 +477,7 @@ func TestProfileRemediations(t *testing.T) { if err = helpers.GenerateMismatchReport(tc, c, mismatchedAssertions, bindingName); err != nil { t.Fatalf("Failed to generate test report: %s", err) } - t.Fatal("Actual cluster compliance state didn't match expected state") + t.Error("Actual cluster compliance state didn't match expected state") } err = helpers.GenerateAssertionFileFromResults(tc, c, assertionFileName, initialResults, finalResults)