Skip to content
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

Always close test HTTP server during cleanup #2261

Merged
merged 6 commits into from
Jan 29, 2025

Conversation

shreyas-goenka
Copy link
Contributor

@shreyas-goenka shreyas-goenka commented Jan 29, 2025

Changes

This PR registers the server.Close() function to be run during test cleanup in the server initialization function. This ensures that all test servers are closed as soon as the test they are scoped to finish.

Motivated by https://github.com/databricks/cli/pull/2255/files where a regression was introduced where we did not close the test server.

Tests

N/A

Copy link
Contributor

@pietern pietern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diff doesn't match the description.

@@ -109,6 +109,8 @@ func testAccept(t *testing.T, InprocessMode bool, singleTest string) int {

if cloudEnv == "" {
server := testserver.New(t)
t.Cleanup(server.Close)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call Close from testserver.New() instead? Then it is impossible to use wrong.

@shreyas-goenka shreyas-goenka changed the title Close acceptance test server on test cleanup Always close test HTTP server during cleanup Jan 29, 2025
@shreyas-goenka shreyas-goenka added this pull request to the merge queue Jan 29, 2025
Merged via the queue into main with commit 55c03cc Jan 29, 2025
9 checks passed
@shreyas-goenka shreyas-goenka deleted the fix-regress-server-close branch January 29, 2025 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants