-
Notifications
You must be signed in to change notification settings - Fork 41
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: pytest path cleanup and port management #2734
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one suggestion in a couple of places. I'll wait to merge #2732.
tests/test_dbt.py
Outdated
with tests.tools.env("GLAREDB_PORT", str(glaredb_connection.info.port)): | ||
with tests.tools.env("DBT_USER", glaredb_connection.info.user): | ||
res: dbtRunnerResult = dbtRunner().invoke( | ||
[ | ||
"run", | ||
"--project-dir", | ||
dbt_project_path, | ||
"--profiles-dir", | ||
dbt_project_path, | ||
"-m", | ||
model_name, | ||
] | ||
) | ||
|
||
assert res.success is True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nested with
block looks kind of gnarly. Maybe something like this instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh! amazing!
@@ -4,9 +4,9 @@ glaredb_dbt_test: | |||
dbname: default | |||
host: 127.0.0.1 | |||
pass: "" | |||
port: 5432 | |||
port: "{{ env_var('GLAREDB_PORT') | as_number }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a welcome improvement.
This contains two major changes:
we'll use either the release or the debug (in that order of
preference) build if they exist. If neither exists, 🤷, that seems
like a reasonable failure mode for integration tests. (Inspired by
pytests fail locally if
target/release
is not available #2730)randomly select an unused port, and use that (rather than the
default postgres port.) this means we can run tests in parallel (and
doing so halves the runtime on my laptop.) This had been on my list
for a while, but I hadn't yet been bothered by the runtime.
Closes #2730