Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test/e2e: Preserve the existing environment when using exec.Command #2876

Conversation

timflannagan
Copy link
Contributor

@timflannagan timflannagan commented Oct 21, 2022

Signed-off-by: timflannagan timflannagan@gmail.com

Description of the change:
Ensure we're preserving the existing environment before running any exec.Commands. I noticed locally when running the e2e suite that the underlying bash script wasn't able to find 'oc' despite that executable being in my $PATH, and the which oc was outputting strange results when run in isolation. Explicitly specifying the existing environment via os.Environ() which should include the $PATH variable helped fix this pathing issue.

Motivation for the change:
I saw this in openshift's downstream CI for our OLM fork. We've fixed this issue in the past in other downstream repositories that use a similar setup.

Architectural changes:

Testing remarks:

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Bug fixes are accompanied by regression test(s)
  • e2e tests and flake fixes are accompanied evidence of flake testing, e.g. executing the test 100(0) times
  • tech debt/todo is accompanied by issue link(s) in comments in the surrounding code
  • Tests are comprehensible, e.g. Ginkgo DSL is being used appropriately
  • Docs updated or added to /doc
  • Commit messages sensible and descriptive
  • Tests marked as [FLAKE] are truly flaky and have an issue
  • Code is properly formatted

Signed-off-by: timflannagan <timflannagan@gmail.com>
@openshift-ci
Copy link

openshift-ci bot commented Oct 21, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: timflannagan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 21, 2022
@grokspawn grokspawn added the lgtm Indicates that a PR is ready to be merged. label Oct 21, 2022
@openshift-merge-robot openshift-merge-robot merged commit 91e5d90 into operator-framework:master Oct 21, 2022
@timflannagan timflannagan deleted the ci/fix-collect-scripts branch October 21, 2022 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants