You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running 'make test' on MacOS fails to load test environment properly and fails due to test-env not being setup:
STEP: bootstrapping test environment
1.6509910661927319e+09 DEBUG controller-runtime.test-env starting control plane
1.6509910661970549e+09 ERROR controller-runtime.test-env unable to start the controlplane {"tries": 0, "error": "exec: \"etcd\": executable file not found in $PATH"}
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
/Users/seizadi/projects/go-projects/pkg/mod/sigs.k8s.io/[email protected]/pkg/envtest/server.go:330
/Users/seizadi/projects/go-projects/src/github.com/infobloxopen/guestbook/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/Users/seizadi/projects/go-projects/src/github.com/infobloxopen/guestbook/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
go fmt ./...
go vet ./...
go: creating new go.mod: module tmp
Downloading sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
go: added github.com/go-logr/logr v1.2.0
go: added github.com/go-logr/zapr v1.2.0
go: added github.com/spf13/afero v1.6.0
go: added github.com/spf13/pflag v1.0.5
go: added go.uber.org/atomic v1.7.0
go: added go.uber.org/multierr v1.6.0
go: added go.uber.org/zap v1.19.1
go: added golang.org/x/text v0.3.6
go: added sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20220423154536-b1e1a4f79554
bash: /Users/seizadi/projects/go-projects/src/github.com/infobloxopen/guestbook/bin/setup-envtest: No such file or directory
KUBEBUILDER_ASSETS="" go test ./... -coverprofile cover.out
? my.domain/guestbook [no test files]
? my.domain/guestbook/api/v1 [no test files]
ok my.domain/guestbook/controllers 10.444s coverage: 0.0% of statements
Also if I create a docker file with tests integrated it runs in the Linux environment, so it might be something with MacOS:
# Build the manager binary
FROM golang:1.17 as builder
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Copy the go source
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY pkg/ pkg/
# Copy Tooling to run test...
COPY hack/ hack/
COPY Makefile Makefile
# Run Tests
RUN make test# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
# Use distroless as minimal base image to package the manager binary# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532
ENTRYPOINT ["/manager"]
make docker-build
/Users/seizadi/projects/go-projects/src/github.com/infobloxopen/guestbook/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/Users/seizadi/projects/go-projects/src/github.com/infobloxopen/guestbook/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
go fmt ./...
go vet ./...
go: creating new go.mod: module tmp
Downloading sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
go: added github.com/go-logr/logr v1.2.0
go: added github.com/go-logr/zapr v1.2.0
go: added github.com/spf13/afero v1.6.0
go: added github.com/spf13/pflag v1.0.5
go: added go.uber.org/atomic v1.7.0
go: added go.uber.org/multierr v1.6.0
go: added go.uber.org/zap v1.19.1
go: added golang.org/x/text v0.3.6
go: added sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20220423154536-b1e1a4f79554
bash: /Users/seizadi/projects/go-projects/src/github.com/infobloxopen/guestbook/bin/setup-envtest: No such file or directory
KUBEBUILDER_ASSETS="" go test ./... -coverprofile cover.out
? my.domain/guestbook [no test files]
? my.domain/guestbook/api/v1 [no test files]
ok my.domain/guestbook/controllers 10.838s coverage: 0.0% of statements
docker build -t controller:latest .
[+] Building 136.8s (21/21) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 921B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 171B 0.0s
=> [internal] load metadata for gcr.io/distroless/static:nonroot 0.4s
=> [internal] load metadata for docker.io/library/golang:1.17 1.5s
=> [auth] library/golang:pull token for registry-1.docker.io 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 118.22kB 0.0s
=> [builder 1/12] FROM docker.io/library/golang:1.17@sha256:724abf4dd44985d060f7aa91af5211eb2052491424bd497ba3ddc31f7cee969d 0.0s
=> CACHED [stage-1 1/3] FROM gcr.io/distroless/static:nonroot@sha256:2556293984c5738fc75208cce52cf0a4762c709cf38e4bf8def65a61992da0ad 0.0s
=> CACHED [builder 2/12] WORKDIR /workspace 0.0s
=> [builder 3/12] COPY go.mod go.mod 0.0s
=> [builder 4/12] COPY go.sum go.sum 0.0s
=> [builder 5/12] RUN go mod download 38.4s
=> [builder 6/12] COPY main.go main.go 0.0s
=> [builder 7/12] COPY api/ api/ 0.0s
=> [builder 8/12] COPY controllers/ controllers/ 0.0s
=> [builder 9/12] COPY hack/ hack/ 0.0s
=> [builder 10/12] COPY Makefile Makefile 0.0s
=> [builder 11/12] RUN make test 67.7s
=> [builder 12/12] RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go 28.5s
=> [stage-1 2/3] COPY --from=builder /workspace/manager . 0.1s
=> exporting to image 0.2s
=> => exporting layers 0.2s
=> => writing image sha256:b70764908cc973aa3e60a79e869090b46ebec24a2dccd1819ba3bf94075effb6 0.0s
=> => naming to docker.io/library/controller:latest
Reproducing this issue
brew install kubebuilder # loads v3.3.0
mkdir -p ~/projects/guestbook
cd~/projects/guestbook
kubebuilder init --domain my.domain --repo my.domain/guestbook
kubebuilder create api --group webapp --version v1 --kind Guestbook
make test
Go version 1.18 is not supported.
To support go 1.18 we need to change the makefile since go get can not be longer be used to download deps
However, that are not only the changes which must be addressed. For more info see: #2559
What broke? What's expected?
Running 'make test' on MacOS fails to load test environment properly and fails due to test-env not being setup:
I followed these steps to download integration tests locally
Now I am able to run 'make test' target
Also if I create a docker file with tests integrated it runs in the Linux environment, so it might be something with MacOS:
Reproducing this issue
KubeBuilder (CLI) Version
v3.3.0
PROJECT version
version: "3"
Plugin versions
Other versions
go version go1.18.1 darwin/amd64
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.5", GitCommit:"c285e781331a3785a7f436042c65c5641ce8a9e9", GitTreeState:"clean", BuildDate:"2022-03-16T15:51:05Z", GoVersion:"go1.17.8", Compiler:"gc", Platform:"darwin/amd64"}
Extra Labels
No response
The text was updated successfully, but these errors were encountered: