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

[action] [PR:16708] Add BSL test suite functionality to run_tests.sh #16824

Open
wants to merge 1 commit into
base: 202411
Choose a base branch
from
Open
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
25 changes: 23 additions & 2 deletions tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function show_help_and_exit()
echo " -h -? : get this help"
echo " -a <True|False>: specify if auto-recover is allowed (default: True)"
echo " -b <master_id> : specify name of k8s master group used in k8s inventory, format: k8s_vms{msetnumber}_{servernumber}"
echo " -B : run BSL test suite"
echo " -c <testcases> : specify test cases to execute (default: none, executed all matched)"
echo " -d <dut name> : specify comma-separated DUT names (default: DUT name associated with testbed in testbed file)"
echo " -e <parameters>: specify extra parameter(s) (default: none)"
Expand Down Expand Up @@ -96,6 +97,7 @@ function setup_environment()

AUTO_RECOVER="True"
BYPASS_UTIL="False"
BSL="False"
CLI_LOG_LEVEL='warning'
EXTRA_PARAMETERS=""
FILE_LOG_LEVEL='debug'
Expand Down Expand Up @@ -246,6 +248,7 @@ function run_debug_tests()
echo "ANSIBLE_CONFIG: ${ANSIBLE_CONFIG}"
echo "ANSIBLE_LIBRARY: ${ANSIBLE_LIBRARY}"
echo "AUTO_RECOVER: ${AUTO_RECOVER}"
echo "BSL: ${BSL}"
echo "BYPASS_UTIL: ${BYPASS_UTIL}"
echo "CLI_LOG_LEVEL: ${CLI_LOG_LEVEL}"
echo "EXTRA_PARAMETERS: ${EXTRA_PARAMETERS}"
Expand Down Expand Up @@ -281,6 +284,9 @@ function pre_post_extra_params()
# It aims to verify common test cases work as expected under macsec links.
# At pre/post test stage, enabling macsec only wastes time and is not needed.
params=${params//--enable_macsec/}
if [[ x"${BSL}" == x"True" ]]; then
params="${params} --ignore=bgp --skip_sanity"
fi
echo $params
}

Expand Down Expand Up @@ -360,10 +366,17 @@ function run_individual_tests()
return ${EXIT_CODE}
}

function run_bsl_tests()
{
echo "=== Running BSL tests ==="
echo Running: python3 -m pytest ${PYTEST_COMMON_OPTS} --skip_sanity --disable_loganalyzer --junit-xml=logs/bsl.xml --log-file logs/bsl.log -m bsl
python3 -m pytest ${PYTEST_COMMON_OPTS} --skip_sanity --disable_loganalyzer --junit-xml=logs/bsl.xml --log-file logs/bsl.log -m bsl
}

setup_environment


while getopts "h?a:b:c:C:d:e:Ef:F:i:I:k:l:m:n:oOp:q:rs:S:t:ux" opt; do
while getopts "h?a:b:Bc:C:d:e:Ef:F:i:I:k:l:m:n:oOp:q:rs:S:t:ux" opt; do
case ${opt} in
h|\? )
show_help_and_exit 0
Expand All @@ -375,6 +388,9 @@ while getopts "h?a:b:c:C:d:e:Ef:F:i:I:k:l:m:n:oOp:q:rs:S:t:ux" opt; do
KUBE_MASTER_ID=${OPTARG}
SKIP_FOLDERS=${SKIP_FOLDERS//k8s/}
;;
B )
BSL="True"
;;
c )
TEST_CASES="${TEST_CASES} ${OPTARG}"
;;
Expand Down Expand Up @@ -469,7 +485,12 @@ if [[ x"${TEST_METHOD}" != x"debug" && x"${BYPASS_UTIL}" == x"False" ]]; then
fi

RC=0
run_${TEST_METHOD}_tests || RC=$?

if [[ x"${BSL}" == x"True" ]]; then
run_bsl_tests || RC=$?
else
run_${TEST_METHOD}_tests || RC=$?
fi

if [[ x"${TEST_METHOD}" != x"debug" && x"${BYPASS_UTIL}" == x"False" ]]; then
cleanup_dut
Expand Down
Loading