Skip to content

Commit bfeb1da

Browse files
committed
fix chmod on macos
1 parent 4f788d9 commit bfeb1da

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

agent/agentcontainers/watcher/watcher_test.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,19 @@ func TestFSNotifyWatcher(t *testing.T) {
3939
require.NoError(t, err, "modify test file failed")
4040

4141
// Verify that we receive the event we want.
42-
event, err := wut.Next(ctx)
43-
require.NoError(t, err, "next event failed")
44-
45-
require.NotNil(t, event, "want non-nil event")
46-
require.True(t, event.Has(fsnotify.Write), "want write event", event.String())
47-
require.Equal(t, event.Name, testFile, "want event for test file")
42+
for {
43+
event, err := wut.Next(ctx)
44+
require.NoError(t, err, "next event failed")
45+
46+
require.NotNil(t, event, "want non-nil event")
47+
if event.Has(fsnotify.Chmod) && !event.Has(fsnotify.Write) {
48+
// Ignore plain chmod events.
49+
continue
50+
}
51+
require.Truef(t, event.Has(fsnotify.Write), "want write event: %s", event.String())
52+
require.Equal(t, event.Name, testFile, "want event for test file")
53+
break
54+
}
4855

4956
// Test removing the file from the watcher.
5057
err = wut.Remove(testFile)

0 commit comments

Comments
 (0)