Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
[release-0.13] Auto-update dependencies (#146)
Browse files Browse the repository at this point in the history
Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign houshengbo k4leung4
/cc houshengbo k4leung4
  • Loading branch information
mattmoor authored Mar 19, 2020
1 parent 210e9e5 commit 2932fb9
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 32 deletions.
4 changes: 2 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions vendor/knative.dev/test-infra/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ integration tests).
Use the flags `--build-tests`, `--unit-tests` and `--integration-tests` to run a
specific set of tests.

To run a specific program as a test, use the `--run-test` flag, and provide the
To run specific programs as a test, use the `--run-test` flag, and provide the
program as the argument. If arguments are required for the program, pass
everything as a single quotes argument. For example,
`./presubmit-tests.sh --run-test "test/my/test data"`.
`./presubmit-tests.sh --run-test "test/my/test data"`. This flag can be used
repeatedly, and each one will be ran in sequential order.

The script will automatically skip all presubmit tests for PRs where all changed
files are exempt of tests (e.g., a PR changing only the `OWNERS` file).
Expand Down
7 changes: 7 additions & 0 deletions vendor/knative.dev/test-infra/scripts/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,13 @@ function capture_output() {
return ${failed}
}

# Print failed step, which could be highlighted by spyglass.
# Parameters: $1...n - description of step that failed
function step_failed() {
local spyglass_token="Step failed:"
echo "${spyglass_token} $@"
}

