github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/tests/integration_tests/_utils/run_cdc_cli_tso_query (about)

     1  #!/bin/bash
     2  #
     3  # Copyright 2020 PingCAP, Inc.
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # See the License for the specific language governing permissions and
    14  # limitations under the License.
    15  
    16  set -eux
    17  
    18  # parameter 1: pd host
    19  # parameter 2: pd port
    20  pd_host=${1}
    21  pd_port=${2}
    22  is_tls=${3:-false}
    23  
    24  if [ "$is_tls" == "true" ]; then
    25  	tso=$(run_cdc_cli tso query --pd=https://${pd_host}:${pd_port})
    26  else
    27  	tso=$(run_cdc_cli tso query --pd=http://${pd_host}:${pd_port})
    28  fi
    29  
    30  # make sure get tso only
    31  # the tso got above is:
    32  # "427768583921860609 PASS coverage: 2.7% of statements in github.com/pingcap/tiflow/..."
    33  # and only "427768583921860609" is a real tso
    34  echo $tso | awk -F " " '{print $1}'
    35  
    36  set +x