Skip to content

Make proxy script tests portable - #1189

Open
cpuguy83 wants to merge 1 commit into
project-dalec:mainfrom
cpuguy83:fix-portable-proxy-tests
Open

cpuguy83 wants to merge 1 commit into
project-dalec:mainfrom
cpuguy83:fix-portable-proxy-tests

Conversation

@cpuguy83

Copy link
Copy Markdown
Collaborator

Proxy config tests hardcoded child PATH=/bin:/usr/bin and invoked bash via /bin/bash. Ubuntu-based CI happened to have those tools at those paths, but the tests failed on NixOS and other distros where core utilities live elsewhere.

This changes the child process PATH to inherit the test runner's PATH and resolves bash via PATH instead of assuming /bin/bash. /bin/sh is left unchanged since it's a stable, portable path. Proxy env var isolation (the child process only gets an explicit env list) is preserved.

Testing:

  • go test --test.short --timeout=10m ./...
  • go run ./cmd/lint ./...

Proxy config tests hardcoded PATH=/bin:/usr/bin for the child shell,
which fails on distros like NixOS where core utilities live elsewhere.
Ubuntu-based CI happened to have those tools at the hardcoded paths,
masking the problem.

Use the test runner's own PATH for the child process instead, and
resolve bash via PATH rather than assuming /bin/bash. /bin/sh is left
unchanged since it is a stable, portable path across supported
platforms.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Copilot AI balanced review requested due to automatic review settings August 10, 2026 18:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Makes proxy-script tests portable across Linux distributions by avoiding hardcoded utility paths.

Changes:

  • Resolve Bash through the inherited PATH.
  • Pass the test runner鈥檚 PATH to isolated child environments.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
targets/linux/rpm/distro/zypper_install_test.go Makes Zypper proxy tests portable.
targets/linux/rpm/distro/dnf_install_test.go Makes DNF proxy tests portable.
targets/linux/deb/distro/install_test.go Inherits PATH in APT proxy tests.
generator_nodemodules_test.go Inherits PATH in npm proxy tests.

馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@cpuguy83
cpuguy83 requested a review from kartikjoshi21 August 10, 2026 19:02
@cpuguy83 cpuguy83 self-assigned this Aug 11, 2026
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.

2 participants