Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{AKS} Update live test pipeline to support backward compatibility tests #4040

Merged
merged 2 commits into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
207 changes: 138 additions & 69 deletions src/aks-preview/azcli_aks_live_test/scripts/test_ext_live.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ set -o xtrace
[[ -z "${EXT_TEST_MATRIX}" ]] && (echo "EXT_TEST_MATRIX is empty")
[[ -z "${EXT_TEST_FILTER}" ]] && (echo "EXT_TEST_FILTER is empty")
[[ -z "${EXT_TEST_COVERAGE}" ]] && (echo "EXT_TEST_COVERAGE is empty")
[[ -z "${BACKWARD_COMPATIBILITY_TEST}" ]] && (echo "BACKWARD_COMPATIBILITY_TEST is empty")
[[ -z "${CLI_TEST_MATRIX}" ]] && (echo "CLI_TEST_MATRIX is empty")
[[ -z "${CLI_TEST_FILTER}" ]] && (echo "CLI_TEST_FILTER is empty")
[[ -z "${CLI_TEST_COVERAGE}" ]] && (echo "CLI_TEST_COVERAGE is empty")

# activate virtualenv
source azEnv/bin/activate
Expand All @@ -29,82 +33,147 @@ az login --service-principal -u "${AZCLI_ALT_CLIENT_ID}" -p "${AZCLI_ALT_CLIENT_
az account set -s "${AZCLI_ALT_SUBSCRIPTION_ID}"
az account show

# prepare running options
# base options
base_options="-e --no-exitfirst --report-path ./reports --reruns 3 --capture=sys"
# parallel
if [[ ${PARALLELISM} -ge 2 ]]; then
base_options+=" -j ${PARALLELISM}"
else
base_options+=" -s"
fi
if [[ -z ${BACKWARD_COMPATIBILITY_TEST} || ${BACKWARD_COMPATIBILITY_TEST} != "only" ]]; then
# prepare running options
# base options
base_options="-e --no-exitfirst --report-path ./reports --reruns 3 --capture=sys"
# parallel
if [[ ${PARALLELISM} -ge 2 ]]; then
base_options+=" -j ${PARALLELISM}"
else
base_options+=" -s"
fi

# filter options
filter_options=""
# ext matrix
if [[ -n ${EXT_TEST_MATRIX} ]]; then
filter_options+=" -em ./configs/${EXT_TEST_MATRIX}"
fi
# ext extra filter
if [[ -n ${EXT_TEST_FILTER} ]]; then
filter_options+=" -ef ${EXT_TEST_FILTER}"
fi
# ext extra coverage
if [[ -n ${EXT_TEST_COVERAGE} ]]; then
filter_options+=" -ec ${EXT_TEST_COVERAGE}"
fi
# filter options
filter_options=""
# ext matrix
if [[ -n ${EXT_TEST_MATRIX} ]]; then
filter_options+=" -em ./configs/${EXT_TEST_MATRIX}"
fi
# ext extra filter
if [[ -n ${EXT_TEST_FILTER} ]]; then
filter_options+=" -ef ${EXT_TEST_FILTER}"
fi
# ext extra coverage
if [[ -n ${EXT_TEST_COVERAGE} ]]; then
filter_options+=" -ec ${EXT_TEST_COVERAGE}"
fi

# recording test
if [[ ${TEST_MODE} == "recording" || ${TEST_MODE} == "all" ]]; then
echo "Test in recording mode!"
coverage_options=" -ec test_aks_commands.AzureKubernetesServiceScenarioTest"
recording_options="${base_options}${coverage_options}"
recording_options+=" --json-report-file=ext_recording_report.json"
recording_options+=" --xml-file=ext_recording_result.xml"
echo "Recording test options: ${recording_options}"
test_result=0
azaks ${recording_options} || test_result=$?
if [[ ${test_result} -ne 0 ]]; then
echo "Recording test failed!"
echo "Please refer to this wiki (https://dev.azure.com/msazure/CloudNativeCompute/_wiki/wikis/CloudNativeCompute.wiki/156735/AZCLI-AKS-Live-Unit-Test-Pipeline) for troubleshooting guidelines."
exit ${test_result}
else
echo -e "Recording test passed!\n\n"
# recording test
if [[ ${TEST_MODE} == "recording" || ${TEST_MODE} == "all" ]]; then
echo "Test in recording mode!"
coverage_options=" -ec test_aks_commands.AzureKubernetesServiceScenarioTest"
recording_options="${base_options}${coverage_options}"
recording_options+=" --json-report-file=ext_recording_report.json"
recording_options+=" --xml-file=ext_recording_result.xml"
echo "Recording test options: ${recording_options}"
test_result=0
azaks ${recording_options} || test_result=$?
if [[ ${test_result} -ne 0 ]]; then
echo "Recording test failed!"
echo "Please refer to this wiki (https://dev.azure.com/msazure/CloudNativeCompute/_wiki/wikis/CloudNativeCompute.wiki/156735/AZCLI-AKS-Live-Unit-Test-Pipeline) for troubleshooting guidelines."
exit ${test_result}
else
echo -e "Recording test passed!\n\n"
fi
fi
fi

