github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/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  if [[ $group == "TLS_GROUP" ]]; then
     9  	group="G12"
    10  fi
    11  group_num=${group#G}
    12  
    13  # Define groups
    14  # Note: If new group is added, the group name must also be added to CI
    15  #  https://github.com/PingCAP-QE/ci/blob/main/pipelines/pingcap/tiflow/latest/pull_dm_integration_test.groovy
    16  # Each group of tests consumes as much time as possible, thus reducing CI waiting time.
    17  # Putting multiple light tests together and heavy tests in a separate group.
    18  groups=(
    19  	# G00
    20  	"ha_cases_1 ha_cases_2 ha_cases2"
    21  	# G01
    22  	"ha_cases3 ha_cases3_1 ha_master tracker_ignored_ddl validator_checkpoint incompatible_ddl_changes"
    23  	# G02
    24  	"handle_error handle_error_2 handle_error_3 adjust_gtid async_checkpoint_flush binlog_parse case_sensitive checkpoint_transaction check_task"
    25  	# G03
    26  	"dmctl_advance dmctl_basic dmctl_command downstream_diff_index downstream_more_column"
    27  	# G04
    28  	"import_goroutine_leak incremental_mode initial_unit drop_column_with_index duplicate_event expression_filter extend_column fake_rotate_event"
    29  	# G05
    30  	"load_interrupt many_tables online_ddl foreign_key full_mode gbk gtid ha_cases http_proxies"
    31  	# G06
    32  	"relay_interrupt safe_mode sequence_safe_mode lightning_load_task lightning_mode metrics"
    33  	# G07
    34  	"shardddl1 shardddl1_1 shardddl2 shardddl2_1"
    35  	# G08
    36  	"shardddl3 shardddl3_1 shardddl4 shardddl4_1 sharding sequence_sharding sequence_sharding_removemeta"
    37  	# G09
    38  	"import_v10x sharding2 ha new_collation_off only_dml openapi s3_dumpling_lightning sequence_sharding_optimistic"
    39  	# G10
    40  	"start_task print_status http_apis new_relay all_mode"
    41  	# `others others_2 others_3` tests of old pipeline
    42  	# G11
    43  	"validator_basic dm_syncer shardddl_optimistic slow_relay_writer sql_mode sync_collation"
    44  	# G12 TLS_GROUP
    45  	"tls"
    46  )
    47  
    48  # Get other cases not in groups, to avoid missing any case
    49  others=()
    50  for script in "$CUR"/*/run.sh; do
    51  	test_name="$(basename "$(dirname "$script")")"
    52  	# shellcheck disable=SC2076
    53  	if [[ ! " ${groups[*]} " =~ " ${test_name} " ]]; then
    54  		others=("${others[@]} ${test_name}")
    55  	fi
    56  done
    57  
    58  if [[ "$group" == "check others" ]]; then
    59  	if [[ -z $others ]]; then
    60  		echo "All engine integration test cases are added to groups"
    61  		exit 0
    62  	fi
    63  	echo "Error: "$others" is not added to any group in dm/tests/run_group.sh"
    64  	exit 1
    65  elif [[ $group_num =~ ^[0-9]+$ ]] && [[ -n ${groups[10#${group_num}]} ]]; then
    66  	# force use decimal index
    67  	test_names="${groups[10#${group_num}]}"
    68  	# Run test cases
    69  	echo "Run cases: ${test_names}"
    70  	"${CUR}"/run.sh "${test_names}"
    71  else
    72  	echo "Error: invalid group name: ${group}"
    73  	exit 1
    74  fi