Skip to content
This repository has been archived by the owner on Mar 24, 2020. It is now read-only.

tests fail #14

Closed
mhrivnak opened this issue Mar 4, 2019 · 4 comments
Closed

tests fail #14

mhrivnak opened this issue Mar 4, 2019 · 4 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@mhrivnak
Copy link
Member

mhrivnak commented Mar 4, 2019

I'm seeing this on the master branch.

$ make test
go generate ./pkg/... ./cmd/...
go fmt ./pkg/... ./cmd/...
go vet ./pkg/... ./cmd/...
go run vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go crd
CRD files generated, files can be found under path /home/mhrivnak/golang/src/github.com/metalkube/cluster-api-provider-baremetal/config/crds.
kustomize build config/default/ > provider-components.yaml
2019/03/04 10:16:12 Adding nameprefix and namesuffix to Namespace resource will be deprecated in next release.
echo "---" >> provider-components.yaml
cd vendor && kustomize build github.com/openshift/cluster-api/config/default/ >> ../provider-components.yaml
2019/03/04 10:16:21 Adding nameprefix and namesuffix to Namespace resource will be deprecated in next release.
go test ./pkg/... ./cmd/... -coverprofile cover.out
?   	github.com/metalkube/cluster-api-provider-baremetal/pkg/apis	[no test files]
?   	github.com/metalkube/cluster-api-provider-baremetal/pkg/apis/baremetal	[no test files]
2019/03/04 10:16:23 failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory
FAIL	github.com/metalkube/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1	0.011s
?   	github.com/metalkube/cluster-api-provider-baremetal/pkg/cloud/baremetal/actuators/machine	[no test files]
?   	github.com/metalkube/cluster-api-provider-baremetal/pkg/controller	[no test files]
?   	github.com/metalkube/cluster-api-provider-baremetal/pkg/webhook	[no test files]
?   	github.com/metalkube/cluster-api-provider-baremetal/cmd/manager	[no test files]
make: *** [Makefile:15: test] Error 1
@russellb
Copy link
Member

russellb commented Mar 4, 2019

Yeah, the tests will fail unless you install kubebuilder in the right magic location. See this line:

2019/03/04 10:16:23 failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory

You need to download kubebuilder and unpack it under /usr/local/.

We should add this as part of dev env setup in the README, too.

@vhosakot
Copy link

vhosakot commented May 22, 2019

I saw the same error when I ran make test in the workspace created using kubebuiler due to missing /usr/local/kubebuilder/bin/etcd file on the host:

go test ./api/... ./controllers/... -coverprofile cover.out
...
2019-05-22T16:25:21.837Z	ERROR	controller-runtime.test-env	unable to start the controlplane	{"tries": 0, "error": "fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory"}

The following steps resolved the error for me and then make test worked fine:

wget https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.0.0-alpha.1/kubebuilder_2.0.0-alpha.1_linux_amd64.tar.gz
tar -zxvf  kubebuilder_2.0.0-alpha.1_linux_amd64.tar.gz
sudo mv kubebuilder_2.0.0-alpha.1_linux_amd64 /usr/local/kubebuilder

$ find /usr/local/kubebuilder
/usr/local/kubebuilder
/usr/local/kubebuilder/bin
/usr/local/kubebuilder/bin/etcd
/usr/local/kubebuilder/bin/kube-apiserver
/usr/local/kubebuilder/bin/kubebuilder
/usr/local/kubebuilder/bin/kubectl

workspace_directory$ make test
go fmt ./...
go vet ./...
go test ./api/... ./controllers/... -coverprofile cover.out
ok  	redacted/api/v1alpha1	7.420s	coverage: 2.4% of statements
ok  	redacted/controllers	5.816s	coverage: 0.0% of statements

@russellb
Copy link
Member

Thanks, there's some docs in docs/dev/setup.md about installing kubebuilder, but I'm going to put up a patch to make this more obvious.

russellb added a commit to russellb/cluster-api-provider-baremetal that referenced this issue May 22, 2019
Generating manifests and running the test suite require kustomize and
kubebuilder.  Add a quick check for them to the Makefile to avoid less
obvious errors later if they are missing.

Closes issue metal3-io#14.
russellb added a commit to russellb/cluster-api-provider-baremetal that referenced this issue May 22, 2019
Generating manifests and running the test suite require kustomize and
kubebuilder.  Add a quick check for them to the Makefile to avoid less
obvious errors later if they are missing.

Closes issue metal3-io#14.
@russellb russellb self-assigned this May 22, 2019
russellb added a commit to russellb/cluster-api-provider-baremetal that referenced this issue May 29, 2019
Generating manifests and running the test suite require kustomize and
kubebuilder.  Add a quick check for them to the Makefile to avoid less
obvious errors later if they are missing.

Closes issue metal3-io#14.
@russellb russellb added the kind/bug Categorizes issue or PR as related to a bug. label May 29, 2019
@dhellmann
Copy link
Member

I think #77 addresses this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

4 participants