all: avoid mutating global state in parallel tests (#3687)

The SetupSuiteTargetFilters globally mutates the function used for logic
inside the target handler service. This means that we could get
inconsistent logical behavior in certain tests that were run in parallel,
since the logic can change at runtime. Ensure tests that make use
of this function are never run in parallel with other tests.
This commit is contained in:
Johan Brandhorst-Satzkorn authored and GitHub committed 2023-09-07 11:52:00 -07:00
1 parent 4789c00177
commit f89515a19c
10 files changed
+13 -12

No files matched your search

@@ -412,6 +412,7 @@ func TestUpdateAfterKeyRotation(t *testing.T) {
Level: hclog.Trace,
})
// This prevents us from running tests in parallel.
tg.SetupSuiteTargetFilters(t)
tc := controller.NewTestController(t, &controller.TestControllerOpts{SchedulerRunJobInterval: 100 * time.Millisecond})