github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/engine/test/integration_tests/run_group.sh (about)

     1  #!/bin/bash
     2  
     3  set -eo pipefail
     4  
     5  CUR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
     6  
     7  group=$1
     8  group_num=${group#G}
     9  
    10  # Define groups
    11  # Note: If new group is added, the group name must also be added to CI
    12  # https://github.com/PingCAP-QE/ci/blob/main/pipelines/pingcap/tiflow/latest/pull_engine_integration_test.groovy
    13  # Each group of tests consumes as much time as possible, thus reducing CI waiting time.
    14  # Putting multiple light tests together and heavy tests in a separate group.
    15  groups=(
    16  	# G00
    17  	'dm_basic dm_case_sensitive dm_collation dm_dump_sync_mode'
    18  	# G01
    19  	'dm_full_mode dm_lightning_checkpoint dm_many_tables'
    20  	# G02
    21  	"dm_many_tables_local dm_new_collation_off dm_sql_mode"
    22  	# G03
    23  	"dm_tls e2e_fast_finished e2e_node_failure e2e_with_selectors"
    24  	# G04
    25  	"e2e_worker_error external_resource"
    26  )
    27  
    28  # Get other cases not in groups, to avoid missing any case
    29  others=()
    30  for script in "$CUR"/*/run.sh; do
    31  	test_name="$(basename "$(dirname "$script")")"
    32  	# shellcheck disable=SC2076
    33  	if [[ ! " ${groups[*]} " =~ " ${test_name} " ]]; then
    34  		others=("${others[@]} ${test_name}")
    35  	fi
    36  done
    37  
    38  if [[ "$group" == "check others" ]]; then
    39  	if [[ -z $others ]]; then
    40  		echo "All engine integration test cases are added to groups"
    41  		exit 0
    42  	fi
    43  	echo "Error: "$others" is not added to any group in engine/test/integration_tests/run_group.sh"
    44  	exit 1
    45  elif [[ $group_num =~ ^[0-9]+$ ]] && [[ -n ${groups[10#${group_num}]} ]]; then
    46  	# force use decimal index
    47  	test_names="${groups[10#${group_num}]}"
    48  	# Run test cases
    49  	echo "Run cases: ${test_names}"
    50  	mkdir -p /tmp/tiflow_engine_test
    51  	"${CUR}"/run.sh "${test_names}" 2>&1 | tee /tmp/tiflow_engine_test/engine_it.log
    52  	./engine/test/utils/check_log.sh
    53  else
    54  	echo "Error: invalid group name: ${group}"
    55  	exit 1
    56  fi