mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-03-20 22:01:25 -04:00
fix TestApply* and TestInit* on Windows (#3203)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
This commit is contained in:
committed by
GitHub
parent
33deb12894
commit
4c2b1df36e
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user