Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

spikecurtis
Copy link
Contributor

@spikecurtis spikecurtis commented Sep 12, 2025

Adds a new test database broker, that runs in a subprocess, to clone test databases.

relates to coder/internal#927

Moving to a subprocess allows us to still clean up the test databases if the main test process dies (panics, times out, or is killed). We communicate with the subprocess over dRPC over yamux over stdio. When the main test process dies, the stdin pipe is closed, which triggers the broker to clean up any databases it cloned that were not explicitly discarded.

Copy link
Contributor Author

spikecurtis commented Sep 12, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.


func NewClient() (client *Client, err error) {
client = &Client{
cmd: exec.Command("go", "run", "github.com/coder/coder/v2/cmd/dbtestbroker"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This breaks if you are outside the directory tree of the repo, but I think that's pretty rare.

Still, in the PR above this on the stack I had to move some code around in templatepull_test.go

@spikecurtis spikecurtis force-pushed the spike/internal-927-dbtestbroker branch 3 times, most recently from 0758e24 to a7e3c5d Compare September 12, 2025 11:51
@spikecurtis spikecurtis force-pushed the spike/internal-927-dbtestbroker branch from a7e3c5d to 9191ef7 Compare September 12, 2025 11:57
@spikecurtis spikecurtis marked this pull request as ready for review September 12, 2025 11:58
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.

1 participant