Skip to content

Commit 3e5eb5d

Browse files
authored
acc: fix testserver workspace export envelope (#5649)
`GET /api/2.0/workspace/export` now returns a base64 `ExportResponse` for the SDK path (raw bytes still for `direct_download=true`), so `databricks workspace export` works locally. Lets `jobs/check-metadata` run against the fake. This pull request and its description were written by Isaac.
1 parent 0a78d21 commit 3e5eb5d

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

acceptance/bundle/resources/jobs/check-metadata/out.test.toml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

acceptance/bundle/resources/jobs/check-metadata/test.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Local = false
1+
Local = true
22
Cloud = true
33
RecordRequests = false
44

libs/testserver/handlers.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,20 @@ func AddDefaultHandlers(server *Server) {
9494

9595
server.Handle("GET", "/api/2.0/workspace/export", func(req Request) any {
9696
path := req.URL.Query().Get("path")
97-
return req.Workspace.WorkspaceExport(path)
97+
data := req.Workspace.WorkspaceExport(path)
98+
99+
// The filer reads the raw object body via ?direct_download=true, while
100+
// the SDK's Workspace.Export (used by `databricks workspace export`)
101+
// requests JSON and expects the base64-encoded content field.
102+
if req.URL.Query().Get("direct_download") == "true" {
103+
return data
104+
}
105+
106+
return Response{
107+
Body: workspace.ExportResponse{
108+
Content: base64.StdEncoding.EncodeToString(data),
109+
},
110+
}
98111
})
99112

100113
server.Handle("POST", "/api/2.0/workspace/delete", func(req Request) any {

0 commit comments

Comments
 (0)