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

chore(dev): prevent tests from running if a command fails to run #1825

Conversation

matthieusieben
Copy link
Contributor

@matthieusieben matthieusieben commented Nov 6, 2023

Running tests (make test) without docker installed result in the script silently failing to start docker, followed by a lot of failing tests (because no database is available). This change makes it more obvious that docker should be installed for the tests to run.

This also allows to run tests (and the dev env) without actually needing docker, provided that a Postgres URI is provided. The tests relying heavily on timing of operations, being able to run them in a non virtualized environment (esp. from MacOS), makes their execution much more reliable and fast.

Testing packages/pds alone

With Docker (notice the 2.5Gb of RAM used by the VM):
Capture d’écran 2023-11-07 à 12 54 03
The failing test is due to a race condition (they do run successfully from time to time).

Without Docker (pg & redis installed on the host):
Capture d’écran 2023-11-07 à 12 46 20

@matthieusieben matthieusieben changed the title chore(dev): prevent tests from running if docker is not installed chore(dev): prevent tests from running if a command fails to run Nov 6, 2023
Copy link
Collaborator

@devinivy devinivy left a comment

Choose a reason for hiding this comment

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

Looks great to me. @dholms if you don't mind taking a peek at this one, I think it'd be worthwhile to get another set of eyes.

@devinivy devinivy requested a review from dholms December 1, 2023 16:22
@matthieusieben matthieusieben force-pushed the chore-dev-infra-exit-on-error branch from 56cc85e to 93513ee Compare December 5, 2023 10:47
@matthieusieben
Copy link
Contributor Author

Capture d’écran 2023-12-05 à 11 57 48

Running tests without docker requires that environment variables DB_TEST_POSTGRES_URL and REDIS_TEST_HOST are set.

@matthieusieben matthieusieben force-pushed the chore-dev-infra-exit-on-error branch 3 times, most recently from b0719a2 to 7bf96c5 Compare February 5, 2024 11:43
@matthieusieben matthieusieben force-pushed the chore-dev-infra-exit-on-error branch from 7bf96c5 to f18e763 Compare February 6, 2024 14:58
@matthieusieben matthieusieben merged commit 96ba62a into bluesky-social:main May 2, 2024
10 checks passed
@matthieusieben matthieusieben deleted the chore-dev-infra-exit-on-error branch May 2, 2024 18:39
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.

2 participants