Skip to content

Commit 670ac6c

Browse files
committed
test: Make test tolerant of warnings in the returned diagnostics
Prior to this change the strings.Contains assertion was only receiving a string representing the warning, and the error diagnostic was no longer being asserted against.
1 parent a9f23ea commit 670ac6c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

internal/configs/module_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,12 @@ func TestModule_conflicting_backend_cloud_stateStore(t *testing.T) {
551551
t.Fatal("module should have error diags, but does not")
552552
}
553553

554-
if got := diags.Error(); !strings.Contains(got, tc.wantMsg) {
554+
if tc.allowExperiments {
555+
if len(diags) != 2 && len(diags.Errs()) != 1 {
556+
t.Fatalf("expected 2 diagnostics (1 error, 1 warning), but got: %#v", diags)
557+
}
558+
}
559+
if got := diags.Errs()[0]; !strings.Contains(got.Error(), tc.wantMsg) {
555560
t.Fatalf("expected error to contain %q\nerror was:\n%s", tc.wantMsg, got)
556561
}
557562
})

0 commit comments

Comments
 (0)