Skip to content

[Ppstgresql-embedded] Custom binary URL not supported #130

@veigajoao

Description

@veigajoao

I am using the library to set up tests in a private project. The nature of the project requires us to not depend on bonary downlaods from external sources.

To fix the issue I forked the postgresql_binaries repo and used it as the source in the bundled version:

cargo.toml:

postgresql_embedded = { version = "0.16.1", features = ["bundled"] }
async fn new_mock_db(db_port: u16) -> Result<PostgreSQL, Error> {
        let mut postgresql = PostgreSQL::new(Settings {
            username: PG_USER.to_string(),
            password: PG_PASSWORD.to_string(),
            host: PG_HOST.to_string(),
            port: db_port,
            temporary: true,
            timeout: Some(std::time::Duration::from_secs(5)),
            releases_url: BINARY_RELEASE_URL.to_string(),
            ..Settings::default()
        });
        postgresql.setup().await?;
        postgresql.start().await?;
        tracing::debug!("Database created");

        Ok(postgresql)
    }

And then run tests using the POSTGRESQL_RELEASES_URL environment variable

POSTGRESQL_RELEASES_URL=https://github.com/my_repo cargo nextest run

I then get the following build error:

error: failed to run custom build command for `postgresql_embedded v0.16.1`

Caused by:
  process didn't exit successfully: `/home/jasso/projects/dave/target/debug/build/postgresql_embedded-c55d909f543c1350/build-script-build` (exit status: 1)
  --- stdout
  PostgreSQL releases URL: https://github.com/2571-project/postgresql-binaries
  PostgreSQL version: *
  Target: x86_64-unknown-linux-gnu
  OUT_DIR: "/home/jasso/projects/dave/target/debug/build/postgresql_embedded-960de399e93312a9/out"

  --- stderr
  Error: unsupported repository for 'https://github.com/2571-project/postgresql-binaries'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions