diff --git a/.drone.jsonnet b/.drone.jsonnet index 0e10ea228..70a00e91c 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -342,36 +342,13 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise", }, commands: [ prepareTestStage(getContainerName("mtr"), result, true), - "docker cp mysql-test/columnstore mtr$${DRONE_BUILD_NUMBER}:" + mtr_path + "/suite/", - execInnerDocker("chown -R mysql:mysql " + mtr_path, getContainerName("mtr")), - // disable systemd 'ProtectSystem' (we need to write to /usr/share/) - execInnerDocker("bash -c 'sed -i /ProtectSystem/d $(systemctl show --property FragmentPath mariadb | sed s/FragmentPath=//)'", getContainerName("mtr")), - execInnerDocker("systemctl daemon-reload", getContainerName("mtr")), - execInnerDocker("systemctl start mariadb", getContainerName("mtr")), - // Set RAM consumption limits to avoid RAM contention b/w mtr and regression steps. - execInnerDocker("/usr/bin/mcsSetConfig SystemConfig CGroup just_no_group_use_local", getContainerName("mtr")), - execInnerDocker('mariadb -e "create database if not exists test;"', getContainerName("mtr")), - execInnerDocker("systemctl restart mariadb-columnstore", getContainerName("mtr")), - - // delay mtr for manual debugging on live instance - "sleep $${MTR_DELAY_SECONDS:-1s}", 'MTR_SUITE_LIST=$([ "$MTR_FULL_SUITE" == true ] && echo "' + mtr_full_set + '" || echo "$MTR_SUITE_LIST")', - if (event == "custom" || event == "cron") then - execInnerDocker('bash -c "wget -qO- https://cspkg.s3.amazonaws.com/mtr-test-data.tar.lz4 | lz4 -dc - | tar xf - -C /"', - getContainerName("mtr")), - if (event == "custom" || event == "cron") then - execInnerDocker('bash -c "cd ' + mtr_path + " && ./mtr --extern socket=" + socket_path + ' --force --print-core=detailed --print-method=gdb --max-test-fail=0 --suite=columnstore/setup"', - getContainerName("mtr")), - - if (event == "cron") then - execInnerDocker('bash -c "cd ' + mtr_path + " && ./mtr --extern socket=" + socket_path + - " --force --print-core=detailed --print-method=gdb --max-test-fail=0 --suite=" - + std.join(",", std.map(function(x) "columnstore/" + x, std.split(mtr_full_set, ","))), - getContainerName("mtr")) + '"' - else - execInnerDocker('bash -c "cd ' + mtr_path + " && ./mtr --extern socket=" + socket_path + - ' --force --print-core=detailed --print-method=gdb --max-test-fail=0 --suite=columnstore/$${MTR_SUITE_LIST//,/,columnstore/}"', - getContainerName("mtr")), + + 'bash /mdb/' + builddir + '/storage/columnstore/columnstore/build/run_mtr.sh' + + ' --container-name ' + getContainerName("mtr") + + ' --distro ' + platform + + ' --suite-list $${MTR_SUITE_LIST}' + + ' --triggering-event ' + event, ], }, mtrlog:: { diff --git a/build/prepare_test_stage.sh b/build/prepare_test_stage.sh index 5266c5511..11a6eeeec 100755 --- a/build/prepare_test_stage.sh +++ b/build/prepare_test_stage.sh @@ -118,7 +118,7 @@ echo "Installing columnstore..." if [[ "$RESULT" == *rocky* ]]; then execInnerDockerWithRetry "$CONTAINER_NAME" 'yum install -y MariaDB-columnstore-engine MariaDB-test' else - execInnerDockerWithRetry "$CONTAINER_NAME" 'apt update -y && apt install -y mariadb-plugin-columnstore mariadb-test' + execInnerDockerWithRetry "$CONTAINER_NAME" 'apt update -y && apt install -y mariadb-plugin-columnstore mariadb-test mariadb-test-data' fi sleep 5 diff --git a/build/run_mtr.sh b/build/run_mtr.sh new file mode 100755 index 000000000..9384929ff --- /dev/null +++ b/build/run_mtr.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +set -eo pipefail + +SCRIPT_LOCATION=$(dirname "$0") +source "$SCRIPT_LOCATION"/utils.sh + +optparse.define short=c long=container-name desc="Name of the Docker container where mtr tests will run" variable=CONTAINER_NAME +optparse.define short=d long=distro desc="Linux distro for which mtr is runned" variable=DISTRO +optparse.define short=s long=suite-list desc="Comma-separated list of test suites to run" variable=MTR_SUITE_LIST +optparse.define short=e long=triggering-event desc="Event that triggers testrun" variable=EVENT +source $(optparse.build) + +MTR_FULL_SET="basic,bugfixes,devregression,autopilot,extended,multinode,oracle,1pmonly" + +echo "Arguments received: $@" + +if [[ "$EUID" -ne 0 ]]; then + error "Please run script as root" + exit 1 +fi + +if [[ -z "${CONTAINER_NAME}" ]]; then + echo "Please provide mtr container name as a parameter, e.g. ./run_mtr.sh -c mtr183" + exit 1 +fi + +if [[ -z $(docker ps -q --filter "name=${CONTAINER_NAME}") ]]; then + error "Container '${CONTAINER_NAME}' is not running." + exit 1 +fi + +if [[ "$DISTRO" == *rocky* ]]; then + SOCKET_PATH="/var/lib/mysql/mysql.sock" + MTR_PATH="/usr/share/mysql-test" +else + SOCKET_PATH="/run/mysqld/mysqld.sock" + MTR_PATH="/usr/share/mysql/mysql-test" +fi + +message "Running mtr tests..." + +execInnerDocker "${CONTAINER_NAME}" "chown -R mysql:mysql ${MTR_PATH}" + +# disable systemd 'ProtectSystem' (we need to write to /usr/share/) +execInnerDocker "${CONTAINER_NAME}" "sed -i /ProtectSystem/d \$(systemctl show --property FragmentPath mariadb | sed s/FragmentPath=//) || true" +execInnerDocker "${CONTAINER_NAME}" "systemctl daemon-reload" +execInnerDocker "${CONTAINER_NAME}" "systemctl start mariadb" + +# Set RAM consumption limits to avoid RAM contention b/w mtr and regression steps. +execInnerDocker "${CONTAINER_NAME}" "/usr/bin/mcsSetConfig SystemConfig CGroup just_no_group_use_local" +execInnerDocker "${CONTAINER_NAME}" "mariadb -e \"create database if not exists test;\"" +execInnerDocker "${CONTAINER_NAME}" "systemctl restart mariadb-columnstore" + +#TODO: should all actions until this point be a part of prepare_test_stage.sh? + +if [[ "${EVENT}" == "custom" || "${EVENT}" == "cron" ]]; then + execInnerDocker "${CONTAINER_NAME}" "cd ${MTR_PATH} && ./mtr --extern socket=${SOCKET_PATH} --parallel=auto --force --print-core=detailed --print-method=gdb --max-test-fail=0 --suite=columnstore/setup" + execInnerDocker "${CONTAINER_NAME}" "wget -qO- https://cspkg.s3.amazonaws.com/mtr-test-data.tar.lz4 | lz4 -dc - | tar xf - -C /" #TODO: Data for extended tests( out of scope of basic, bugfixes) set should be downloaded and unpacked for extended version only. +fi + +if [[ "${EVENT}" == "cron" ]]; then + execInnerDocker "${CONTAINER_NAME}" "cd ${MTR_PATH} && ./mtr --extern socket=${SOCKET_PATH} --parallel=auto --force --print-core=detailed --print-method=gdb --max-test-fail=0 --suite=columnstore/${MTR_FULL_SET//,/,columnstore/}" +else + execInnerDocker "${CONTAINER_NAME}" "cd ${MTR_PATH} && ./mtr --extern socket=${SOCKET_PATH} --parallel=auto --force --print-core=detailed --print-method=gdb --max-test-fail=0 --suite=columnstore/${MTR_SUITE_LIST//,/,columnstore/}" +fi \ No newline at end of file diff --git a/tests/scripts/fullmtr.sh b/tests/scripts/fullmtr.sh index 3f8d86adf..7ca3a4558 100644 --- a/tests/scripts/fullmtr.sh +++ b/tests/scripts/fullmtr.sh @@ -4,7 +4,7 @@ SCRIPT_LOCATION=$(dirname "$0") MARIADB_SOURCE_PATH=$(realpath $SCRIPT_LOCATION/../../../../../) COLUMNSTORE_MTR_SOURCE=$(realpath $SCRIPT_LOCATION/../../mysql-test/columnstore) INSTALLED_MTR_PATH='/usr/share/mysql/mysql-test' -COLUMSNTORE_MTR_INSTALLED=${INSTALLED_MTR_PATH}/suite/columnstore +COLUMSNTORE_MTR_INSTALLED=${INSTALLED_MTR_PATH}/plugin/columnstore/columnstore/ PATCHNAME=$(realpath $SCRIPT_LOCATION)/mtr_warn.patch CURRENT_DIR=`pwd` mysql -e "create database if not exists test;"