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

Function isolateState

e2e/tui/setup_test.go:90–99  ·  view source on GitHub ↗

isolateState redirects docker-agent's data and config directories to a temp dir for the duration of the test so the TUI's persistent state (tab store, user settings) never touches the real home directory.

(t *testing.T)

Source from the content-addressed store, hash-verified

88// dir for the duration of the test so the TUI's persistent state (tab store,
89// user settings) never touches the real home directory.
90func isolateState(t *testing.T) {
91 t.Helper()
92 dir := t.TempDir()
93 paths.SetDataDir(filepath.Join(dir, "data"))
94 paths.SetConfigDir(filepath.Join(dir, "config"))
95 t.Cleanup(func() {
96 paths.SetDataDir("")
97 paths.SetConfigDir("")
98 })
99}
100
101// startReplayProxy starts a VCR proxy in replay-only mode against the cassette
102// named after the current test, and returns a RuntimeConfig pointed at it.

Callers 1

newTUIFunction · 0.85

Calls 3

SetDataDirFunction · 0.92
SetConfigDirFunction · 0.92
CleanupMethod · 0.65

Tested by

no test coverage detected