Skip to content

Commit 21214fe

Browse files
denikclaude
andauthored
acc: Fix -logrequests on cloud when RecordRequests is false (#4500)
Previously, the proxy server was only started on cloud when RecordRequests was true, so -logrequests had no server to intercept requests through. Now start the proxy when either flag is set, and make request recording conditional inside startProxyServer. Co-authored-by: Claude Opus 4.6 <[email protected]>
1 parent 3d8db90 commit 21214fe

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

acceptance/internal/prepare_server.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ func PrepareServerAndClient(t *testing.T, config TestConfig, logRequests bool, o
9191

9292
cfg := w.Config
9393

94-
// If we are running in a cloud environment AND we are recording requests,
95-
// start a dedicated server to act as a reverse proxy to a real Databricks workspace.
96-
if recordRequests {
97-
host := startProxyServer(t, logRequests, config.IncludeRequestHeaders, outputDir)
94+
// If we are running in a cloud environment AND we need to intercept requests
95+
// (for recording or logging), start a proxy server.
96+
if recordRequests || logRequests {
97+
host := startProxyServer(t, recordRequests, logRequests, config.IncludeRequestHeaders, outputDir)
9898
cfg = &sdkconfig.Config{
9999
Host: host,
100100
Token: token,
@@ -272,14 +272,17 @@ func killCaller(t *testing.T, pattern string, headers http.Header) {
272272
}
273273

274274
func startProxyServer(t *testing.T,
275+
recordRequests bool,
275276
logRequests bool,
276277
includeHeaders []string,
277278
outputDir string,
278279
) string {
279280
s := testproxy.New(t)
280281

281-
// Always record requests for a proxy server.
282-
s.RequestCallback = recordRequestsCallback(t, includeHeaders, outputDir)
282+
// Record API requests in out.requests.txt if RecordRequests is true in test.toml.
283+
if recordRequests {
284+
s.RequestCallback = recordRequestsCallback(t, includeHeaders, outputDir)
285+
}
283286

284287
// Log API responses if the -logrequests flag is set.
285288
if logRequests {

0 commit comments

Comments
 (0)