Skip to content

Fix socket leak, clean up single use postgres databases #2413

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

Merged
merged 3 commits into from
Jun 16, 2022

Conversation

spikecurtis
Copy link
Contributor

First PR for #2347

This fixes up a socket leak in our use of Migrate.

It also introduces cleanup of single-use databases in postgres, since the postgres container outlives the test run, if we don't clean up these databases the container will continue to grow in size until it is restarted.

Lastly, this extends the timeout for postgres tests to 30 minutes. I'm seeing several minutes on my machine, and we don't want to set this aspirationally---it's a backstop for when things are going really wrong. It removes the limit of 1 parallel test per package, on the theory that the socket leak was actually the source of our CI problems. We can add parallel limits back in if the CI buckles under this pressure.

@spikecurtis spikecurtis requested a review from a team June 16, 2022 15:27
@@ -36,8 +46,19 @@ func migrateSetup(db *sql.DB) (source.Driver, *migrate.Migrate, error) {
}

// MigrateUp runs SQL migrations to ensure the database schema is up-to-date.
func MigrateUp(db *sql.DB) error {
func MigrateUp(db *sql.DB) (retErr error) {
Copy link
Member

Choose a reason for hiding this comment

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

Tip (non-blocking): It would be OK to call this err, at the time defer func runs, the value of err would be that of the return statement.

Signed-off-by: Spike Curtis <spike@coder.com>
@spikecurtis spikecurtis merged commit a82c0eb into main Jun 16, 2022
@spikecurtis spikecurtis deleted the spike/2347_postgres_flakes branch June 16, 2022 16:01
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.

4 participants