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

Function TestEngine_Rebuild

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

Source from the content-addressed store, hash-verified

200}
201
202func TestEngine_Rebuild(t *testing.T) {
203 t.Parallel()
204 dir := t.TempDir()
205 createFile(t, dir, "original.txt", "data")
206
207 eng, ctx := newTestEngine(t)
208 require.NoError(t, eng.AddRoot(ctx, dir))
209
210 createFile(t, dir, "sneaky_rebuild.txt", "hidden")
211 require.NoError(t, eng.Rebuild(ctx, dir))
212
213 results, err := eng.Search(ctx, "sneaky_rebuild", filefinder.DefaultSearchOptions())
214 require.NoError(t, err)
215 requireResultHasPath(t, results, "sneaky_rebuild.txt")
216}
217
218// createFile creates a file (and parent dirs) at relPath under dir.
219func createFile(t *testing.T, dir, relPath, content string) {

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected