#!/bin/bash
#
# Copyright 2025 PingCAP, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Note: This file is supposed to run inside the docker (built by Dockerfile). Do not run it directly.

set -euo pipefail

CURRENT_DIR="$(dirname "$0")"
source $CURRENT_DIR/_include.sh

print_versions

# Start minio in background
/root/minio server /root/minio-data &
sleep 5

start_tidb_in_bg
wait_for_tidb
wait_for_tiflash

echo "+ Running /root/mysql-tester"
/root/mysql-tester

stop_tiup
stop_minio