Skip to content

Remove the hard-coded temp path fallback in BReg Postgres test env loading #1227

Description

@jeremi

load_postgres_env in crates/registry-breg/src/request_store.rs (around line 1206), and the equivalent duplicated helper in crates/registry-breg/tests/postgres_request_events.rs, crates/registry-breg/tests/postgres_request_upgrade_retention.rs, and crates/registry-breg/tests/postgres_request_activation.rs, fall back to reading /private/tmp/registry-cr-plain-gqgr39oa/test.env whenever BREG_TEST_DATABASE_URL is unset, silently sourcing BREG_TEST_DATABASE_URL from that fixed path if it exists.

Failure scenario: on a machine or CI runner where that exact temp path happens to exist (e.g. left over from an unrelated process, or an environment that reuses predictable temp directories), these Postgres tests silently pick up a stray BREG_TEST_DATABASE_URL instead of failing with a clear "environment variable not set" error, making test behavior depend on incidental filesystem state.

Suggested fix:

  • Remove the hard-coded fallback path and rely solely on the BREG_TEST_DATABASE_URL environment variable, letting the tests skip or fail clearly when it is unset.
  • If a local convenience file is still wanted, read a repo-relative, gitignored .env path documented in the crate README instead of an absolute machine-specific path.

Noticed while reviewing #1189; pre-existing, not merge-blocking.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:bregBReg ownership.bugSomething isn't workinggood first issueGood for newcomersrustRust implementation work.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions