Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Automatically stop server after test completion via T.Cleanup #25

Merged
merged 1 commit into from
Dec 15, 2021

Conversation

jlegrone
Copy link
Collaborator

What changed?

Test servers now are automatically shut down after the parent test case completes via T.Cleanup.

Why?

This reduces the boilerplate needed to set up and tear down test servers.

How did you test it?

Verified by logging in the cleanup function and running tests.

Potential risks

Folks might not want to tie test server lifecycle to a single Go test. In this case table tests or not passing the WithT option may be a better fit.

@jlegrone jlegrone force-pushed the jlegrone/test-cleanup branch from f785c95 to 5dab96f Compare December 15, 2021 16:34
@jlegrone jlegrone merged commit e9d2bf9 into main Dec 15, 2021
@jlegrone jlegrone deleted the jlegrone/test-cleanup branch December 15, 2021 16:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants