Skip to content

Commit 8d7c266

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 80ec8f7 commit 8d7c266

File tree

2 files changed

+15
-100
lines changed

2 files changed

+15
-100
lines changed

hack/check-everything.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,27 @@ 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+
31+
header_text "installing envtest tools@${ENVTEST_K8S_VERSION} with setup-envtest if necessary"
32+
tmp_bin=/tmp/cr-tests-bin
33+
(
34+
# don't presume to install for the user
35+
cd ${hack_dir}/../tools/setup-envtest
36+
GOBIN=${tmp_bin} go install .
37+
)
38+
source <(${tmp_bin}/setup-envtest use --use-env=always -k ${ENVTEST_K8S_VERSION} -p env)
39+
40+
# link the assets into integration
41+
for tool in kube-apiserver etcd kubectl; do
42+
ln -f -s "${KUBEBUILDER_ASSETS:?unable find envtest assets}/${tool}" "${hack_dir}/../pkg/internal/testing/integration/assets/bin/${tool}"
43+
done
3344

3445
${hack_dir}/verify.sh
3546
${hack_dir}/test-all.sh

hack/setup-envtest.sh

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

0 commit comments

Comments
 (0)