fix: DirFromModule related tests on Windows (#3289)

Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
This commit is contained in:
Diógenes Fernandes
2025-09-20 15:51:29 -03:00
committed by GitHub
parent aa403e5f99
commit 767dd7a2fa
2 changed files with 13 additions and 1 deletions

5
go.mod
View File

@@ -3,7 +3,10 @@ module github.com/opentofu/opentofu
// At the time of adding this configuration, the new Go feature introduced here https://github.com/golang/go/issues/67061,
// was having a good amount of issues linked to, affecting AWS Firewall, GCP various services and a lot more.
// In go1.23 the godebug flag for this was named 'tlskyber', renamed in go1.24 to 'tlsmlkem'. https://tip.golang.org/doc/godebug#go-124
godebug tlsmlkem=0
godebug (
tlsmlkem=0
winsymlink=0 // See https://github.com/opentofu/opentofu/pull/3289
)
require (
cloud.google.com/go/kms v1.15.5

View File

@@ -13,6 +13,7 @@ import (
"log"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
"time"
@@ -118,6 +119,14 @@ func TestInit_fromModule_cwdDest(t *testing.T) {
func TestInit_fromModule_dstInSrc(t *testing.T) {
dir := t.TempDir()
t.Chdir(dir)
defer 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()
}
}()
if err := os.Mkdir("foo", os.ModePerm); err != nil {
t.Fatal(err)
}