Skip to content

Commit

Permalink
tests: fix race condition in TestPathRunOnDemand
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Nov 7, 2023
1 parent 2a6060d commit 8723be8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/core/path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
})
}
Expand Down

0 comments on commit 8723be8

Please sign in to comment.