Skip to content

Commit 11ac855

Browse files
committed
Switch hack to use the new envtest tool
We can now drop the `setup-envtest.sh` script, and instead just use `source <(setup-envtest fetch -k ${version} -p env)` (plus a couple lines to install setup-envtest ;-)).
1 parent ea5d445 commit 11ac855

File tree

2 files changed

+16
-100
lines changed

2 files changed

+16
-100
lines changed

hack/check-everything.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,28 @@ set -o pipefail
2020

2121
hack_dir=$(dirname ${BASH_SOURCE})
2222
source ${hack_dir}/common.sh
23-
source ${hack_dir}/setup-envtest.sh
2423

2524
tmp_root=/tmp
2625
kb_root_dir=$tmp_root/kubebuilder
2726

2827
ENVTEST_K8S_VERSION=${ENVTEST_K8S_VERSION:-"1.19.2"}
2928

30-
fetch_envtest_tools "$kb_root_dir"
31-
fetch_envtest_tools "${hack_dir}/../pkg/internal/testing/integration/assets"
32-
setup_envtest_env "$kb_root_dir"
29+
# set up envtest tools if necessary
30+
if [[ -z "${KUBEBUILDER_ASSETS:-""}" ]]; then
31+
header_text "installing envtest tools@${ENVTEST_K8S_VERSION} with setup-envtest"
32+
# install this in a subshell to avoid messing with the cwd
33+
tmp_bin=/tmp/cr-tests-bin
34+
(
35+
# don't presume to install for the user
36+
cd ${hack_dir}/../tools/setup-envtest
37+
GOBIN=${tmp_bin} go install .
38+
)
39+
source <(${tmp_bin}/setup-envtest fetch -k ${ENVTEST_K8S_VERSION} -p env)
40+
fi
41+
# link the assets into integration
42+
for tool in kube-apiserver etcd kubectl; do
43+
ln -f -s "${KUBEBUILDER_ASSETS:?unable find envtest assets}/${tool}" "${hack_dir}/../pkg/internal/testing/integration/assets/bin/${tool}"
44+
done
3345

3446
${hack_dir}/verify.sh
3547
${hack_dir}/test-all.sh

hack/setup-envtest.sh

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)