Tests fail with recommended installation #2395
|
Hello there, I have installed the Kubebuilder with the recommended approach mentioned in latest Kubebuilder book. It just installs the kubebuilder binary and moves it to /usr/local/bin/. So, when i run go test command in the root directory of my project, it gives me following output: $ go test ./...
...
Failure [0.001 seconds]
[BeforeSuite] BeforeSuite
/home/joshsagredo/go/src/github.com/bilalcaliskan/kubebuilder-tutorial/controllers/suite_test.go:66
Unexpected error:
<*fmt.wrapError | 0xc0006818a0>: {
msg: "failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory",
err: {
Op: "fork/exec",
Path: "/usr/local/kubebuilder/bin/etcd",
Err: 0x2,
},
}
failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory
occurredAs you see, it searches the etcd binary in /usr/local/kubebuilder/bin directory but docs does not mention about it at all. With a little research, i have found that legacy kubebuilder book recommends this installation method which installs kubebuilder as a folder under /usr/local/kubebuilder directory. I assume that with legacy installation, there is an etcd binary under /usr/local/kubebuilder/bin Here is my kubebuilder version output: $ kubebuilder version
Version: main.version{KubeBuilderVersion:"3.1.0", KubernetesVendor:"1.19.2", GitCommit:"92e0349ca7334a0a8e5e499da4fb077eb524e94a", BuildDate:"2021-05-27T17:54:28Z", GoOs:"linux", GoArch:"amd64"}There are lots of conversations about that problem, i have found that issue which is closed but as i mentioned in that comment, with the latest Kubebuilder book, i have no ensure-kubebuilder make target in my Makefile. How should i proceed? Should i try the legacy installation method or forget about testing with the assistance of latest docs :) |
Replies: 2 comments
|
It happened because your local env has not had the envtest binaries. |
|
Closing since it is answered. |
It happened because your local env has not had the envtest binaries.
the docs and scaffold with the makefile targets have this scenario sorted out in the latest releases so I am marking this one as answered.