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

shell completion tests fail with EmptyHost #4419

Open
thkoch2001 opened this issue Jan 4, 2025 · 1 comment
Open

shell completion tests fail with EmptyHost #4419

thkoch2001 opened this issue Jan 4, 2025 · 1 comment

Comments

@thkoch2001
Copy link
Contributor

Setup

My .env:

PG_DATABASE_URL=postgresql://thk@/diesel_test?host=/var/run/postgresql
PG_EXAMPLE_DATABASE_URL=postgresql://thk@/diesel_example?host=/var/run/postgresql

Versions

  • Diesel: master branch on January 4th 2024, commit id: 977a2b0

Problem Description

I ran cargo xtask run-tests --no-doc-tests postgres and all 3 tests in diesel_cli::tests completion_generation failed at

diesel_cli/tests/support/project_builder.rs:111:51:
called `Result::unwrap()` on an `Err` value: EmptyHost

Cause

line 111 is:

    let mut db_url = url::Url::parse(&var_os).unwrap();

The url crate is used to parse a postgres connection url and I specified the host as a parameter.

I can just changed my .env to:

PG_DATABASE_URL=postgresql://thk@%2Fvar%2Frun%2Fpostgresql/diesel_test
PG_EXAMPLE_DATABASE_URL=postgresql://thk@%2Fvar%2Frun%2Fpostgresql/diesel_example

And now the shell completion tests worked.

Proposal

Either fix the test code or add a comment in .env.sample about this issue.

@weiznich
Copy link
Member

weiznich commented Jan 7, 2025

Thanks for reporting. Given that the the relevant line is only calling the URL crate and that seems not to be able to handle this specific URL format it seems to be easier to put a comment about this into the .env.sample file. It would be great to receive a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants