terraform: fix crasher in TestProcessIgnoreChanges
Since this test case is using t.Run, it must be sure to pass the nested *testing.T over to the testDiffs function or else calls to t.Fatal will crash the whole test process, since they would otherwise be called on the wrong instance of *testing.T.
This commit is contained in:
parent
0dd7677d1f
commit
69d2fa0c15
|
@ -87,7 +87,7 @@ func TestProcessIgnoreChanges(t *testing.T) {
|
|||
var evalDiff *EvalDiff
|
||||
var instanceDiff *InstanceDiff
|
||||
|
||||
var testDiffs = func(ignoreChanges []string, newAttribute string) (*EvalDiff, *InstanceDiff) {
|
||||
var testDiffs = func(t *testing.T, ignoreChanges []string, newAttribute string) (*EvalDiff, *InstanceDiff) {
|
||||
ignoreChangesTravs := make([]hcl.Traversal, len(ignoreChanges))
|
||||
for i, s := range ignoreChanges {
|
||||
traversal, travDiags := hclsyntax.ParseTraversalAbs([]byte(s), "", hcl.Pos{Line: 1, Column: 1})
|
||||
|
@ -174,7 +174,7 @@ func TestProcessIgnoreChanges(t *testing.T) {
|
|||
},
|
||||
} {
|
||||
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
|
||||
evalDiff, instanceDiff = testDiffs(tc.ignore, tc.newAttr)
|
||||
evalDiff, instanceDiff = testDiffs(t, tc.ignore, tc.newAttr)
|
||||
err := evalDiff.processIgnoreChanges(instanceDiff)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
|
|
Loading…
Reference in New Issue