# live test
if [[ ${TEST_MODE} == "live" || ${TEST_MODE} == "all" ]]; then
echo "Test in live mode!"
live_options="${base_options}${filter_options}"
live_options+=" -l --json-report-file=ext_live_report.json"
live_options+=" --xml-file=ext_live_result.xml"
echo "Live test options: ${live_options}"
test_result=0
azaks ${live_options} || test_result=$?
if [[ ${test_result} -ne 0 ]]; then
echo "Live test failed!"
echo "Please refer to this wiki (https://dev.azure.com/msazure/CloudNativeCompute/_wiki/wikis/CloudNativeCompute.wiki/156735/AZCLI-AKS-Live-Unit-Test-Pipeline) for troubleshooting guidelines."
exit ${test_result}
else
echo -e "Live test passed!\n\n"
# live test
if [[ ${TEST_MODE} == "live" || ${TEST_MODE} == "all" ]]; then
echo "Test in live mode!"
live_options="${base_options}${filter_options}"
live_options+=" -l --json-report-file=ext_live_report.json"
live_options+=" --xml-file=ext_live_result.xml"
echo "Live test options: ${live_options}"
test_result=0
azaks ${live_options} || test_result=$?
if [[ ${test_result} -ne 0 ]]; then
echo "Live test failed!"
echo "Please refer to this wiki (https://dev.azure.com/msazure/CloudNativeCompute/_wiki/wikis/CloudNativeCompute.wiki/156735/AZCLI-AKS-Live-Unit-Test-Pipeline) for troubleshooting guidelines."
exit ${test_result}
else
echo -e "Live test passed!\n\n"
fi
fi

# live-replay test
if [[ ${TEST_MODE} == "live" || ${TEST_MODE} == "all" ]]; then
echo "Test in live-replay mode!"
live_replay_options="${base_options}${filter_options}"
live_replay_options+=" --json-report-file=ext_live_replay_report.json"
live_replay_options+=" --xml-file=ext_live_replay_result.xml"
echo "Live-replay test options: ${live_replay_options}"
test_result=0
azaks ${live_replay_options} || test_result=$?
if [[ ${test_result} -ne 0 ]]; then
echo "Live-replay test failed!"
echo "Please refer to this wiki (https://dev.azure.com/msazure/CloudNativeCompute/_wiki/wikis/CloudNativeCompute.wiki/156735/AZCLI-AKS-Live-Unit-Test-Pipeline) for troubleshooting guidelines."
exit ${test_result}
else
echo -e "Live-replay test passed!\n\n"
fi
fi
fi

# live-replay test
if [[ ${TEST_MODE} == "live" || ${TEST_MODE} == "all" ]]; then
echo "Test in live-replay mode!"
live_replay_options="${base_options}${filter_options}"
live_replay_options+=" --json-report-file=ext_live_replay_report.json"
live_replay_options+=" --xml-file=ext_live_replay_result.xml"
echo "Live-replay test options: ${live_replay_options}"
test_result=0
azaks ${live_replay_options} || test_result=$?
if [[ ${test_result} -ne 0 ]]; then
echo "Live-replay test failed!"
echo "Please refer to this wiki (https://dev.azure.com/msazure/CloudNativeCompute/_wiki/wikis/CloudNativeCompute.wiki/156735/AZCLI-AKS-Live-Unit-Test-Pipeline) for troubleshooting guidelines."
exit ${test_result}
if [[ -n ${BACKWARD_COMPATIBILITY_TEST} ]]; then
# prepare running options
# base options
base_options="-c --no-exitfirst --report-path ./reports --reruns 3 --capture=sys"
# parallel
if [[ ${PARALLELISM} -ge 2 ]]; then
base_options+=" -j ${PARALLELISM}"
else
echo -e "Live-replay test passed!\n\n"
base_options+=" -s"
fi

