Skip to content

test (controllers) : Dynamically construct envtest binary assets while preparing envtest environment (#1387)#1441

Merged
dkwon17 merged 1 commit into
devfile:mainfrom
rohankanojia-forks:pr/envtest-arm-fix
Jun 6, 2025
Merged

test (controllers) : Dynamically construct envtest binary assets while preparing envtest environment (#1387)#1441
dkwon17 merged 1 commit into
devfile:mainfrom
rohankanojia-forks:pr/envtest-arm-fix

Conversation

@rohanKanojia
Copy link
Copy Markdown
Member

@rohanKanojia rohanKanojia commented May 29, 2025

What does this PR do?

I was facing this error when trying to run envtest on my macbook:

 [FAILED] Unexpected error:
      <*fmt.wrapError | 0x140004696a0>: 
      unable to start control plane itself: failed to start the controlplane. retried 5 times: fork/exec ../../../bin/k8s/1.24.2-linux-amd64/etcd: no such file or directory
      {
          msg: "unable to start control plane itself: failed to start the controlplane. retried 5 times: fork/exec ../../../bin/k8s/1.24.2-linux-amd64/etcd: no such file or directory",
          err: <*fmt.wrapError | 0x14000469680>{
              msg: "failed to start the controlplane. retried 5 times: fork/exec ../../../bin/k8s/1.24.2-linux-amd64/etcd: no such file or directory",
              err: <*fs.PathError | 0x14000567980>{
                  Op: "fork/exec",
                  Path: "../../../bin/k8s/1.24.2-linux-amd64/etcd",
                  Err: <syscall.Errno>0x2,
              },
          },
      }

Test suite is hardcoded to look for binary assets for linux-amd64:

BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s", "1.24.2-linux-amd64"),

However, on my machine different binaries were downloaded by envtest:

ls bin/k8s 
1.24.2-darwin-arm64

Currently envtest environment is loaded with a hardcoded BinaryAssetsDirectory for linux/amd64 machine. This doesn't work on other machines that have other operating systems and processor architectures.

Updated BinaryAssetsDirectory to dynamically construct paths based on runtime.GOOS and runtime.GOARCH

This change adds flexibility when running EnvTest across multiple platforms.

What issues does this PR fix or reference?

Fix #1387

Is it tested? How?

I've verified that make test is working.

PR Checklist

  • E2E tests pass (when PR is ready, comment /test v8-devworkspace-operator-e2e, v8-che-happy-path to trigger)
    • v8-devworkspace-operator-e2e: DevWorkspace e2e test
    • v8-che-happy-path: Happy path for verification integration with Che

…e preparing envtest environment

Currently envtest environment is loaded with hardcoded BinaryAssetsDirectory for linux/amd64
machine. This doesn't work on other machines that have other operating systems and processor
architectures.

Updated `BinaryAssetsDirectory` to dynamically construct paths based on `runtime.GOOS` and `runtime.GOARCH`

This change adds flexibility when running EnvTest across multiple platforms.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 29, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@rohanKanojia
Copy link
Copy Markdown
Member Author

/ok-to-test

@rohanKanojia rohanKanojia marked this pull request as ready for review May 29, 2025 17:25
@rohanKanojia rohanKanojia changed the title test (controllers) : Dynamically construct envtest binary assets while preparing envtest environment test (controllers) : Dynamically construct envtest binary assets while preparing envtest environment (#1387) May 30, 2025
@akurinnoy akurinnoy mentioned this pull request Jun 4, 2025
3 tasks
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 4, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: akurinnoy, rohanKanojia
Once this PR has been reviewed and has the lgtm label, please assign dkwon17 for approval. For more information see the Code Review Process.

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

Details 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

@dkwon17 dkwon17 merged commit 74a430a into devfile:main Jun 6, 2025
10 checks passed
@rohanKanojia rohanKanojia deleted the pr/envtest-arm-fix branch June 6, 2025 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some tests do not run locally (macOS)

3 participants