github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/tests/dmctl_basic/check_list/query_status.sh (about) 1 #!/bin/bash 2 3 function query_status_wrong_arg() { 4 run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ 5 "query-status wrong_args_count more_than_one" \ 6 "query-status \[-s source ...\] \[task-name | task-file\]" 1 7 } 8 9 function query_status_wrong_params() { 10 run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ 11 "query-status -s source-x task-y" \ 12 "sources \[source-x\] haven't been added" 1 13 } 14 15 function query_status_with_no_tasks() { 16 run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ 17 "query-status -s $SOURCE_ID1,$SOURCE_ID2" \ 18 "\"result\": true" 3 \ 19 "\"msg\": \"no sub task started\"" 2 20 } 21 22 function query_status_with_tasks() { 23 run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ 24 "query-status -s $SOURCE_ID1,$SOURCE_ID2" \ 25 "\"result\": true" 3 \ 26 "\"unit\": \"Sync\"" 2 \ 27 "\"stage\": \"Running\"" 2 28 run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ 29 "query-status" \ 30 "\"result\": true" 1 \ 31 "\"taskName\": \"test\"" 1 \ 32 "\"taskStatus\": \"Running\"" 1 \ 33 "\"sources\":" 1 \ 34 "\"$SOURCE_ID1\"" 1 \ 35 "\"$SOURCE_ID2\"" 1 36 } 37 38 function query_status_stopped_relay() { 39 run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \ 40 "query-status -s $SOURCE_ID1,$SOURCE_ID2" \ 41 "\"result\": true" 3 \ 42 "\"stage\": \"Paused\"" 2 43 } 44 45 function query_status_paused_tasks() { 46 run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \ 47 "query-status -s $SOURCE_ID1,$SOURCE_ID2" \ 48 "\"result\": true" 3 \ 49 "\"stage\": \"Paused\"" 2 50 } 51 52 function query_status_running_tasks() { 53 # Running is 4 (including relay) 54 run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \ 55 "query-status -s $SOURCE_ID1,$SOURCE_ID2" \ 56 "\"result\": true" 3 \ 57 "\"stage\": \"Running\"" 4 58 } 59 60 function query_status_with_offline_worker() { 61 run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \ 62 "query-status" \ 63 "\"result\": false" 2 \ 64 "\"worker\": \"source not bound\"" 2 65 }