From ea7ea4445f1955f4da8840cf72d9e38894eb6567 Mon Sep 17 00:00:00 2001 From: Rebecca Mahany-Horton Date: Thu, 19 Dec 2024 12:45:42 -0500 Subject: [PATCH] Try actually opening file too --- pkg/osquery/runtime/osqueryinstance_windows_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/osquery/runtime/osqueryinstance_windows_test.go b/pkg/osquery/runtime/osqueryinstance_windows_test.go index 101d9f0b6..75c1f2330 100644 --- a/pkg/osquery/runtime/osqueryinstance_windows_test.go +++ b/pkg/osquery/runtime/osqueryinstance_windows_test.go @@ -4,6 +4,7 @@ package runtime import ( + "os" "strings" "syscall" "testing" @@ -89,4 +90,11 @@ func createLockFile(t *testing.T, fileToLock string) { uintptr(unsafe.Pointer(overlapped)), ) require.False(t, r1 == 0, error(e1)) + + fh, err := os.Open(fileToLock) + require.NoError(t, err) + + t.Cleanup(func() { + fh.Close() + }) }