diff --git a/dev/tasks/run-e2e b/dev/tasks/run-e2e index ee27a50324..c649780576 100755 --- a/dev/tasks/run-e2e +++ b/dev/tasks/run-e2e @@ -20,8 +20,10 @@ set -o pipefail REPO_ROOT="$(git rev-parse --show-toplevel)" cd ${REPO_ROOT} -echo "Downloading envtest assets..." -export KUBEBUILDER_ASSETS=$(go run sigs.k8s.io/controller-runtime/tools/setup-envtest@latest use -p path) +if [[ -z "${KUBEBUILDER_ASSETS:-}" ]]; then + echo "Downloading envtest assets..." + export KUBEBUILDER_ASSETS=$(go run sigs.k8s.io/controller-runtime/tools/setup-envtest@latest use -p path) +fi if [[ -z "${KCC_USE_DIRECT_RECONCILERS:-}" ]]; then KCC_USE_DIRECT_RECONCILERS=ComputeForwardingRule,GKEHubFeatureMembership,SecretManagerSecret @@ -77,9 +79,15 @@ if [[ -z "${TEST_TIMEOUT:-}" ]]; then fi echo "Using TEST_TIMEOUT=${TEST_TIMEOUT}" -# Run e2e tests against real gcp, capturing output +if [[ -z "${PREBUILT_TEST_BINARY:-}" ]]; then + echo "Prebuilding e2e tests" + PREBUILT_TEST_BINARY=.build/tests-e2e + go test -c -o ${PREBUILT_TEST_BINARY} ./tests/e2e +fi + +# Run e2e tests GOLDEN_REQUEST_CHECKS=1 \ GOLDEN_OBJECT_CHECKS=1 \ WRITE_GOLDEN_OUTPUT=1 \ RUN_E2E=1 \ - go test ./tests/e2e -timeout ${TEST_TIMEOUT} -v -run $RUN_TESTS + ${PREBUILT_TEST_BINARY} -test.timeout ${TEST_TIMEOUT} -test.v -test.run $RUN_TESTS diff --git a/dev/tasks/turbo-e2e b/dev/tasks/turbo-e2e new file mode 100755 index 0000000000..fba5d1620e --- /dev/null +++ b/dev/tasks/turbo-e2e @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -o errexit +set -o nounset +set -o pipefail + +REPO_ROOT="$(git rev-parse --show-toplevel)" +cd ${REPO_ROOT} + +dev/tasks/list-tests | xargs -I {} mkdir -p "testlogs/{}" + +echo "Downloading envtest assets..." +export KUBEBUILDER_ASSETS=$(go run sigs.k8s.io/controller-runtime/tools/setup-envtest@latest use -p path) + +echo "Prebuilding e2e tests" +export PREBUILT_TEST_BINARY=.build/tests-e2e +go test -c -o ${PREBUILT_TEST_BINARY} ./tests/e2e + +echo "Running tests" +dev/tasks/list-tests | xargs -P 40 -I {} /bin/bash -c "echo {}; RUN_TESTS={} dev/tasks/run-e2e > testlogs/{}/log 2>&1"