mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
command: Clean up testInputResponseMap before failing on unused answers
If you don't, the unused answers will persist in the package-level var and bleed in to other tests.
This commit is contained in:
parent
60bc7aa05d
commit
171cdbbf93
@ -716,12 +716,15 @@ func testInputMap(t *testing.T, answers map[string]string) func() {
|
|||||||
|
|
||||||
// Return the cleanup
|
// Return the cleanup
|
||||||
return func() {
|
return func() {
|
||||||
if len(testInputResponseMap) > 0 {
|
var unusedAnswers = testInputResponseMap
|
||||||
t.Fatalf("expected no unused answers provided to command.testInputMap, got: %v", testInputResponseMap)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// First, clean up!
|
||||||
test = true
|
test = true
|
||||||
testInputResponseMap = nil
|
testInputResponseMap = nil
|
||||||
|
|
||||||
|
if len(unusedAnswers) > 0 {
|
||||||
|
t.Fatalf("expected no unused answers provided to command.testInputMap, got: %v", unusedAnswers)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user