Skip to content

Fix go-archive PATH stubbing for cross-platform tests - #9656

Merged
taylorsilva merged 1 commit into
concourse:masterfrom
Pix4D:pci-4898-goarchive-ginkgo-setenv-upstream
Jul 28, 2026
Merged

taylorsilva merged 1 commit into
concourse:masterfrom
Pix4D:pci-4898-goarchive-ginkgo-setenv-upstream

Conversation

@aliculPix4D

Copy link
Copy Markdown
Contributor

Fix go-archive PATH stubbing for cross-platform tests

Replace PATH=/dev/null with GinkgoT().Setenv + TempDir so missing tar/unzip lookups fail the same way on every platform, and PATH is restored automatically after each spec.

Replace PATH=/dev/null with GinkgoT().Setenv + TempDir so missing
tar/unzip lookups fail the same way on every platform, and PATH is
restored automatically after each spec.

AfterEach(func() {
Expect(os.Setenv("PATH", oldPATH)).To(Succeed())
// Set PATH to a temporary directory to ensure that the tar executable

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wonder if a comment is even required here, honestly.

@aliculPix4D

Copy link
Copy Markdown
Contributor Author

@odormond @marco-m FYI, I opened this one directly upstream... since there is nothing really to review here..

// will not be found. The directory must exist, so that the lookup fails
// identically on every platform. GinkgoT().Setenv will restore PATH after
// the spec.
GinkgoT().Setenv("PATH", GinkgoT().TempDir())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks to @marco-m-pix4d for suggesting this.

Comment on lines +147 to +150
// Set PATH to a temporary directory to ensure that the tar executable
// will not be found. The directory must exist, so that the lookup fails
// identically on every platform. GinkgoT().Setenv will restore PATH after
// the spec.

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.

Maybe the first comment in the file is enough.
I don't have a strong opinion.

@marco-m marco-m 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.

thanks

@taylorsilva taylorsilva left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comments do read as repetitive, but I'm fine with allowing this in the tests.

@taylorsilva

Copy link
Copy Markdown
Member

Re-running checks

@taylorsilva taylorsilva moved this from Todo to In Progress in Pull Requests Jul 27, 2026
@taylorsilva
taylorsilva merged commit 310f54f into concourse:master Jul 28, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Pull Requests Jul 28, 2026
@aliculPix4D
aliculPix4D deleted the pci-4898-goarchive-ginkgo-setenv-upstream branch July 28, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants