Skip to content

feat(agent/agentcontainers): add file watcher and dirty status #17573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Apr 29, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix chmod on macos
  • Loading branch information
mafredri committed Apr 28, 2025
commit bfeb1da6c01a2e231638714ca42707850f0cedfe
19 changes: 13 additions & 6 deletions agent/agentcontainers/watcher/watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,19 @@ func TestFSNotifyWatcher(t *testing.T) {
require.NoError(t, err, "modify test file failed")

// Verify that we receive the event we want.
event, err := wut.Next(ctx)
require.NoError(t, err, "next event failed")

require.NotNil(t, event, "want non-nil event")
require.True(t, event.Has(fsnotify.Write), "want write event", event.String())
require.Equal(t, event.Name, testFile, "want event for test file")
for {
event, err := wut.Next(ctx)
require.NoError(t, err, "next event failed")

require.NotNil(t, event, "want non-nil event")
if event.Has(fsnotify.Chmod) && !event.Has(fsnotify.Write) {
// Ignore plain chmod events.
continue
}
require.Truef(t, event.Has(fsnotify.Write), "want write event: %s", event.String())
require.Equal(t, event.Name, testFile, "want event for test file")
break
}

// Test removing the file from the watcher.
err = wut.Remove(testFile)
Expand Down
Loading