# filter options
filter_options=""
# cli matrix
if [[ -n ${CLI_TEST_MATRIX} ]]; then
filter_options+=" -cm ./configs/${CLI_TEST_MATRIX}"
fi
# cli extra filter
if [[ -n ${CLI_TEST_FILTER} ]]; then
filter_options+=" -cf ${CLI_TEST_FILTER}"
fi
# cli extra coverage
if [[ -n ${CLI_TEST_COVERAGE} ]]; then
filter_options+=" -cc ${CLI_TEST_COVERAGE}"
fi

# live test
if [[ ${TEST_MODE} == "live" || ${TEST_MODE} == "all" ]]; then
echo "Backward Compatibility Test in live mode!"
live_options="${base_options}${filter_options}"
live_options+=" -l --json-report-file=bc_live_report.json"
live_options+=" --xml-file=bc_live_result.xml"
echo "Live test options: ${live_options}"
test_result=0
azaks ${live_options} || test_result=$?
if [[ ${test_result} -ne 0 ]]; then
echo "Backward Compatibility Live test failed!"
echo "Please refer to this wiki (https://dev.azure.com/msazure/CloudNativeCompute/_wiki/wikis/CloudNativeCompute.wiki/156735/AZCLI-AKS-Live-Unit-Test-Pipeline) for troubleshooting guidelines."
exit ${test_result}
else
echo -e "Backward Compatibility Live test passed!\n\n"
fi
fi

# live-replay test
if [[ ${TEST_MODE} == "live" || ${TEST_MODE} == "all" ]]; then
echo "Backward Compatibility Test in live-replay mode!"
live_replay_options="${base_options}${filter_options}"
live_replay_options+=" --json-report-file=bc_live_replay_report.json"
live_replay_options+=" --xml-file=bc_live_replay_result.xml"
echo "Live-replay test options: ${live_replay_options}"
test_result=0
azaks ${live_replay_options} || test_result=$?
if [[ ${test_result} -ne 0 ]]; then
echo "Backward Compatibility Live-replay test failed!"
echo "Please refer to this wiki (https://dev.azure.com/msazure/CloudNativeCompute/_wiki/wikis/CloudNativeCompute.wiki/156735/AZCLI-AKS-Live-Unit-Test-Pipeline) for troubleshooting guidelines."
exit ${test_result}
else
echo -e "Backward Compatibility Live-replay test passed!\n\n"
fi
fi
fi
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ set -o xtrace
[[ -z "${CLI_BRANCH}" ]] && (echo "CLI_BRANCH is empty"; exit 1)
[[ -z "${EXT_REPO}" ]] && (echo "EXT_REPO is empty"; exit 1)
[[ -z "${EXT_BRANCH}" ]] && (echo "EXT_BRANCH is empty"; exit 1)
[[ -z "${BACKWARD_COMPATIBILITY_TEST}" ]] && (echo "BACKWARD_COMPATIBILITY_TEST is empty")
# base directories for acs, aks-preview and live test
[[ -z "${ACS_BASE_DIR}" ]] && (echo "ACS_BASE_DIR is empty"; exit 1)
[[ -z "${AKS_PREVIEW_BASE_DIR}" ]] && (echo "AKS_PREVIEW_BASE_DIR is empty"; exit 1)
Expand Down Expand Up @@ -90,3 +91,6 @@ echo "CLI_REPO=${CLI_REPO}" >> env.list
echo "CLI_BRANCH=${CLI_BRANCH}" >> env.list
echo "EXT_REPO=${EXT_REPO}" >> env.list
echo "EXT_BRANCH=${EXT_BRANCH}" >> env.list

# backward compatibility
echo "BACKWARD_COMPATIBILITY_TEST=${BACKWARD_COMPATIBILITY_TEST}" >> env.list