Skip to content

Fix test harness incompatibilities with rootless Docker (colima) - #1350

Closed
Pranav-error wants to merge 1 commit into
pgmoneta:mainfrom
Pranav-error:fix-colima-test-harness
Closed

Pranav-error wants to merge 1 commit into
pgmoneta:mainfrom
Pranav-error:fix-colima-test-harness

Conversation

@Pranav-error

Copy link
Copy Markdown
Collaborator

Fixes #1347.

Two independent fixes needed to get `test/check.sh` running under
colima, a common free alternative to Docker Desktop:

  1. sudo detection: `check.sh` and the three
    `postgresql{14,15,17}/Makefile`s decide whether to prefix `docker`
    with `sudo` purely from `id -u`. Under a rootless Docker context
    the socket is already reachable without sudo, and forcing it anyway
    just hangs on an interactive password prompt. Now also falls back
    to no-sudo when `docker info` already succeeds.

  2. GPG trust for the PGDG repo: the Dockerfile's `--nogpgcheck` on
    installing `pgdg-redhat-repo` only skips verification for that one
    package -- it doesn't import the key anywhere `dnf` later consults.
    Every subsequent `dnf` call against that repo then fails GPG
    verification, in layers: repo-metadata `repo_gpgcheck` first, then
    again after disabling that, then package-level `gpgcheck` once
    `repo_gpgcheck` is off (the actual PostgreSQL 17 packages are
    signed with a key that doesn't match the vendored
    `PGDG-RPM-GPG-KEY-RHEL` file). This disables both checks for the
    repo rather than trying to fix the underlying stale/mismatched key,
    which I'm not in a position to resolve myself -- flagged in the
    issue in case there's a preferred way to handle it (updated key
    file, different mirror, etc).

Verified by getting `test/check.sh -t test_cli_verify` to build and
run successfully end-to-end under colima on macOS/arm64 for the first
time (that test itself now passes, after #1348 and #1349).

…er (colima)

Two independent fixes needed to get test/check.sh working under
colima, a free Docker Desktop alternative:

1. check.sh and all three postgresql{14,15,17} Makefiles detected
   whether to prefix docker commands with sudo purely by checking
   `id -u`. Under a rootless Docker context the socket is already
   reachable without sudo, and forcing sudo anyway just blocks
   forever on an interactive password prompt in a non-interactive
   invocation. Now also check whether `docker info` already succeeds
   before falling back to sudo.

2. The postgresql17 Dockerfile's `--nogpgcheck` on installing the
   pgdg-redhat-repo RPM only skips verification for that one package;
   it does not import the key into any trust store dnf consults for
   later operations. Every subsequent dnf call against the
   pgdg-common/pgdg-rhel10 repos then fails GPG verification, in three
   layers as each is patched (repo_gpgcheck on `dnf -y upgrade`, then
   again on any later install, then package-level gpgcheck once
   repo_gpgcheck is disabled -- the actual PostgreSQL 17 RPMs are
   signed with a key that doesn't match what's in the vendored
   PGDG-RPM-GPG-KEY-RHEL file). Disables both checks for this repo via
   the dropped-in .repo file rather than solving the stale-key problem,
   since the key itself needs attention from someone who can verify
   what's current upstream.

Verified by getting test/check.sh -t test_cli_verify to build and run
successfully under colima on macOS/arm64 for the first time -- this
was blocking any Docker-based testing of PR pgmoneta#1316 before these fixes.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 4, 2026 10:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Pranav-error

Copy link
Copy Markdown
Collaborator Author

The `build-linux (clang, Debug, 14)` failure here is a hang, not a test failure or anything caused by this change: `test_pgmoneta_restore_full` passes at 10:57:38, then there's no further test output at all until GitHub's own job-level 45-minute timeout kills it at 11:28:11 (`The action 'Run Tests' has timed out after 45 minutes`).

This PR's diff can't be the cause -- in `ci` mode, `check.sh` calls `start_postgresql` (native PostgreSQL, no Docker), never `start_postgresql_container`, which is the only function this PR touches. The sudo-detection change and the Makefile/Dockerfile changes are both Docker-only code paths that CI's `ci` mode never executes.

@jesperpedersen

Copy link
Copy Markdown
Member

Rebased and merged.

Thanks for your contribution !

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.

test/check.sh Docker-based tests fail under colima (rootless Docker): bad sudo detection + GPG trust gaps in the postgresql17 Dockerfile

3 participants