Skip to content

Commit

Permalink
tests: fix race condition in TestPathRunOnDemand (#2663)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 authored Nov 8, 2023
1 parent 4bf0d10 commit f82c6e3
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 f82c6e3

Please sign in to comment.