- Sort Score
- Result 10 results
- Languages All
Results 1 - 5 of 5 for NewFakeWatcher (0.59 sec)
-
pkg/filewatcher/fakefilewatcher.go
w.Unlock() if ok { ch <- err } } // NewFakeWatcher returns a function which creates a new fake watcher for unit // testing. This allows observe callers to inject events and errors per-watched // path. changedFunc() provides a callback notification when a new watch is added // or removed. Production code should use `NewWatcher()`. func NewFakeWatcher(changedFunc func(path string, added bool)) (NewFileWatcherFunc, *FakeWatcher) {
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Wed May 24 14:06:41 UTC 2023 - 3.6K bytes - Viewed (0) -
pkg/volume/flexvolume/fake_watcher.go
type fakeWatcher struct { watches []string // List of watches added by the prober, ordered from least recent to most recent. eventHandler utilfs.FSEventHandler } var _ utilfs.FSWatcher = &fakeWatcher{} func newFakeWatcher() *fakeWatcher { return &fakeWatcher{ watches: nil, } } func (w *fakeWatcher) Init(eventHandler utilfs.FSEventHandler, _ utilfs.FSErrorHandler) error { w.eventHandler = eventHandler return nil }
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Thu Sep 20 17:33:45 UTC 2018 - 1.4K bytes - Viewed (0) -
pkg/volume/flexvolume/probe_test.go
assert.NoError(t, err) } // Tests the behavior when no drivers exist in the plugin directory. func TestEmptyPluginDir(t *testing.T) { // Arrange fs := utilfs.NewTempFs() watcher := newFakeWatcher() prober := &flexVolumeProber{ pluginDir: pluginDir, watcher: watcher, fs: fs, factory: fakePluginFactory{}, } prober.Init() // Act events, err := prober.Probe()
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Tue Nov 28 11:14:00 UTC 2023 - 10.5K bytes - Viewed (0) -
pkg/filewatcher/fakefilewatcher_test.go
removedChan := make(chan string, 10) changed := func(path string, added bool) { if added { addedChan <- path } else { removedChan <- path } } newWatcher, fakeWatcher := NewFakeWatcher(changed) watcher := newWatcher() // verify Add()/Remove() for _, file := range []string{"foo", "bar", "baz"} { if err := watcher.Add(file); err != nil { t.Fatalf("Add() returned error: %v", err) }
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Wed May 24 14:06:41 UTC 2023 - 3.8K bytes - Viewed (0) -
pkg/volume/flexvolume/flexvolume_test.go
} } func GetDynamicPluginProberWithoutWatcher(pluginDir string, runner exec.Interface) volume.DynamicPluginProber { return &flexVolumeProber{ pluginDir: pluginDir, watcher: newFakeWatcher(), factory: pluginFactory{}, runner: runner, fs: &utilfs.DefaultFs{}, }
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Mon Aug 01 15:56:32 UTC 2022 - 6.8K bytes - Viewed (0)