Skip to content

Commit

Permalink
Add ability to run cucushift tests in serial
Browse files Browse the repository at this point in the history
  • Loading branch information
liangxia committed May 15, 2024
1 parent bbb1221 commit 113db7a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
44 changes: 28 additions & 16 deletions ci-operator/step-registry/cucushift/e2e/cucushift-e2e-commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -256,23 +256,35 @@ function test_execution_cucumber() {
set +x
}
function test_execution_default() {
# run normal tests in parallel
export BUSHSLICER_REPORT_DIR="${ARTIFACT_DIR}/parallel-normal"
SECONDS=0
parallel_cucumber -n "${PARALLEL}" ${PARALLEL_CUCUMBER_OPTIONS} --exec \
'export OPENSHIFT_ENV_OCP4_USER_MANAGER_USERS=$(echo ${USERS} | cut -d "," -f ${TEST_ENV_NUMBER},$((${TEST_ENV_NUMBER}+${PARALLEL})),$((${TEST_ENV_NUMBER}+${PARALLEL}*2)),$((${TEST_ENV_NUMBER}+${PARALLEL}*3)));
export WORKSPACE=/tmp/dir${TEST_ENV_NUMBER};
parallel_cucumber --group-by found --only-group ${TEST_ENV_NUMBER} -o "--tags \"${E2E_RUN_TAGS} and not @serial and not @console and not @admin\" -p junit"' || true
show_test_execution_time 'normal'
if [[ "${PARALLEL}" = '0' ]] || [[ "${PARALLEL}" = '1' ]] ; then
# run normal tests in serial
SECONDS=0
test_execution_cucumber 'normal' 'not @serial and not @console and not @admin'
show_test_execution_time 'normal'

# run admin tests in parallel
export BUSHSLICER_REPORT_DIR="${ARTIFACT_DIR}/parallel-admin"
SECONDS=0
parallel_cucumber -n "${PARALLEL}" ${PARALLEL_CUCUMBER_OPTIONS} --exec \
'export OPENSHIFT_ENV_OCP4_USER_MANAGER_USERS=$(echo ${USERS} | cut -d "," -f ${TEST_ENV_NUMBER},$((${TEST_ENV_NUMBER}+${PARALLEL})),$((${TEST_ENV_NUMBER}+${PARALLEL}*2)),$((${TEST_ENV_NUMBER}+${PARALLEL}*3)));
export WORKSPACE=/tmp/dir${TEST_ENV_NUMBER};
parallel_cucumber --group-by found --only-group ${TEST_ENV_NUMBER} -o "--tags \"${E2E_RUN_TAGS} and not @serial and not @console and @admin\" -p junit"' || true
show_test_execution_time 'admin'
# run admin tests in serial
SECONDS=0
test_execution_cucumber 'admin' 'not @serial and not @console and @admin'
show_test_execution_time 'admin'
else
# run normal tests in parallel
SECONDS=0
export BUSHSLICER_REPORT_DIR="${ARTIFACT_DIR}/parallel-normal"
parallel_cucumber -n "${PARALLEL}" ${PARALLEL_CUCUMBER_OPTIONS} --exec \
'export OPENSHIFT_ENV_OCP4_USER_MANAGER_USERS=$(echo ${USERS} | cut -d "," -f ${TEST_ENV_NUMBER},$((${TEST_ENV_NUMBER}+${PARALLEL})),$((${TEST_ENV_NUMBER}+${PARALLEL}*2)),$((${TEST_ENV_NUMBER}+${PARALLEL}*3)));
export WORKSPACE=/tmp/dir${TEST_ENV_NUMBER};
parallel_cucumber --group-by found --only-group ${TEST_ENV_NUMBER} -o "--tags \"${E2E_RUN_TAGS} and not @serial and not @console and not @admin\" -p junit"' || true
show_test_execution_time 'normal'

# run admin tests in parallel
SECONDS=0
export BUSHSLICER_REPORT_DIR="${ARTIFACT_DIR}/parallel-admin"
parallel_cucumber -n "${PARALLEL}" ${PARALLEL_CUCUMBER_OPTIONS} --exec \
'export OPENSHIFT_ENV_OCP4_USER_MANAGER_USERS=$(echo ${USERS} | cut -d "," -f ${TEST_ENV_NUMBER},$((${TEST_ENV_NUMBER}+${PARALLEL})),$((${TEST_ENV_NUMBER}+${PARALLEL}*2)),$((${TEST_ENV_NUMBER}+${PARALLEL}*3)));
export WORKSPACE=/tmp/dir${TEST_ENV_NUMBER};
parallel_cucumber --group-by found --only-group ${TEST_ENV_NUMBER} -o "--tags \"${E2E_RUN_TAGS} and not @serial and not @console and @admin\" -p junit"' || true
show_test_execution_time 'admin'
fi

# run the rest tests in serial
SECONDS=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ ref:
* 'ui' - Test cases with console tag
- name: PARALLEL
default: "11"
documentation: The number of parallel process to run cucushift tests
documentation: The number of parallel process to run cucushift tests.
If set to 0 or 1, then run the tests in serial.

0 comments on commit 113db7a

Please sign in to comment.