Skip to content

Commit

Permalink
Switch hack to use the new envtest tool
Browse files Browse the repository at this point in the history
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 ;-)).
  • Loading branch information
DirectXMan12 committed Apr 21, 2021
1 parent 6d4fed8 commit e19b89a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 100 deletions.
20 changes: 16 additions & 4 deletions hack/check-everything.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,28 @@ set -o pipefail

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

tmp_root=/tmp
kb_root_dir=$tmp_root/kubebuilder

ENVTEST_K8S_VERSION=${ENVTEST_K8S_VERSION:-"1.19.2"}

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

${hack_dir}/verify.sh
${hack_dir}/test-all.sh
Expand Down
96 changes: 0 additions & 96 deletions hack/setup-envtest.sh

This file was deleted.

0 comments on commit e19b89a

Please sign in to comment.