(t *testing.T)
| 68 | } |
| 69 | |
| 70 | func 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 | |
| 93 | func TestEngine_IndexRemovesDeletedFile(t *testing.T) { |
| 94 | t.Parallel() |
nothing calls this directly
no test coverage detected