MCPcopy Index your code
hub / github.com/coder/coder / TestEngine_IndexPicksUpNewFile

Function TestEngine_IndexPicksUpNewFile

agent/filefinder/engine_test.go:70–91  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

68}
69
70func TestEngine_IndexPicksUpNewFile(t *testing.T) {
71 t.Parallel()
72 dir := t.TempDir()
73 createFile(t, dir, "existing.txt", "hello")
74
75 eng, ctx := newTestEngine(t)
76 require.NoError(t, eng.AddRoot(ctx, dir))
77 createFile(t, dir, "newfile_unique.txt", "world")
78
79 require.Eventually(t, func() bool {
80 results, sErr := eng.Search(ctx, "newfile_unique", filefinder.DefaultSearchOptions())
81 if sErr != nil {
82 return false
83 }
84 for _, r := range results {
85 if r.Path == "newfile_unique.txt" {
86 return true
87 }
88 }
89 return false
90 }, testutil.WaitShort, testutil.IntervalFast, "expected newfile_unique.txt to appear via watcher")
91}
92
93func TestEngine_IndexRemovesDeletedFile(t *testing.T) {
94 t.Parallel()

Callers

nothing calls this directly

Calls 6

DefaultSearchOptionsFunction · 0.92
newTestEngineFunction · 0.85
AddRootMethod · 0.80
SearchMethod · 0.80
createFileFunction · 0.70
TempDirMethod · 0.65

Tested by

no test coverage detected