mirror of
https://github.com/opentofu/opentofu.git
synced 2026-05-28 04:15:54 -04:00
fix TestApply* and TestInit* on Windows (#3203)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
This commit is contained in:
parent
33deb12894
commit
4c2b1df36e
1 changed files with 9 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ import (
|
|||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
"testing"
|
||||
|
|
@ -940,6 +941,14 @@ func testCopyDir(t *testing.T, src, dst string) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
t.Cleanup(func() {
|
||||
// Trigger garbage collection to ensure that all open file handles are closed.
|
||||
// This prevents TempDir RemoveAll cleanup errors on Windows.
|
||||
if runtime.GOOS == "windows" {
|
||||
runtime.GC()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// normalizeJSON removes all insignificant whitespace from the given JSON buffer
|
||||
|
|
|
|||
Loading…
Reference in a new issue