MCPcopy Index your code
hub / github.com/docker/docker-agent / TestSetRoot

Function TestSetRoot

pkg/paths/paths_test.go:52–69  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestSetRoot(t *testing.T) {
53 t.Cleanup(func() { paths.SetRoot("") })
54
55 defaultData := paths.GetDataDir()
56 defaultConfig := paths.GetConfigDir()
57 defaultCache := paths.GetCacheDir()
58
59 paths.SetRoot("/custom/root")
60 assert.Equal(t, filepath.Clean("/custom/root/data"), paths.GetDataDir())
61 assert.Equal(t, filepath.Clean("/custom/root/config"), paths.GetConfigDir())
62 assert.Equal(t, filepath.Clean("/custom/root/cache"), paths.GetCacheDir())
63
64 // Empty root restores the defaults.
65 paths.SetRoot("")
66 assert.Equal(t, defaultData, paths.GetDataDir())
67 assert.Equal(t, defaultConfig, paths.GetConfigDir())
68 assert.Equal(t, defaultCache, paths.GetCacheDir())
69}

Callers

nothing calls this directly

Calls 5

SetRootFunction · 0.92
GetDataDirFunction · 0.92
GetConfigDirFunction · 0.92
GetCacheDirFunction · 0.92
CleanupMethod · 0.65

Tested by

no test coverage detected