-
Notifications
You must be signed in to change notification settings - Fork 81
Add support for recording requests in integration acceptance tests #2720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…sting of the feature itself
# In unix: "raw_body": "hello, world\n" | ||
# In windows: "raw_body": "hello, world\r\n" | ||
# In order to prevent that difference, hello.txt does not have a trailing newline. | ||
acceptance/selftest/record_cloud/volume-io/hello.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried out [[Repls]], but they did not seem to work. I could not reproduce this locally on Windows, and it only seems to happen in the Windows CI runner.
I've already spent 1-2 hours trying to fix / patch this, so the easiest thing to do at this point is to ignore the lint rule.
I'm not sure we want to normalize in the raw_body since it is a part of the HTTP payload.
workspaceClient := internal.PrepareServerAndClient(t, config, LogRequests, tmpDir) | ||
|
||
// Configure resolved credentials in the environment. | ||
cmd.Env = append(cmd.Env, "DATABRICKS_HOST="+workspaceClient.Config.Host) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no longer necessary since we use auth.ProcessEnv
Changes
This PR adds support for recording API calls made during an integration acceptance test by setting
RecordRequests = true
in the test.toml file.In order to do so, this PR introduces a new
Server
interface to decouple the logic recording the API requests/responses from the server implementation itself.The original test server struct is renamed to
LocalServer
.This PR adds a new struct
ProxyServer
which is a server that sits in between a client and a real Databricks workspace. Having a server in between allows us to record requests as they are sent to a real Databricks workspace in our integration tests.Why
Other than being a useful feature in itself, this also unlocks migration away from Terraform in DABs since we can now record the API requests made by Terraform and ensure that our custom library makes the same API requests in all cases.
Tests
A bunch of new acceptance tests for the new feature.