fix TestApply_plan_backup test on Windows by using garbage collection (#3320)

Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
This commit is contained in:
Diógenes Fernandes
2025-09-30 15:49:55 -03:00
committed by GitHub
parent bdcf1f5e6e
commit e5e9bcd163

View File

@@ -12,6 +12,7 @@ import (
"os"
"path/filepath"
"reflect"
"runtime"
"strings"
"sync"
"testing"
@@ -754,6 +755,10 @@ func TestApply_plan_backup(t *testing.T) {
// Should have a backup file
testStateRead(t, backupPath)
// Force a garbage collection to ensure the backup file is closed
// to avoid TempDir RemoveAll cleanup errors on Windows.
runtime.GC()
}
func TestApply_plan_noBackup(t *testing.T) {