mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-12 09:01:58 -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 func() {
|
||||
if len(testInputResponseMap) > 0 {
|
||||
t.Fatalf("expected no unused answers provided to command.testInputMap, got: %v", testInputResponseMap)
|
||||
}
|
||||
var unusedAnswers = testInputResponseMap
|
||||
|
||||
// First, clean up!
|
||||
test = true
|
||||
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