[master] Auto-update dependencies (#306)

Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
This commit is contained in:
Matt Moore 2020-08-11 08:20:07 -07:00 committed by GitHub
parent 4976ef3755
commit 53a467426d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 147 additions and 164 deletions

4
go.mod
View File

@ -16,8 +16,8 @@ require (
k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible
k8s.io/code-generator v0.18.6
k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29
knative.dev/pkg v0.0.0-20200810090030-095ff27da65c
knative.dev/test-infra v0.0.0-20200806191129-68b7defbd189
knative.dev/pkg v0.0.0-20200810223505-473bba04ee7f
knative.dev/test-infra v0.0.0-20200811030605-72f8c9f3e933
)
replace (

6
go.sum
View File

@ -1868,8 +1868,8 @@ knative.dev/pkg v0.0.0-20200505191044-3da93ebb24c2/go.mod h1:Q6sL35DdGs8hIQZKdaC
knative.dev/pkg v0.0.0-20200515002500-16d7b963416f/go.mod h1:tMOHGbxtRz8zYFGEGpV/bpoTEM1o89MwYFC4YJXl3GY=
knative.dev/pkg v0.0.0-20200528142800-1c6815d7e4c9/go.mod h1:QgNZTxnwpB/oSpNcfnLVlw+WpEwwyKAvJlvR3hgeltA=
knative.dev/pkg v0.0.0-20200711004937-22502028e31a/go.mod h1:AqAJV6rYi8IGikDjJ/9ZQd9qKdkXVlesVnVjwx62YB8=
knative.dev/pkg v0.0.0-20200810090030-095ff27da65c h1:wumYkfbHgPQpwgidTSjIXv3lvr1SrJN+ztF3b4lD4bI=
knative.dev/pkg v0.0.0-20200810090030-095ff27da65c/go.mod h1:BU3J2SM/hsc0DdfZJpDPJCP5dVQrPQl84U1x8PN8o9I=
knative.dev/pkg v0.0.0-20200810223505-473bba04ee7f h1:JkW8d+/xVLUjKvfyq07ZkM+BkiT61Cbdg+uIV+ngoTc=
knative.dev/pkg v0.0.0-20200810223505-473bba04ee7f/go.mod h1:BU3J2SM/hsc0DdfZJpDPJCP5dVQrPQl84U1x8PN8o9I=
knative.dev/test-infra v0.0.0-20200407185800-1b88cb3b45a5/go.mod h1:xcdUkMJrLlBswIZqL5zCuBFOC22WIPMQoVX1L35i0vQ=
knative.dev/test-infra v0.0.0-20200505052144-5ea2f705bb55/go.mod h1:WqF1Azka+FxPZ20keR2zCNtiQA1MP9ZB4BH4HuI+SIU=
knative.dev/test-infra v0.0.0-20200513011557-d03429a76034/go.mod h1:aMif0KXL4g19YCYwsy4Ocjjz5xgPlseYV+B95Oo4JGE=
@ -1877,6 +1877,8 @@ knative.dev/test-infra v0.0.0-20200519015156-82551620b0a9/go.mod h1:A5b2OAXTOeHT
knative.dev/test-infra v0.0.0-20200707183444-aed09e56ddc7/go.mod h1:RjYAhXnZqeHw9+B0zsbqSPlae0lCvjekO/nw5ZMpLCs=
knative.dev/test-infra v0.0.0-20200806191129-68b7defbd189 h1:PkTuK9kgtsdwrIxUAmaCmDwfRKBoXujiqNRDWO1r8cc=
knative.dev/test-infra v0.0.0-20200806191129-68b7defbd189/go.mod h1:Pmg2c7Z7q7BGFUV/GOpU5BlrD3ePJft4MPqx8AYBplc=
knative.dev/test-infra v0.0.0-20200811030605-72f8c9f3e933 h1:1nfmLI9iQ87ygMeKGLREhH+2KYa6XX/e6enu0PsasHY=
knative.dev/test-infra v0.0.0-20200811030605-72f8c9f3e933/go.mod h1:Pmg2c7Z7q7BGFUV/GOpU5BlrD3ePJft4MPqx8AYBplc=
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=

View File

@ -74,7 +74,7 @@ func (*Conditions) GetFullType() ducktypes.Populatable {
return &KResource{}
}
// GetCondition fetches the condition of the specified type.
// GetCondition fetches a copy of the condition of the specified type.
func (s *Status) GetCondition(t apis.ConditionType) *apis.Condition {
for _, cond := range s.Conditions {
if cond.Type == t {

View File

@ -23,6 +23,8 @@ import (
"time"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/api/validation"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/sets"
)
@ -144,6 +146,47 @@ func AsQuantity(key string, target **resource.Quantity) ParseFunc {
}
}
// AsOptionalNamespacedName parses the value at key as a types.NamespacedName into the target, if it exists
// The namespace and name are both required and expected to be valid DNS labels
func AsOptionalNamespacedName(key string, target **types.NamespacedName) ParseFunc {
return func(data map[string]string) error {
if _, ok := data[key]; !ok {
return nil
}
*target = &types.NamespacedName{}
return AsNamespacedName(key, *target)(data)
}
}
// AsNamespacedName parses the value at key as a types.NamespacedName into the target, if it exists
// The namespace and name are both required and expected to be valid DNS labels
func AsNamespacedName(key string, target *types.NamespacedName) ParseFunc {
return func(data map[string]string) error {
raw, ok := data[key]
if !ok {
return nil
}
v := strings.SplitN(raw, string(types.Separator), 3)
if len(v) != 2 {
return fmt.Errorf("failed to parse %q: expected 'namespace/name' format", key)
}
for _, val := range v {
if errs := validation.ValidateNamespaceName(val, false); len(errs) > 0 {
return fmt.Errorf("failed to parse %q: %s", key, strings.Join(errs, ", "))
}
}
target.Namespace = v[0]
target.Name = v[1]
return nil
}
}
// Parse parses the given map using the parser functions passed in.
func Parse(data map[string]string, parsers ...ParseFunc) error {
for _, parse := range parsers {

View File

@ -156,9 +156,9 @@ func NewStackdriverClientConfigFromMap(config map[string]string) *StackdriverCli
// record applies the `ros` Options to each measurement in `mss` and then records the resulting
// measurements in the metricsConfig's designated backend.
func (mc *metricsConfig) record(ctx context.Context, mss []stats.Measurement, ros ...stats.Options) error {
if mc == nil {
// Don't record data points if the metric config is not initialized yet.
// At this point, it's unclear whether should record or not.
if mc == nil || mc.backendDestination == none {
// Don't record data points if the metric config is not initialized yet or if
// the defined backend is "none" explicitly.
return nil
}

View File

@ -47,7 +47,6 @@ export E2E_CLUSTER_ZONE=${E2E_CLUSTER_ZONE:-}
readonly E2E_CLUSTER_BACKUP_REGIONS=${E2E_CLUSTER_BACKUP_REGIONS:-us-west1 us-east1}
readonly E2E_CLUSTER_BACKUP_ZONES=${E2E_CLUSTER_BACKUP_ZONES:-}
readonly E2E_CLUSTER_MACHINE=${E2E_CLUSTER_MACHINE:-e2-standard-4}
readonly E2E_GKE_ENVIRONMENT=${E2E_GKE_ENVIRONMENT:-prod}
readonly E2E_GKE_COMMAND_GROUP=${E2E_GKE_COMMAND_GROUP:-beta}
@ -56,6 +55,7 @@ readonly E2E_GKE_COMMAND_GROUP=${E2E_GKE_COMMAND_GROUP:-beta}
# use some sane defaults.
readonly E2E_MIN_CLUSTER_NODES=${E2E_MIN_CLUSTER_NODES:-1}
readonly E2E_MAX_CLUSTER_NODES=${E2E_MAX_CLUSTER_NODES:-3}
readonly E2E_CLUSTER_MACHINE=${E2E_CLUSTER_MACHINE:-e2-standard-4}
readonly E2E_BASE_NAME="k${REPO_NAME}"
readonly E2E_CLUSTER_NAME=$(build_resource_name e2e-cls)
@ -72,8 +72,6 @@ function teardown_test_resources() {
header "Tearing down test environment"
function_exists test_teardown && test_teardown
(( ! SKIP_KNATIVE_SETUP )) && function_exists knative_teardown && knative_teardown
# Delete the kubernetes source downloaded by kubetest
rm -fr kubernetes kubernetes.tar.gz
}
# Run the given E2E tests. Assume tests are tagged e2e, unless `-tags=XXX` is passed.
@ -91,14 +89,14 @@ function go_test_e2e() {
# Dumps the k8s api server metrics. Spins up a proxy, waits a little bit and
# dumps the metrics to ${ARTIFACTS}/k8s.metrics.txt
function dump_metrics() {
header ">> Starting kube proxy"
kubectl proxy --port=8080 &
local proxy_pid=$!
sleep 5
header ">> Grabbing k8s metrics"
curl -s http://localhost:8080/metrics > "${ARTIFACTS}"/k8s.metrics.txt
# Clean up proxy so it doesn't interfere with job shutting down
kill $proxy_pid || true
header ">> Starting kube proxy"
kubectl proxy --port=8080 &
local proxy_pid=$!
sleep 5
header ">> Grabbing k8s metrics"
curl -s http://localhost:8080/metrics > "${ARTIFACTS}"/k8s.metrics.txt
# Clean up proxy so it doesn't interfere with job shutting down
kill $proxy_pid || true
}
# Dump info about the test cluster. If dump_extra_cluster_info() is defined, calls it too.
@ -109,26 +107,30 @@ function dump_cluster_state() {
echo "*** Start of information dump ***"
echo "***************************************"
local output="${ARTIFACTS}/k8s.dump-$(basename "${E2E_SCRIPT}").txt"
local output
output="${ARTIFACTS}/k8s.dump-$(basename "${E2E_SCRIPT}").txt"
echo ">>> The dump is located at ${output}"
for crd in $(kubectl api-resources --verbs=list -o name | sort); do
local count="$(kubectl get "$crd" --all-namespaces --no-headers 2>/dev/null | wc -l)"
local count
count="$(kubectl get "$crd" --all-namespaces --no-headers 2>/dev/null | wc -l)"
echo ">>> ${crd} (${count} objects)"
if [[ "${count}" > "0" ]]; then
echo ">>> ${crd} (${count} objects)" >> "${output}"
if [[ "${count}" -gt "0" ]]; then
{
echo ">>> ${crd} (${count} objects)"
echo ">>> Listing" >> "${output}"
kubectl get "${crd}" --all-namespaces >> "${output}"
echo ">>> Listing"
kubectl get "${crd}" --all-namespaces
echo ">>> Details" >> "${output}"
if [[ "${crd}" == "secrets" ]]; then
echo "Secrets are ignored for security reasons" >> ${output}
elif [[ "${crd}" == "events" ]]; then
echo "events are ignored as making a lot of noise" >> ${output}
else
kubectl get "${crd}" --all-namespaces -o yaml >> "${output}"
fi
echo ">>> Details"
if [[ "${crd}" == "secrets" ]]; then
echo "Secrets are ignored for security reasons"
elif [[ "${crd}" == "events" ]]; then
echo "events are ignored as making a lot of noise"
else
kubectl get "${crd}" --all-namespaces -o yaml
fi
} >> "${output}"
fi
done
@ -151,53 +153,13 @@ function save_metadata() {
geo_key="Zone"
geo_value="${E2E_CLUSTER_REGION}-${E2E_CLUSTER_ZONE}"
fi
local cluster_version="$(gcloud container clusters list --project="${E2E_PROJECT_ID}" --format='value(currentMasterVersion)')"
cat << EOF > "${ARTIFACTS}"/metadata.json
{
"E2E:${geo_key}": "${geo_value}",
"E2E:Machine": "${E2E_CLUSTER_MACHINE}",
"E2E:Version": "${cluster_version}",
"E2E:MinNodes": "${E2E_MIN_CLUSTER_NODES}",
"E2E:MaxNodes": "${E2E_MAX_CLUSTER_NODES}"
}
EOF
}
# Set E2E_CLUSTER_VERSION to a specific GKE version.
# Parameters: $1 - target GKE version (X.Y, X.Y.Z, X.Y.Z-gke.W, default or gke-latest).
# $2 - region[-zone] where the clusteer will be created.
function resolve_k8s_version() {
local target_version="$1"
if [[ "${target_version}" == "default" ]]; then
local version="$(gcloud container get-server-config \
--format='value(defaultClusterVersion)' \
--zone="$2")"
[[ -z "${version}" ]] && return 1
E2E_CLUSTER_VERSION="${version}"
echo "Using default version, ${E2E_CLUSTER_VERSION}"
return 0
fi
# Fetch valid versions
local versions="$(gcloud container get-server-config \
--format='value(validMasterVersions)' \
--zone="$2")"
[[ -z "${versions}" ]] && return 1
local gke_versions=($(echo -n "${versions//;/ }"))
echo "Available GKE versions in $2 are [${versions//;/, }]"
if [[ "${target_version}" == "gke-latest" ]]; then
# Get first (latest) version
E2E_CLUSTER_VERSION="${gke_versions[0]}"
echo "Using latest version, ${E2E_CLUSTER_VERSION}"
else
local latest="$(echo "${gke_versions[@]}" | tr ' ' '\n' | grep -E "^${target_version}" | sort -V | tail -1)"
if [[ -z "${latest}" ]]; then
echo "ERROR: version ${target_version} is not available"
return 1
fi
E2E_CLUSTER_VERSION="${latest}"
echo "Using ${E2E_CLUSTER_VERSION} for supplied version ${target_version}"
fi
return 0
local cluster_version
cluster_version="$(gcloud container clusters list --project="${E2E_PROJECT_ID}" --format='value(currentMasterVersion)')"
run_kntest metadata set --key="E2E:${geo_key}" --value="${geo_value}"
run_kntest metadata set --key="E2E:Machine" --value="${E2E_CLUSTER_MACHINE}"
run_kntest metadata set --key="E2E:Version" --value="${cluster_version}"
run_kntest metadata set --key="E2E:MinNodes" --value="${E2E_MIN_CLUSTER_NODES}"
run_kntest metadata set --key="E2E:MaxNodes" --value="${E2E_MAX_CLUSTER_NODES}"
}
# Create a test cluster with kubetest and call the current script again.
@ -211,31 +173,29 @@ function create_test_cluster() {
fi
echo "Cluster will have a minimum of ${E2E_MIN_CLUSTER_NODES} and a maximum of ${E2E_MAX_CLUSTER_NODES} nodes."
# Smallest cluster required to run the end-to-end-tests
local CLUSTER_CREATION_ARGS=(
--gke-create-command="container clusters create --quiet --enable-autoscaling --min-nodes=${E2E_MIN_CLUSTER_NODES} --max-nodes=${E2E_MAX_CLUSTER_NODES} --scopes=cloud-platform --enable-basic-auth --no-issue-client-certificate ${GKE_ADDONS} ${EXTRA_CLUSTER_CREATION_FLAGS[@]}"
--gke-shape={\"default\":{\"Nodes\":${E2E_MIN_CLUSTER_NODES}\,\"MachineType\":\"${E2E_CLUSTER_MACHINE}\"}}
--provider=gke
--deployment=gke
--cluster="${E2E_CLUSTER_NAME}"
--gcp-network="${E2E_NETWORK_NAME}"
--gcp-node-image="${SERVING_GKE_IMAGE}"
--gke-environment="${E2E_GKE_ENVIRONMENT}"
--gke-command-group="${E2E_GKE_COMMAND_GROUP}"
--test=false
"gke"
"--create-command=${E2E_GKE_COMMAND_GROUP} container clusters create --quiet --enable-autoscaling
--min-nodes=${E2E_MIN_CLUSTER_NODES} --max-nodes=${E2E_MAX_CLUSTER_NODES}
--cluster-version=${E2E_CLUSTER_VERSION}
--scopes=cloud-platform --enable-basic-auth --no-issue-client-certificate
--no-enable-ip-alias --no-enable-autoupgrade
${GKE_ADDONS} ${EXTRA_CLUSTER_CREATION_FLAGS[@]}"
"--environment=${E2E_GKE_ENVIRONMENT}"
"--cluster-name=${E2E_CLUSTER_NAME}"
"--num-nodes=${E2E_MIN_CLUSTER_NODES}"
"--machine-type=${E2E_CLUSTER_MACHINE}"
--up
)
if (( ! IS_BOSKOS )); then
CLUSTER_CREATION_ARGS+=(--gcp-project=${GCP_PROJECT})
CLUSTER_CREATION_ARGS+=("--gcp-project=${GCP_PROJECT}")
fi
# SSH keys are not used, but kubetest checks for their existence.
# Touch them so if they don't exist, empty files are create to satisfy the check.
mkdir -p "$HOME"/.ssh
touch "$HOME"/.ssh/google_compute_engine.pub
touch "$HOME"/.ssh/google_compute_engine
# Assume test failed (see details in set_test_return_code()).
set_test_return_code 1
local gcloud_project="${GCP_PROJECT}"
[[ -z "${gcloud_project}" ]] && gcloud_project="$(gcloud config get-value project)"
echo "gcloud project is ${gcloud_project}"
@ -246,48 +206,37 @@ function create_test_cluster() {
# Set arguments for this script again
local test_cmd_args="--run-tests"
(( SKIP_KNATIVE_SETUP )) && test_cmd_args+=" --skip-knative-setup"
[[ -n "${GCP_PROJECT}" ]] && test_cmd_args+=" --gcp-project ${GCP_PROJECT}"
[[ -n "${E2E_SCRIPT_CUSTOM_FLAGS[@]}" ]] && test_cmd_args+=" ${E2E_SCRIPT_CUSTOM_FLAGS[@]}"
[[ -n "${GCP_PROJECT}" ]] && test_cmd_args+=" --project ${GCP_PROJECT}"
[[ -n "${E2E_SCRIPT_CUSTOM_FLAGS[*]}" ]] && test_cmd_args+=" ${E2E_SCRIPT_CUSTOM_FLAGS[*]}"
local extra_flags=()
if (( IS_BOSKOS )); then
# Add arbitrary duration, wait for Boskos projects acquisition before error out
extra_flags+=(--boskos-wait-duration=20m)
extra_flags+=("--boskos-acquire-timeout-seconds=1200")
elif (( ! SKIP_TEARDOWNS )); then
# Only let kubetest tear down the cluster if not using Boskos and teardowns are not expected to be skipped,
# Only let kubetest2 tear down the cluster if not using Boskos and teardowns are not expected to be skipped,
# it's done by Janitor if using Boskos
extra_flags+=(--down)
extra_flags+=("--down")
fi
# Set a minimal kubernetes environment that satisfies kubetest
# TODO(adrcunha): Remove once https://github.com/kubernetes/test-infra/issues/13029 is fixed.
local kubedir="$(mktemp -d -t kubernetes.XXXXXXXXXX)"
local test_wrapper="${kubedir}/e2e-test.sh"
mkdir "${kubedir}"/cluster
ln -s "$(which kubectl)" "${kubedir}"/cluster/kubectl.sh
echo "#!/usr/bin/env bash" > "${test_wrapper}"
echo "cd $(pwd) && set -x" >> "${test_wrapper}"
echo "${E2E_SCRIPT} ${test_cmd_args}" >> "${test_wrapper}"
chmod +x "${test_wrapper}"
cd "${kubedir}"
# Create cluster and run the tests
create_test_cluster_with_retries "${CLUSTER_CREATION_ARGS[@]}" \
--test-cmd "${test_wrapper}" \
${extra_flags[@]} \
${EXTRA_KUBETEST_FLAGS[@]}
echo "Test subprocess exited with code $?"
create_test_cluster_with_retries "${E2E_SCRIPT} ${test_cmd_args}" \
"${CLUSTER_CREATION_ARGS[@]}" "${extra_flags[@]}"
local result="$?"
# Ignore any errors below, this is a best-effort cleanup and shouldn't affect the test result.
set +o errexit
function_exists cluster_teardown && cluster_teardown
local result=$(get_test_return_code)
echo "Artifacts were written to ${ARTIFACTS}"
echo "Test result code is ${result}"
exit "${result}"
}
# Retry backup regions/zones if cluster creations failed due to stockout.
# Parameters: $1..$n - any kubetest flags other than geo flag.
# Parameters: $1 - test command to run by the kubetest2 tester
# $2..$n - any other kubetest2 flags other than geo and cluster version flag.
function create_test_cluster_with_retries() {
local tester_command
IFS=' ' read -r -a tester_command <<< "$1"
local kubetest2_flags=( "${@:2}" )
local cluster_creation_log=/tmp/${E2E_BASE_NAME}-cluster_creation-log
# zone_not_provided is a placeholder for e2e_cluster_zone to make for loop below work
local zone_not_provided="zone_not_provided"
@ -304,7 +253,6 @@ function create_test_cluster_with_retries() {
echo "No backup region/zone set, cluster creation will fail in case of stockout"
fi
local e2e_cluster_target_version="${E2E_CLUSTER_VERSION}"
for e2e_cluster_region in "${e2e_cluster_regions[@]}"; do
for e2e_cluster_zone in "${e2e_cluster_zones[@]}"; do
E2E_CLUSTER_REGION=${e2e_cluster_region}
@ -312,18 +260,14 @@ function create_test_cluster_with_retries() {
[[ "${E2E_CLUSTER_ZONE}" == "${zone_not_provided}" ]] && E2E_CLUSTER_ZONE=""
local cluster_creation_zone="${E2E_CLUSTER_REGION}"
[[ -n "${E2E_CLUSTER_ZONE}" ]] && cluster_creation_zone="${E2E_CLUSTER_REGION}-${E2E_CLUSTER_ZONE}"
resolve_k8s_version "${e2e_cluster_target_version}" "${cluster_creation_zone}" || return 1
header "Creating test cluster ${E2E_CLUSTER_VERSION} in ${cluster_creation_zone}"
# Don't fail test for kubetest, as it might incorrectly report test failure
# if teardown fails (for details, see success() below)
set +o errexit
export CLUSTER_API_VERSION=${E2E_CLUSTER_VERSION}
run_go_tool k8s.io/test-infra/kubetest \
kubetest "$@" --gcp-region="${cluster_creation_zone}" 2>&1 | tee "${cluster_creation_log}"
# Exit if test succeeded
[[ "$(get_test_return_code)" == "0" ]] && return 0
if run_go_tool k8s-sigs.io/kubetest2 \
kubetest2 "${kubetest2_flags[@]}" --region="${cluster_creation_zone}" \
--test=exec -- "${tester_command[@]}" 2>&1 \
| tee "${cluster_creation_log}"; then
return 0
fi
# Retry if cluster creation failed because of:
# - stockout (https://github.com/knative/test-infra/issues/592)
# - latest GKE not available in this region/zone yet (https://github.com/knative/test-infra/issues/694)
@ -352,14 +296,17 @@ function setup_test_cluster() {
# Set the actual project the test cluster resides in
# It will be a project assigned by Boskos if test is running on Prow,
# otherwise will be ${GCP_PROJECT} set up by user.
export E2E_PROJECT_ID="$(gcloud config get-value project)"
E2E_PROJECT_ID="$(gcloud config get-value project)"
export E2E_PROJECT_ID
readonly E2E_PROJECT_ID
# Save some metadata about cluster creation for using in prow and testgrid
save_metadata
local k8s_user=$(gcloud config get-value core/account)
local k8s_cluster=$(kubectl config current-context)
local k8s_user
k8s_user=$(gcloud config get-value core/account)
local k8s_cluster
k8s_cluster=$(kubectl config current-context)
is_protected_cluster "${k8s_cluster}" && \
abort "kubeconfig context set to ${k8s_cluster}, which is forbidden"
@ -403,26 +350,8 @@ function setup_test_cluster() {
fi
}
# Gets the exit of the test script.
# For more details, see set_test_return_code().
function get_test_return_code() {
echo $(cat "${TEST_RESULT_FILE}")
}
# Set the return code that the test script will return.
# Parameters: $1 - return code (0-255)
function set_test_return_code() {
# kubetest teardown might fail and thus incorrectly report failure of the
# script, even if the tests pass.
# We store the real test result to return it later, ignoring any teardown
# failure in kubetest.
# TODO(adrcunha): Get rid of this workaround.
echo -n "$1"> "${TEST_RESULT_FILE}"
}
# Signal (as return code and in the logs) that all E2E tests passed.
function success() {
set_test_return_code 0
echo "**************************************"
echo "*** E2E TESTS PASSED ***"
echo "**************************************"
@ -433,7 +362,6 @@ function success() {
# Exit test, dumping current state info.
# Parameters: $1 - error message (optional).
function fail_test() {
set_test_return_code 1
[[ -n $1 ]] && echo "ERROR: $1"
dump_cluster_state
dump_metrics
@ -446,16 +374,14 @@ SKIP_ISTIO_ADDON=0
SKIP_TEARDOWNS=0
GCP_PROJECT=""
E2E_SCRIPT=""
E2E_CLUSTER_VERSION=""
E2E_CLUSTER_VERSION="latest"
GKE_ADDONS=""
EXTRA_CLUSTER_CREATION_FLAGS=()
EXTRA_KUBETEST_FLAGS=()
E2E_SCRIPT_CUSTOM_FLAGS=()
# Parse flags and initialize the test cluster.
function initialize() {
E2E_SCRIPT="$(get_canonical_path "$0")"
E2E_CLUSTER_VERSION="${SERVING_GKE_VERSION}"
cd "${REPO_ROOT_DIR}"
while [[ $# -ne 0 ]]; do
@ -486,8 +412,7 @@ function initialize() {
case ${parameter} in
--gcp-project) GCP_PROJECT=$1 ;;
--cluster-version) E2E_CLUSTER_VERSION=$1 ;;
--cluster-creation-flag) EXTRA_CLUSTER_CREATION_FLAGS+=($1) ;;
--kubetest-flag) EXTRA_KUBETEST_FLAGS+=($1) ;;
--cluster-creation-flag) EXTRA_CLUSTER_CREATION_FLAGS+=("$1") ;;
*) abort "unknown option ${parameter}" ;;
esac
esac
@ -511,7 +436,6 @@ function initialize() {
readonly GCP_PROJECT
readonly IS_BOSKOS
readonly EXTRA_CLUSTER_CREATION_FLAGS
readonly EXTRA_KUBETEST_FLAGS
readonly SKIP_KNATIVE_SETUP
readonly SKIP_TEARDOWNS
readonly GKE_ADDONS

View File

@ -21,10 +21,6 @@
# GCP project where all tests related resources live
readonly KNATIVE_TESTS_PROJECT=knative-tests
# Default GKE version to be used with Knative Serving
readonly SERVING_GKE_VERSION=gke-latest
readonly SERVING_GKE_IMAGE=cos
# Conveniently set GOPATH if unset
if [[ ! -v GOPATH ]]; then
export GOPATH="$(go env GOPATH)"
@ -408,10 +404,13 @@ function report_go_test() {
report="$(mktemp)"
local xml
xml="$(mktemp_with_extension "${ARTIFACTS}"/junit_XXXXXXXX xml)"
local json
json="$(mktemp_with_extension "${ARTIFACTS}"/json_XXXXXXXX json)"
echo "Running go test with args: ${go_test_args[*]}"
# TODO(chizhg): change to `--format testname`?
capture_output "${report}" gotestsum --format standard-verbose \
--junitfile "${xml}" --junitfile-testsuite-name relative --junitfile-testcase-classname relative \
--jsonfile "${json}" \
-- "${go_test_args[@]}"
local failed=$?
echo "Finished run, return code is ${failed}"
@ -550,6 +549,21 @@ function run_go_tool() {
${tool} "$@"
}
# Add function call to trap
# Parameters: $1 - Function to call
# $2...$n - Signals for trap
function add_trap {
local cmd=$1
shift
for trap_signal in "$@"; do
local current_trap
current_trap="$(trap -p "$trap_signal" | cut -d\' -f2)"
local new_cmd="($cmd)"
[[ -n "${current_trap}" ]] && new_cmd="${current_trap};${new_cmd}"
trap -- "${new_cmd}" "$trap_signal"
done
}
# Run kntest tool, error out and ask users to install it if it's not currently installed.
# Parameters: $1..$n - parameters passed to the tool.
function run_kntest() {

4
vendor/modules.txt vendored
View File

@ -752,7 +752,7 @@ k8s.io/kube-openapi/pkg/util/sets
k8s.io/utils/buffer
k8s.io/utils/integer
k8s.io/utils/trace
# knative.dev/pkg v0.0.0-20200810090030-095ff27da65c
# knative.dev/pkg v0.0.0-20200810223505-473bba04ee7f
## explicit
knative.dev/pkg/apis
knative.dev/pkg/apis/duck/ducktypes
@ -776,7 +776,7 @@ knative.dev/pkg/metrics/metricskey
knative.dev/pkg/network
knative.dev/pkg/reconciler
knative.dev/pkg/system
# knative.dev/test-infra v0.0.0-20200806191129-68b7defbd189
# knative.dev/test-infra v0.0.0-20200811030605-72f8c9f3e933
## explicit
knative.dev/test-infra/scripts
knative.dev/test-infra/tools/dep-collector