forked from GoogleCloudPlatform/k8s-config-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update test scripts and instructions to use them.
- Updated the `run-e2e` script to allow running tests without recording goldens - Updated `record-gcp` to call `run-e2e` instead of reproducing most of its functionality - Renamed `compare-mock` to `record-mock` to better reflect what it does - Added `compare-mock` and `compare-gcp` to provide convenient ways of running each in non-record mode - Updated mockgcp docs to reference the scripts instead of using the full command line - Updated direct controller step 1 doc with the new scripts
- Loading branch information
1 parent
bac1bde
commit eb5d73f
Showing
8 changed files
with
82 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
REPO_ROOT="$(git rev-parse --show-toplevel)" | ||
cd ${REPO_ROOT} | ||
|
||
# Run the tests specified on the command line | ||
export RUN_TESTS=TestAllInSeries/$1 | ||
|
||
# Clear existing artifacts | ||
rm -rf $(pwd)/artifactz/realgcp | ||
|
||
# Run e2e tests against real gcp | ||
WRITE_GOLDEN_OUTPUT="" ARTIFACTS=$(pwd)/artifactz/realgcp E2E_GCP_TARGET=real dev/tasks/run-e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,17 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
export KUBEBUILDER_ASSETS=$(go run sigs.k8s.io/controller-runtime/tools/setup-envtest@latest use -p path) | ||
REPO_ROOT="$(git rev-parse --show-toplevel)" | ||
cd ${REPO_ROOT} | ||
|
||
rm -rf $(pwd)/artifactz/realgcp | ||
|
||
RUN_TESTS=TestAllInSeries/$1 | ||
|
||
if [[ -z "${GCP_PROJECT_ID:-}" ]]; then | ||
GCP_PROJECT_ID=$(gcloud config get-value project) | ||
fi | ||
echo "Using project: ${GCP_PROJECT_ID}" | ||
|
||
TEST_FOLDER_ID=$(gcloud projects describe ${GCP_PROJECT_ID} --format='value(parent.id)') | ||
export TEST_FOLDER_ID | ||
# Run the tests specified on the command line | ||
export RUN_TESTS=TestAllInSeries/$1 | ||
|
||
TEST_ORG_ID=$(gcloud projects get-ancestors ${GCP_PROJECT_ID} | grep organization | cut -f1 -d ' ') | ||
export TEST_ORG_ID | ||
|
||
if [[ -z "${TEST_BILLING_ACCOUNT_ID:-}" ]]; then | ||
TEST_BILLING_ACCOUNT_ID=$(gcloud billing projects describe ${GCP_PROJECT_ID} --format='value(billingAccountName)' | cut -f2 -d/) | ||
fi | ||
echo "TEST_BILLING_ACCOUNT_ID=${TEST_BILLING_ACCOUNT_ID}" | ||
export TEST_BILLING_ACCOUNT_ID | ||
|
||
if [[ -z "${KCC_USE_DIRECT_RECONCILERS:-}" ]]; then | ||
KCC_USE_DIRECT_RECONCILERS="ComputeForwardingRule" | ||
fi | ||
export KCC_USE_DIRECT_RECONCILERS | ||
echo "KCC_USE_DIRECT_RECONCILERS=$KCC_USE_DIRECT_RECONCILERS" | ||
# Clear existing artifacts | ||
rm -rf $(pwd)/artifactz/realgcp | ||
|
||
# Run e2e tests against real gcp, capturing output | ||
ARTIFACTS=$(pwd)/artifactz/realgcp \ | ||
E2E_KUBE_TARGET=envtest \ | ||
E2E_GCP_TARGET=real \ | ||
GOLDEN_REQUEST_CHECKS=1 \ | ||
GOLDEN_OBJECT_CHECKS=1 \ | ||
WRITE_GOLDEN_OUTPUT=1 \ | ||
RUN_E2E=1 \ | ||
KCC_USE_DIRECT_RECONCILERS=$KCC_USE_DIRECT_RECONCILERS \ | ||
go test ./tests/e2e -timeout 7200s -v -run $RUN_TESTS | ||
ARTIFACTS=$(pwd)/artifactz/realgcp E2E_GCP_TARGET=real dev/tasks/run-e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/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} | ||
|
||
# Run the tests specified on the command line | ||
export RUN_TESTS=TestAllInSeries/$1 | ||
|
||
# Clear existing artifacts | ||
rm -rf $(pwd)/artifactz/mock | ||
|
||
# Run e2e tests against our mockgcp, capturing output | ||
E2E_GCP_TARGET=mock dev/tasks/run-e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters