Skip to content

fix(coderd/database): remove linux build tags from db package #16633

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 2 commits into from
Feb 25, 2025

Conversation

evgeniy-scherbina
Copy link
Contributor

@evgeniy-scherbina evgeniy-scherbina commented Feb 19, 2025

@Emyrk
Remove linux build tags from database package to make sure we can run tests on Mac OS.

@evgeniy-scherbina evgeniy-scherbina marked this pull request as ready for review February 19, 2025 21:05
@evgeniy-scherbina evgeniy-scherbina changed the title build(database): remove linux build tags from db package refactor(coderd/database): remove linux build tags from db package Feb 19, 2025
@Emyrk
Copy link
Member

Emyrk commented Feb 19, 2025

@hugodutka

@evgeniy-scherbina ran into this. Basically he is running on a mac, and unable to run these tests locally. However it seems docker does not exist in our CI to run postgres?? I figured this might be resolved somehow to run the other PG tests. Do you have any recommendations to allow these tests to be run locally?

I'm ok if these tests are still skipped on mac CI, we just want them to being able to be run locally on Mac.

@hugodutka
Copy link
Contributor

@Emyrk @evgeniy-scherbina These tests are failing because they are running as part of the in-mem test suite (test-go rather than test-go-pg). GitHub runners for macOS and Windows can't run Docker, since it requires Linux running in a VM, these runners are VMs themselves, and they don't support nested virtualization.

For a fix, I'd modify each failing test to include

if !dbtestutil.WillUsePostgres() {
	t.Skip("this test requires postgres")
}

And run the tests locally with DB=ci gotestsum ...

The tests do pass in CI in the PG suite because we use embedded postgres to set up the db before running them.

As a sidenote, we recently switched our macOS runners to run on depot, which uses physical hardware AFAIK, so we could set up Docker there eventually.

@hugodutka
Copy link
Contributor

And one more thing - there's one test that has a hard dependency on Docker:

connectionURL, closePg, err := dbtestutil.OpenContainerized(t, dbtestutil.DBContainerOptions{Port: disconnectTestPort})

I'd skip it conditionally based on whether Docker is available.

@evgeniy-scherbina evgeniy-scherbina changed the title refactor(coderd/database): remove linux build tags from db package fix(coderd/database): remove linux build tags from db package Feb 25, 2025
@evgeniy-scherbina
Copy link
Contributor Author

evgeniy-scherbina commented Feb 25, 2025

@Emyrk @hugodutka fixed CI, could you pls. review it?

NOTE: I only removed linux build tags, I didn't touch pubsub_linux_test.go or other tests with linux_test.go suffix.

Copy link
Member

@Emyrk Emyrk left a comment

Choose a reason for hiding this comment

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

LG 👍

@evgeniy-scherbina evgeniy-scherbina merged commit 98dfc70 into main Feb 25, 2025
32 checks passed
@evgeniy-scherbina evgeniy-scherbina deleted the remove-linux-build-tags branch February 25, 2025 16:39
@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 2025
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.

3 participants