mirror of https://github.com/knative/caching.git
upgrade to latest dependencies (#676)
bumping knative.dev/hack 664eac5...6c30196:
> 6c30196 🧹 Rewrite unit tests in Golang (# 215)
> f9dc722 Format go code (# 218)
Signed-off-by: Knative Automation <automation@knative.team>
Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
parent
5966a73a91
commit
1bb985299a
2
go.mod
2
go.mod
|
@ -11,7 +11,7 @@ require (
|
||||||
k8s.io/client-go v0.23.9
|
k8s.io/client-go v0.23.9
|
||||||
k8s.io/code-generator v0.23.9
|
k8s.io/code-generator v0.23.9
|
||||||
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65
|
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65
|
||||||
knative.dev/hack v0.0.0-20220902220419-664eac5c391e
|
knative.dev/hack v0.0.0-20220907111718-6c301965af4c
|
||||||
knative.dev/pkg v0.0.0-20220826162920-93b66e6a8700
|
knative.dev/pkg v0.0.0-20220826162920-93b66e6a8700
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -856,8 +856,8 @@ k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
|
||||||
k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||||
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19Vz2GdbOCyI4qqhc=
|
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19Vz2GdbOCyI4qqhc=
|
||||||
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||||
knative.dev/hack v0.0.0-20220902220419-664eac5c391e h1:9l6GKXiwXuiU8z7/AQIF6oBFISu8geBVQltjKshh+fk=
|
knative.dev/hack v0.0.0-20220907111718-6c301965af4c h1:TTVBodIukkW7CUXSep9k/nc+nynXbjkBqXyYZxIS9Jw=
|
||||||
knative.dev/hack v0.0.0-20220902220419-664eac5c391e/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
|
knative.dev/hack v0.0.0-20220907111718-6c301965af4c/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
|
||||||
knative.dev/pkg v0.0.0-20220826162920-93b66e6a8700 h1:6xjS69vf5Pbwu+dWckqPALmm5pc3p0/XScPpRBhugRc=
|
knative.dev/pkg v0.0.0-20220826162920-93b66e6a8700 h1:6xjS69vf5Pbwu+dWckqPALmm5pc3p0/XScPpRBhugRc=
|
||||||
knative.dev/pkg v0.0.0-20220826162920-93b66e6a8700/go.mod h1:WIQZyPTLzT+z0V3/gB91aWugIi3E1mkU9rjCrLfjOwY=
|
knative.dev/pkg v0.0.0-20220826162920-93b66e6a8700/go.mod h1:WIQZyPTLzT+z0V3/gB91aWugIi3E1mkU9rjCrLfjOwY=
|
||||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||||
|
|
|
@ -76,7 +76,7 @@ function setup_test_cluster() {
|
||||||
# Setup KO_DOCKER_REPO if it is a GKE cluster. Incorporate an element of
|
# Setup KO_DOCKER_REPO if it is a GKE cluster. Incorporate an element of
|
||||||
# randomness to ensure that each run properly publishes images. Don't
|
# randomness to ensure that each run properly publishes images. Don't
|
||||||
# owerwrite KO_DOCKER_REPO if already set.
|
# owerwrite KO_DOCKER_REPO if already set.
|
||||||
[ -z "${KO_DOCKER_REPO}" ] && \
|
[ -z "${KO_DOCKER_REPO:-}" ] && \
|
||||||
[[ "${k8s_cluster}" =~ ^gke_.* ]] && \
|
[[ "${k8s_cluster}" =~ ^gke_.* ]] && \
|
||||||
export KO_DOCKER_REPO=gcr.io/${E2E_PROJECT_ID}/${REPO_NAME}-e2e-img/${RANDOM}
|
export KO_DOCKER_REPO=gcr.io/${E2E_PROJECT_ID}/${REPO_NAME}-e2e-img/${RANDOM}
|
||||||
|
|
||||||
|
@ -120,12 +120,14 @@ function success() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Exit test, dumping current state info.
|
# Exit test, dumping current state info.
|
||||||
# Parameters: $1 - error message (optional).
|
# Parameters: $* - error message (optional).
|
||||||
function fail_test() {
|
function fail_test() {
|
||||||
[[ -n $1 ]] && echo "ERROR: $1"
|
local message="$*"
|
||||||
dump_cluster_state
|
if [[ -n ${message:-} ]]; then
|
||||||
dump_metrics
|
message='test failed'
|
||||||
exit 1
|
fi
|
||||||
|
add_trap "dump_cluster_state;dump_metrics" EXIT
|
||||||
|
abort "${message}"
|
||||||
}
|
}
|
||||||
|
|
||||||
SKIP_TEARDOWNS=0
|
SKIP_TEARDOWNS=0
|
||||||
|
|
|
@ -91,8 +91,8 @@ function create_test_cluster() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
gke) create_gke_test_cluster "$2" "$3" "$4" ;;
|
gke) create_gke_test_cluster "$2" "$3" "${4:-}" ;;
|
||||||
kind) create_kind_test_cluster "$2" "$3" "$4" ;;
|
kind) create_kind_test_cluster "$2" "$3" "${4:-}" ;;
|
||||||
*) echo "unsupported provider: $1"; exit 1 ;;
|
*) echo "unsupported provider: $1"; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -126,11 +126,11 @@ function create_gke_test_cluster() {
|
||||||
# We are disabling logs and metrics on Boskos Clusters by default as they are not used. Manually set ENABLE_GKE_TELEMETRY to true to enable telemetry
|
# We are disabling logs and metrics on Boskos Clusters by default as they are not used. Manually set ENABLE_GKE_TELEMETRY to true to enable telemetry
|
||||||
# and ENABLE_PREEMPTIBLE_NODES to true to create preemptible/spot VMs. VM Preemption is a rare event and shouldn't be distruptive given the fault tolerant nature of our tests.
|
# and ENABLE_PREEMPTIBLE_NODES to true to create preemptible/spot VMs. VM Preemption is a rare event and shouldn't be distruptive given the fault tolerant nature of our tests.
|
||||||
local extra_gcloud_flags=""
|
local extra_gcloud_flags=""
|
||||||
if [[ "$ENABLE_GKE_TELEMETRY" != "true" ]]; then
|
if [[ "${ENABLE_GKE_TELEMETRY:-}" != "true" ]]; then
|
||||||
extra_gcloud_flags="${extra_gcloud_flags} --logging=NONE --monitoring=NONE"
|
extra_gcloud_flags="${extra_gcloud_flags} --logging=NONE --monitoring=NONE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$ENABLE_PREEMPTIBLE_NODES" == "true" ]]; then
|
if [[ "${ENABLE_PREEMPTIBLE_NODES:-}" == "true" ]]; then
|
||||||
extra_gcloud_flags="${extra_gcloud_flags} --preemptible"
|
extra_gcloud_flags="${extra_gcloud_flags} --preemptible"
|
||||||
fi
|
fi
|
||||||
run_kntest kubetest2 gke "${_custom_flags[@]}" --test-command="${_test_command[*]}" --extra-gcloud-flags="${extra_gcloud_flags}"
|
run_kntest kubetest2 gke "${_custom_flags[@]}" --test-command="${_test_command[*]}" --extra-gcloud-flags="${extra_gcloud_flags}"
|
||||||
|
|
|
@ -40,7 +40,19 @@ fi
|
||||||
readonly IS_PROW
|
readonly IS_PROW
|
||||||
[[ ! -v REPO_ROOT_DIR ]] && REPO_ROOT_DIR="$(git rev-parse --show-toplevel)"
|
[[ ! -v REPO_ROOT_DIR ]] && REPO_ROOT_DIR="$(git rev-parse --show-toplevel)"
|
||||||
readonly REPO_ROOT_DIR
|
readonly REPO_ROOT_DIR
|
||||||
readonly REPO_NAME="${REPO_NAME:-$(basename "${REPO_ROOT_DIR}")}"
|
|
||||||
|
# Resolves the repository name given a root directory.
|
||||||
|
# Parameters: $1 - repository root directory.
|
||||||
|
function __resolveRepoName() {
|
||||||
|
local repoName
|
||||||
|
repoName="$(basename "${1:-$(git rev-parse --show-toplevel)}")"
|
||||||
|
repoName="${repoName#knative-sandbox-}" # Remove knative-sandbox- prefix if any
|
||||||
|
repoName="${repoName#knative-}" # Remove knative- prefix if any
|
||||||
|
echo "${repoName}"
|
||||||
|
}
|
||||||
|
default_repo_name="$(__resolveRepoName "${REPO_ROOT_DIR}")"
|
||||||
|
readonly REPO_NAME="${REPO_NAME:-$default_repo_name}"
|
||||||
|
unset default_repo_name
|
||||||
|
|
||||||
# Useful flags about the current OS
|
# Useful flags about the current OS
|
||||||
IS_LINUX=0
|
IS_LINUX=0
|
||||||
|
@ -65,10 +77,6 @@ if [[ -z "${ARTIFACTS:-}" ]]; then
|
||||||
fi
|
fi
|
||||||
mkdir -p "$ARTIFACTS"
|
mkdir -p "$ARTIFACTS"
|
||||||
|
|
||||||
|
|
||||||
# On a Prow job, redirect stderr to stdout so it's synchronously added to log
|
|
||||||
(( IS_PROW )) && exec 2>&1
|
|
||||||
|
|
||||||
# Return the major version of a release.
|
# Return the major version of a release.
|
||||||
# For example, "v0.2.1" returns "0"
|
# For example, "v0.2.1" returns "0"
|
||||||
# Parameters: $1 - release version label.
|
# Parameters: $1 - release version label.
|
||||||
|
@ -94,11 +102,49 @@ function patch_version() {
|
||||||
echo "${tokens[2]}"
|
echo "${tokens[2]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print error message and exit 1
|
# Calculates the hashcode for a given string.
|
||||||
|
# Parameters: $* - string to be hashed.
|
||||||
|
# See: https://stackoverflow.com/a/48863502/844449
|
||||||
|
function hashCode() {
|
||||||
|
local input="$1"
|
||||||
|
local -i h=0
|
||||||
|
for ((i = 0; i < ${#input}; i++)); do
|
||||||
|
# val is ASCII val
|
||||||
|
printf -v val "%d" "'${input:$i:1}"
|
||||||
|
hval=$((31 * h + val))
|
||||||
|
# hash scheme
|
||||||
|
if ((hval > 2147483647)); then
|
||||||
|
h=$(( (hval - 2147483648) % 2147483648 ))
|
||||||
|
elif ((hval < -2147483648)); then
|
||||||
|
h=$(( (hval + 2147483648) % 2147483648 ))
|
||||||
|
else
|
||||||
|
h=$(( hval ))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# final hashCode in decimal
|
||||||
|
printf "%d" $h
|
||||||
|
}
|
||||||
|
|
||||||
|
# Calculates the retcode for a given string. Makes sure the return code is
|
||||||
|
# non-zero.
|
||||||
|
# Parameters: $* - string to be hashed.
|
||||||
|
function calcRetcode() {
|
||||||
|
local rc=1
|
||||||
|
local rcc
|
||||||
|
rcc="$(hashCode "$*")"
|
||||||
|
if [[ $rcc != 0 ]]; then
|
||||||
|
rc=$(( rcc % 255 ))
|
||||||
|
fi
|
||||||
|
echo "$rc"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Print error message and call exit(n) where n calculated from the error message.
|
||||||
# Parameters: $1..$n - error message to be displayed
|
# Parameters: $1..$n - error message to be displayed
|
||||||
|
# Globals: abort_retcode will change the default retcode to be returned
|
||||||
function abort() {
|
function abort() {
|
||||||
echo "error: $*" >&2
|
make_banner '*' "ERROR: $*" >&2
|
||||||
exit 1
|
readonly abort_retcode="${abort_retcode:-$(calcRetcode "$*")}"
|
||||||
|
exit "$abort_retcode"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Display a box banner.
|
# Display a box banner.
|
||||||
|
@ -106,11 +152,13 @@ function abort() {
|
||||||
# $2 - banner message.
|
# $2 - banner message.
|
||||||
function make_banner() {
|
function make_banner() {
|
||||||
local msg="$1$1$1$1 $2 $1$1$1$1"
|
local msg="$1$1$1$1 $2 $1$1$1$1"
|
||||||
local border="${msg//[-0-9A-Za-z _.,\/()\']/$1}"
|
local border="${msg//[^$1]/$1}"
|
||||||
echo -e "${border}\n${msg}\n${border}"
|
echo -e "${border}\n${msg}\n${border}"
|
||||||
# TODO(adrcunha): Remove once logs have timestamps on Prow
|
# TODO(adrcunha): Remove once logs have timestamps on Prow
|
||||||
# For details, see https://github.com/kubernetes/test-infra/issues/10100
|
# For details, see https://github.com/kubernetes/test-infra/issues/10100
|
||||||
echo -e "$1$1$1$1 $(TZ='UTC' date)\n${border}"
|
if (( IS_PROW )); then
|
||||||
|
echo -e "$1$1$1$1 $(TZ='UTC' date --rfc-3339=ns)\n${border}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Simple header for logging purposes.
|
# Simple header for logging purposes.
|
||||||
|
@ -126,7 +174,7 @@ function subheader() {
|
||||||
|
|
||||||
# Simple warning banner for logging purposes.
|
# Simple warning banner for logging purposes.
|
||||||
function warning() {
|
function warning() {
|
||||||
make_banner '!' "$*" >&2
|
make_banner '!' "WARN: $*" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
# Checks whether the given function exists.
|
# Checks whether the given function exists.
|
||||||
|
@ -448,14 +496,14 @@ function report_go_test() {
|
||||||
logfile="${xml/junit_/go_test_}"
|
logfile="${xml/junit_/go_test_}"
|
||||||
logfile="${logfile/.xml/.jsonl}"
|
logfile="${logfile/.xml/.jsonl}"
|
||||||
echo "Running go test with args: ${go_test_args[*]}"
|
echo "Running go test with args: ${go_test_args[*]}"
|
||||||
|
local gotest_retcode=0
|
||||||
go_run gotest.tools/gotestsum@v1.8.0 \
|
go_run gotest.tools/gotestsum@v1.8.0 \
|
||||||
--format "${GO_TEST_VERBOSITY:-testname}" \
|
--format "${GO_TEST_VERBOSITY:-testname}" \
|
||||||
--junitfile "${xml}" \
|
--junitfile "${xml}" \
|
||||||
--junitfile-testsuite-name relative \
|
--junitfile-testsuite-name relative \
|
||||||
--junitfile-testcase-classname relative \
|
--junitfile-testcase-classname relative \
|
||||||
--jsonfile "${logfile}" \
|
--jsonfile "${logfile}" \
|
||||||
-- "${go_test_args[@]}"
|
-- "${go_test_args[@]}" || gotest_retcode=$?
|
||||||
local gotest_retcode=$?
|
|
||||||
echo "Finished run, return code is ${gotest_retcode}"
|
echo "Finished run, return code is ${gotest_retcode}"
|
||||||
|
|
||||||
echo "XML report written to ${xml}"
|
echo "XML report written to ${xml}"
|
||||||
|
@ -558,6 +606,9 @@ function go_run() {
|
||||||
if [[ "$package" != *@* ]]; then
|
if [[ "$package" != *@* ]]; then
|
||||||
abort 'Package for "go_run" needs to have @version'
|
abort 'Package for "go_run" needs to have @version'
|
||||||
fi
|
fi
|
||||||
|
if [[ "$package" == *@latest ]] && [[ "$package" != knative.dev* ]]; then
|
||||||
|
warning 'Using @latest version for external dependencies is unsafe. Use numbered version!'
|
||||||
|
fi
|
||||||
shift 1
|
shift 1
|
||||||
GORUN_PATH="${GORUN_PATH:-$(go env GOPATH)}"
|
GORUN_PATH="${GORUN_PATH:-$(go env GOPATH)}"
|
||||||
# Some CI environments may have non-writable GOPATH
|
# Some CI environments may have non-writable GOPATH
|
||||||
|
|
|
@ -240,15 +240,14 @@ function run_integration_tests() {
|
||||||
# Default integration test runner that runs all `test/e2e-*tests.sh`.
|
# Default integration test runner that runs all `test/e2e-*tests.sh`.
|
||||||
function default_integration_test_runner() {
|
function default_integration_test_runner() {
|
||||||
local failed=0
|
local failed=0
|
||||||
find test/ ! -name "$(printf "*\n*")" -name "e2e-*tests.sh" -maxdepth 1 > tmp
|
|
||||||
while IFS= read -r e2e_test
|
while IFS= read -r e2e_test; do
|
||||||
do
|
|
||||||
echo "Running integration test ${e2e_test}"
|
echo "Running integration test ${e2e_test}"
|
||||||
if ! ${e2e_test}; then
|
if ! ${e2e_test}; then
|
||||||
failed=1
|
failed=1
|
||||||
step_failed "${e2e_test}"
|
step_failed "${e2e_test}"
|
||||||
fi
|
fi
|
||||||
done < tmp
|
done < <(find test/ ! -name "$(printf "*\n*")" -name "e2e-*tests.sh" -maxdepth 1)
|
||||||
return ${failed}
|
return ${failed}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,16 +283,16 @@ function main() {
|
||||||
git version
|
git version
|
||||||
echo ">> ko version"
|
echo ">> ko version"
|
||||||
[[ -f /ko_version ]] && cat /ko_version || echo "unknown"
|
[[ -f /ko_version ]] && cat /ko_version || echo "unknown"
|
||||||
if [[ "${DOCKER_IN_DOCKER_ENABLED}" == "true" ]]; then
|
if [[ "${DOCKER_IN_DOCKER_ENABLED:-}" == "true" ]]; then
|
||||||
echo ">> docker version"
|
echo ">> docker version"
|
||||||
docker version
|
docker version
|
||||||
fi
|
fi
|
||||||
if type java > /dev/null; then
|
if type java > /dev/null; then
|
||||||
echo ">> java version"
|
echo ">> java version"
|
||||||
java -version
|
java -version
|
||||||
echo "JAVA_HOME: $JAVA_HOME"
|
echo "JAVA_HOME: ${JAVA_HOME:-}"
|
||||||
fi
|
fi
|
||||||
if type mvn > /dev/null; then
|
if command -v mvn > /dev/null; then
|
||||||
echo ">> maven version"
|
echo ">> maven version"
|
||||||
mvn --version
|
mvn --version
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -674,7 +674,7 @@ k8s.io/utils/integer
|
||||||
k8s.io/utils/internal/third_party/forked/golang/net
|
k8s.io/utils/internal/third_party/forked/golang/net
|
||||||
k8s.io/utils/net
|
k8s.io/utils/net
|
||||||
k8s.io/utils/trace
|
k8s.io/utils/trace
|
||||||
# knative.dev/hack v0.0.0-20220902220419-664eac5c391e
|
# knative.dev/hack v0.0.0-20220907111718-6c301965af4c
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
knative.dev/hack
|
knative.dev/hack
|
||||||
# knative.dev/pkg v0.0.0-20220826162920-93b66e6a8700
|
# knative.dev/pkg v0.0.0-20220826162920-93b66e6a8700
|
||||||
|
|
Loading…
Reference in New Issue