- Notifications
You must be signed in to change notification settings - Fork1k
chore(agent/agentcontainers): skip part of test if ondarwin
#19081
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -4,6 +4,7 @@ import ( | ||
"context" | ||
"os" | ||
"path/filepath" | ||
"runtime" | ||
"testing" | ||
"github.com/fsnotify/fsnotify" | ||
@@ -88,24 +89,34 @@ func TestFSNotifyWatcher(t *testing.T) { | ||
break | ||
} | ||
// TODO(DanielleMaywood): | ||
// Unfortunately it appears this atomic-rename phase of the test is flakey on macOS. | ||
// | ||
// This test flake could be indicative of an issue that may present itself | ||
// in a running environment. Fortunately, we only use this (as of 2025-07-29) | ||
// for our dev container integration. We do not expect the host workspace | ||
// (where this is used), to ever be run on macOS, as containers are a linux | ||
// paradigm. | ||
if runtime.GOOS != "darwin" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. nit: maybe fail-fast approach? ifruntime.GOOS=="darwin" {err=wut.Remove(testFile)require.NoError(t,err,"remove file from watcher failed")return} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Apologies, I hit the green button a little quick. I can see the benefit to the suggestion, although I think I prefer indenting the flakey code instead as this isn't a permanent change. | ||
err = os.WriteFile(testFile+".atomic", []byte(`{"test": "atomic"}`), 0o600) | ||
require.NoError(t, err, "write new atomic test file failed") | ||
err = os.Rename(testFile+".atomic", testFile) | ||
require.NoError(t, err, "rename atomic test file failed") | ||
// Verify that we receive the event we want. | ||
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.Create) { | ||
t.Logf("Ignoring event: %s", event) | ||
continue | ||
} | ||
require.Truef(t, event.Has(fsnotify.Create), "want create event: %s", event.String()) | ||
require.Equal(t, event.Name, testFile, "want event for test file") | ||
break | ||
} | ||
} | ||
// Test removing the file from the watcher. | ||
Uh oh!
There was an error while loading.Please reload this page.