github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/tests/dmctl_basic/check_list/show_ddl_locks.sh (about)

     1  #!/bin/bash
     2  
     3  function show_ddl_locks_wrong_arg() {
     4  	run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
     5  		"shard-ddl-lock a b" \
     6  		"dmctl shard-ddl-lock \[task\]" 1
     7  	run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
     8  		"show-ddl-locks a b" \
     9  		"show-ddl-locks \[-s source ...\] \[task-name | task-file\] \[flags\]" 1
    10  }
    11  
    12  function show_ddl_locks_no_locks() {
    13  	task_name=$1
    14  	run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
    15  		"shard-ddl-lock $task_name" \
    16  		"\"msg\": \"no DDL lock exists\"" 1
    17  	run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
    18  		"show-ddl-locks $task_name" \
    19  		"\"msg\": \"no DDL lock exists\"" 1
    20  }
    21  
    22  function show_ddl_locks_with_locks() {
    23  	lock_id=$1
    24  	ddl=$2
    25  	run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
    26  		"shard-ddl-lock" \
    27  		"\"ID\": \"$lock_id\"" 1 \
    28  		"$ddl" 1
    29  	run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
    30  		"show-ddl-locks" \
    31  		"\"ID\": \"$lock_id\"" 1 \
    32  		"$ddl" 1
    33  }