From f82c6e36544556d178b68f3c8e886288c9cee3a2 Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Wed, 8 Nov 2023 11:21:08 +0100 Subject: [PATCH] tests: fix race condition in TestPathRunOnDemand (#2663) --- internal/core/path_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/core/path_test.go b/internal/core/path_test.go index 4c3678f0..ae1d4fb4 100644 --- a/internal/core/path_test.go +++ b/internal/core/path_test.go @@ -84,7 +84,7 @@ func main() { func TestPathRunOnDemand(t *testing.T) { onDemandFile := filepath.Join(os.TempDir(), "ondemand") - onUnDemandFile := filepath.Join(os.TempDir(), "ondisconnect") + onUnDemandFile := filepath.Join(os.TempDir(), "onundemand") srcFile := filepath.Join(os.TempDir(), "ondemand.go") err := os.WriteFile(srcFile, @@ -182,14 +182,14 @@ func TestPathRunOnDemand(t *testing.T) { }() for { - _, err := os.Stat(onDemandFile) + _, err := os.Stat(onUnDemandFile) if err == nil { break } time.Sleep(100 * time.Millisecond) } - _, err := os.Stat(onUnDemandFile) + _, err := os.Stat(onDemandFile) require.NoError(t, err) }) }