Test execution (`make test`) fails on macOS due to `kustomize`
I'm trying to run the tests for Spin Operator on my local machine (MacOS). When running make test I receive the following error suggesting it is something related to the combination of the pinned kuztomize version and latest MacOS.
make test
==> Generating latest manifests
==> Generating CRD Code
go fmt ./...
go vet ./...
/Users/thorsten/dev/forks/spin-operator/bin/setup-envtest use 1.28.3 --bin-dir /Users/thorsten/dev/forks/spin-operator/bin
Version: 1.28.3
OS/Arch: darwin/arm64
Path: /Users/thorsten/dev/forks/spin-operator/bin/k8s/1.28.3-darwin-arm64
KUBEBUILDER_ASSETS="/Users/thorsten/dev/forks/spin-operator/bin/k8s/1.28.3-darwin-arm64" go test -race ./... -coverprofile cover.out
github.com/spinkube/spin-operator/api/v1alpha1 coverage: 0.0% of statements
github.com/spinkube/spin-operator/cmd coverage: 0.0% of statements
github.com/spinkube/spin-operator/internal/constants coverage: 0.0% of statements
github.com/spinkube/spin-operator/internal/generics coverage: 0.0% of statements
github.com/spinkube/spin-operator/internal/logging coverage: 0.0% of statements
github.com/spinkube/spin-operator/pkg/spinapp coverage: 0.0% of statements
F0506 17:51:10.743960 12177 env.go:375] Setup failure: exit status 2: ==> Generating latest manifests
test -s /Users/thorsten/dev/forks/spin-operator/bin/kustomize || GOBIN=/Users/thorsten/dev/forks/spin-operator/bin GO111MODULE=on go install sigs.k8s.io/kustomize/kustomize/[email protected]
# sigs.k8s.io/kustomize/kustomize/v5
ld: warning: -bind_at_load is deprecated on macOS
/Users/thorsten/dev/forks/spin-operator/bin/kustomize build config/crd | kubectl apply -f -
error: no objects passed to apply
make[1]: *** [install] Error 1
Looking at bin/kustomize
file ./bin/kustomize
./bin/kustomize: Mach-O 64-bit executable arm64
# Trying to run kustomize results
./bin/kustomize --help
[1] 26333 killed ./bin/kustomize --help
Environment
| Component | Version |
|---|---|
| MacOS | Darwin zion 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:37 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6031 arm64 |
| Go | go version go1.22.2 darwin/arm64 |
To get kustomize working on my local machine, I did the following:
- Install kustomize on my machine using
brew install kustomize - Delete
./bin/kustomize - Created a symlink
cd bin && ln -s $(which kustomize) kustomize - Updated the desired version in
MakefiletoKUSTOMIZE_VERSION ?= v5.4.1
Next iteration of make test fails due to similar problems with controller-gen to address that issue, I did the following:
- Delete
./bin/controller-gen - Installed
controller-genusinggo install sigs.k8s.io/controller-tools/cmd/controller-gen@latest - Created a symlink
cd bin && ln -s $(which controller-gen) controller-gen - Updated the desired version in
MakefiletoCONTROLLER_TOOLS_VERSION ?= v0.15.0
With that I was able to run make test on my machine
ld: warning: -bind_at_load is deprecated on macOS is a bit of a red herring here (it should only be a warning, not an error).
If you remove your symlink and let kustomize get reinstalled does it still fail to do anything if you ./bin/kustomize build config/crd manually?
Confirming that removing the symlinks from ./bin, reinstalling both kustomize and controller-gen by executing make test results in the same failure.
in lieu of other reports of this i'm going to close it, we can reopen it if others run into it and find this