# Create a temporary file with the given extension in a way that works on both Linux and macOS.
# Parameters: $1 - file name without extension (e.g. 'myfile_XXXX')
# $2 - file extension (e.g. 'xml')
Expand Down
61 changes: 33 additions & 28 deletions vendor/knative.dev/test-infra/scripts/presubmit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,19 @@ function run_build_tests() {
local failed=0
# Run pre-build tests, if any
if function_exists pre_build_tests; then
pre_build_tests || failed=1
pre_build_tests || { failed=1; step_failed "pre_build_tests"; }
fi
# Don't run build tests if pre-build tests failed
if (( ! failed )); then
if function_exists build_tests; then
build_tests || failed=1
build_tests || { failed=1; step_failed "build_tests"; }
else
default_build_test_runner || failed=1
default_build_test_runner || { failed=1; step_failed "default_build_test_runner"; }
fi
fi
# Don't run post-build tests if pre/build tests failed
if (( ! failed )) && function_exists post_build_tests; then
post_build_tests || failed=1
post_build_tests || { failed=1; step_failed "post_build_tests"; }
fi
results_banner "Build" ${failed}
return ${failed}
Expand Down Expand Up @@ -147,14 +147,20 @@ function markdown_build_tests() {

# Default build test runner that:
# * check markdown files
# * `go build` on the entire repo
# * run `/hack/verify-codegen.sh` (if it exists)
# * `go build` on the entire repo
# * check licenses in all go packages
function default_build_test_runner() {
local failed=0
# Perform markdown build checks first
# Perform markdown build checks
markdown_build_tests || failed=1
# For documentation PRs, just check the md files
# Run verify-codegen check
if [[ -f ./hack/verify-codegen.sh ]]; then
subheader "Checking autogenerated code is up-to-date"
report_build_test Verify_CodeGen ./hack/verify-codegen.sh || failed=1
fi
# For documentation PRs, just check the md files and run
# verify-codegen (as md files can be auto-generated in some repos).
(( IS_DOCUMENTATION_PR )) && return ${failed}
# Don't merge these two lines, or return code will always be 0.
local go_pkg_dirs
Expand Down Expand Up @@ -186,13 +192,9 @@ function default_build_test_runner() {
# Remove unused generated binary, if any.
rm -f e2e.test
done

local errors_go="$(echo -e "${errors_go1}\n${errors_go2}" | uniq)"
create_junit_xml _build_tests Build_Go "${errors_go}"
if [[ -f ./hack/verify-codegen.sh ]]; then
subheader "Checking autogenerated code is up-to-date"
report_build_test Verify_CodeGen ./hack/verify-codegen.sh || failed=1
fi
# Check that we don't have any forbidden licenses in our images.
subheader "Checking for forbidden licenses"
report_build_test Check_Licenses check_licenses ${go_pkg_dirs} || failed=1
Expand All @@ -211,19 +213,19 @@ function run_unit_tests() {
local failed=0
# Run pre-unit tests, if any
if function_exists pre_unit_tests; then
pre_unit_tests || failed=1
pre_unit_tests || { failed=1; step_failed "pre_unit_tests"; }
fi
# Don't run unit tests if pre-unit tests failed
if (( ! failed )); then
if function_exists unit_tests; then
unit_tests || failed=1
unit_tests || { failed=1; step_failed "unit_tests"; }
else
default_unit_test_runner || failed=1
default_unit_test_runner || { failed=1; step_failed "default_unit_test_runner"; }
fi
fi
# Don't run post-unit tests if pre/unit tests failed
if (( ! failed )) && function_exists post_unit_tests; then
post_unit_tests || failed=1
post_unit_tests || { failed=1; step_failed "post_unit_tests"; }
fi
results_banner "Unit" ${failed}
return ${failed}
Expand All @@ -247,19 +249,19 @@ function run_integration_tests() {
local failed=0
# Run pre-integration tests, if any
if function_exists pre_integration_tests; then
pre_integration_tests || failed=1
pre_integration_tests || { failed=1; step_failed "pre_integration_tests"; }
fi
# Don't run integration tests if pre-integration tests failed
if (( ! failed )); then
if function_exists integration_tests; then
integration_tests || failed=1
integration_tests || { failed=1; step_failed "integration_tests"; }
else
default_integration_test_runner || failed=1
default_integration_test_runner || { failed=1; step_failed "default_integration_test_runner"; }
fi
fi
# Don't run integration tests if pre/integration tests failed
if (( ! failed )) && function_exists post_integration_tests; then
post_integration_tests || failed=1
post_integration_tests || { failed=1; step_failed "post_integration_tests"; }
fi
results_banner "Integration" ${failed}
return ${failed}
Expand All @@ -273,6 +275,7 @@ function default_integration_test_runner() {
echo "Running integration test ${e2e_test}"
if ! ${e2e_test} ${options}; then
failed=1
step_failed "${e2e_test} ${options}"
fi
done
return ${failed}
Expand Down Expand Up @@ -325,7 +328,7 @@ function main() {

[[ -z $1 ]] && set -- "--all-tests"

local TEST_TO_RUN=""
local TESTS_TO_RUN=()

while [[ $# -ne 0 ]]; do
local parameter=$1
Expand All @@ -341,7 +344,7 @@ function main() {
--run-test)
shift
[[ $# -ge 1 ]] || abort "missing executable after --run-test"
TEST_TO_RUN="$1"
TESTS_TO_RUN+=("$1")
;;
*) abort "error: unknown option ${parameter}" ;;
esac
Expand All @@ -351,15 +354,15 @@ function main() {
readonly RUN_BUILD_TESTS
readonly RUN_UNIT_TESTS
readonly RUN_INTEGRATION_TESTS
readonly TEST_TO_RUN
readonly TESTS_TO_RUN

cd ${REPO_ROOT_DIR}

# Tests to be performed, in the right order if --all-tests is passed.

local failed=0

if [[ -n "${TEST_TO_RUN}" ]]; then
if [[ ${#TESTS_TO_RUN[@]} > 0 ]]; then
if (( RUN_BUILD_TESTS || RUN_UNIT_TESTS || RUN_INTEGRATION_TESTS )); then
abort "--run-test must be used alone"
fi
Expand All @@ -368,17 +371,19 @@ function main() {
header "Documentation only PR, skipping running custom test"
exit 0
fi
${TEST_TO_RUN} || failed=1
for test_to_run in "${TESTS_TO_RUN[@]}"; do
${test_to_run} || { failed=1; step_failed "${test_to_run}"; }
done
fi

run_build_tests || failed=1
run_build_tests || { failed=1; step_failed "run_build_tests"; }
# If PRESUBMIT_TEST_FAIL_FAST is set to true, don't run unit tests if build tests failed
if (( ! PRESUBMIT_TEST_FAIL_FAST )) || (( ! failed )); then
run_unit_tests || failed=1
run_unit_tests || { failed=1; step_failed "run_unit_tests"; }
fi
# If PRESUBMIT_TEST_FAIL_FAST is set to true, don't run integration tests if build/unit tests failed
if (( ! PRESUBMIT_TEST_FAIL_FAST )) || (( ! failed )); then
run_integration_tests || failed=1
run_integration_tests || { failed=1; step_failed "run_integration_tests"; }
fi

exit ${failed}
Expand Down

0 comments on commit 2932fb9

Please sign in to comment.