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

Function startReplayProxy

e2e/tui/setup_test.go:104–128  ·  view source on GitHub ↗

startReplayProxy starts a VCR proxy in replay-only mode against the cassette named after the current test, and returns a RuntimeConfig pointed at it. Recordings live in testdata/cassettes/ .yaml.

(t *testing.T)

Source from the content-addressed store, hash-verified

102// named after the current test, and returns a RuntimeConfig pointed at it.
103// Recordings live in testdata/cassettes/<TestName>.yaml.
104func startReplayProxy(t *testing.T) *config.RuntimeConfig {
105 t.Helper()
106
107 cassettePath := filepath.Join("testdata", "cassettes", t.Name())
108
109 matcher := fake.DefaultMatcher(func(err error) { require.NoError(t, err) })
110
111 proxyURL, cleanup, err := fake.StartProxyWithOptions(
112 t.Context(),
113 cassettePath,
114 recorder.ModeReplayOnly,
115 matcher,
116 func(string, *http.Request) {}, // no API keys needed for replay
117 nil,
118 )
119 require.NoError(t, err)
120 t.Cleanup(func() { require.NoError(t, cleanup()) })
121
122 return &config.RuntimeConfig{
123 Config: config.Config{ModelsGateway: proxyURL},
124 EnvProviderForTests: &mapEnvProvider{
125 environment.DockerDesktopTokenEnv: "DUMMY",
126 },
127 }
128}
129
130// mapEnvProvider is a static environment.Provider for tests.
131type mapEnvProvider map[string]string

Callers 1

newTUIFunction · 0.85

Calls 5

DefaultMatcherFunction · 0.92
StartProxyWithOptionsFunction · 0.92
ContextMethod · 0.80
NameMethod · 0.65
CleanupMethod · 0.65

Tested by

no test coverage detected