Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
DanielleMaywood merged 2 commits intomainfromdanielle/stop-flake-fsnotify
Jul 29, 2025
Merged
Changes fromall commits
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
45 changes: 28 additions & 17 deletionsagent/agentcontainers/watcher/watcher_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@ import (
"context"
"os"
"path/filepath"
"runtime"
"testing"

"github.com/fsnotify/fsnotify"
Expand DownExpand Up@@ -88,24 +89,34 @@ func TestFSNotifyWatcher(t *testing.T) {
break
}

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
// 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" {
Copy link
Member

Choose a reason for hiding this comment

The 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}

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The 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
}
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.
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp