Check sync error in unit test properly

Tests must fail when syncContent() returns success and error was expected.
This commit is contained in:
Jan Safranek
2023-11-10 12:20:03 +01:00
parent 36c3f6d7d7
commit f9e125b994
3 changed files with 15 additions and 0 deletions

View File

@@ -808,6 +808,9 @@ func runSyncContentTests(t *testing.T, tests []controllerTest, snapshotClasses [
if test.expectSuccess && err != nil {
t.Errorf("Test %q failed: %v", test.name, err)
}
if !test.expectSuccess && err == nil {
t.Errorf("Test %q failed: expected error, got nil", test.name)
}
// Wait for the target state
err = reactor.waitTest(test)