test: fix azure-arc-onboarding unit test flakiness
Declaring the component config outside made the azure-arc-onboarding
component's unit tests flaky.
This commit fixes the flakiness.
@@ -26,8 +26,6 @@ import (
func TestConfig(t *testing.T) { //nolint:funlen
t.Parallel()
- c := azurearconboarding.NewConfig()
-
tests := []struct {
desc string
config string
@@ -154,6 +152,8 @@ component azure-arc-onboarding {
t.Fatalf("Error getting component body: %v", diagnostics)
}
+ c := azurearconboarding.NewConfig()
+
diagnostics = c.LoadConfig(body, &hcl.EvalContext{})
if test.wantErr && !diagnostics.HasErrors() {
t.Errorf(" Failed: expected error got none")
