From 16b0e53573dbc9ee0b8344643e98c8b74bb94857 Mon Sep 17 00:00:00 2001 From: zhya Date: Sat, 30 Dec 2023 08:01:14 +0800 Subject: [PATCH] ci: add ee management mode test (#14188) add ee management mode test --- .../test_ee_management_mode_linux/action.yml | 21 ++++++++++++++++++ .github/workflows/reuse.linux.yml | 22 +++++++++++++++++++ scripts/ci/ci-run-ee-tests-management-mode.sh | 17 ++++++++++++++ .../00_0000_stream_status.result | 2 ++ .../00_stream_status/00_0000_stream_status.sh | 20 +++++++++++++++++ 5 files changed, 82 insertions(+) create mode 100644 .github/actions/test_ee_management_mode_linux/action.yml create mode 100755 scripts/ci/ci-run-ee-tests-management-mode.sh create mode 100644 tests/suites/7_management/00_stream_status/00_0000_stream_status.result create mode 100755 tests/suites/7_management/00_stream_status/00_0000_stream_status.sh diff --git a/.github/actions/test_ee_management_mode_linux/action.yml b/.github/actions/test_ee_management_mode_linux/action.yml new file mode 100644 index 000000000000..a94a4f7c22b7 --- /dev/null +++ b/.github/actions/test_ee_management_mode_linux/action.yml @@ -0,0 +1,21 @@ +name: "Test ee management mode" +description: "Running stateless tests in management mode" +inputs: + target: + description: "" + required: true + default: "x86_64-unknown-linux-gnu" +runs: + using: "composite" + steps: + - uses: ./.github/actions/setup_bendsql + - name: Download artifact + uses: ./.github/actions/artifact_download + with: + sha: ${{ github.sha }} + target: ${{ inputs.target }} + + - name: Run Stateful Tests with Standalone mode + shell: bash + run: | + ./scripts/ci/ci-run-ee-tests-management-mode.sh diff --git a/.github/workflows/reuse.linux.yml b/.github/workflows/reuse.linux.yml index 2b0f6930e7ba..d9c61774b2f7 100644 --- a/.github/workflows/reuse.linux.yml +++ b/.github/workflows/reuse.linux.yml @@ -278,6 +278,28 @@ jobs: with: name: test-stateful-standalone-linux + test_ee_management_mode: + needs: [build, check, license] + runs-on: [self-hosted, X64, Linux, 4c8g, "${{ inputs.runner_provider }}"] + if: needs.license.outputs.license + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup_bendsql + - name: Decode license + id: license + run: | + echo "license=$(echo '${{ needs.license.outputs.license }}' | base64 -d)" >> $GITHUB_OUTPUT + - uses: ./.github/actions/test_ee_management_mode_linux + timeout-minutes: 10 + env: + DATABEND_ENTERPRISE_LICENSE: ${{ steps.license.outputs.license }} + QUERY_DATABEND_ENTERPRISE_LICENSE: ${{ steps.license.outputs.license }} + - name: Upload failure + if: failure() + uses: ./.github/actions/artifact_failure + with: + name: test-ee-management-mode-linux + sqllogic_ee: runs-on: [self-hosted, X64, Linux, 4c8g, "${{ inputs.runner_provider }}"] if: needs.license.outputs.license diff --git a/scripts/ci/ci-run-ee-tests-management-mode.sh b/scripts/ci/ci-run-ee-tests-management-mode.sh new file mode 100755 index 000000000000..010792918369 --- /dev/null +++ b/scripts/ci/ci-run-ee-tests-management-mode.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Copyright 2020-2021 The Databend Authors. +# SPDX-License-Identifier: Apache-2.0. + +set -e + +export STORAGE_ALLOW_INSECURE=true + +echo "calling test suite" +echo "Starting standalone DatabendQuery(debug)" +./scripts/ci/deploy/databend-query-management-mode.sh + +SCRIPT_PATH="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)" +cd "$SCRIPT_PATH/../../tests" || exit + +echo "Starting databend-test" +./databend-test $1 --mode 'standalone' --run-dir management diff --git a/tests/suites/7_management/00_stream_status/00_0000_stream_status.result b/tests/suites/7_management/00_stream_status/00_0000_stream_status.result new file mode 100644 index 000000000000..da29283aaa47 --- /dev/null +++ b/tests/suites/7_management/00_stream_status/00_0000_stream_status.result @@ -0,0 +1,2 @@ +true +false diff --git a/tests/suites/7_management/00_stream_status/00_0000_stream_status.sh b/tests/suites/7_management/00_stream_status/00_0000_stream_status.sh new file mode 100755 index 000000000000..9bc5754b306b --- /dev/null +++ b/tests/suites/7_management/00_stream_status/00_0000_stream_status.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +. "$CURDIR"/../../../shell_env.sh + +echo "drop database if exists db_stream" | $BENDSQL_CLIENT_CONNECT + +echo "CREATE DATABASE db_stream" | $BENDSQL_CLIENT_CONNECT +echo "create table db_stream.t(a int)" | $BENDSQL_CLIENT_CONNECT +echo "create stream default.s1 on table db_stream.t comment = 'test'" | $BENDSQL_CLIENT_CONNECT +echo "create stream db_stream.s2 on table db_stream.t comment = 'test'" | $BENDSQL_CLIENT_CONNECT + +# When s1 is created, t automatically turns on change tracking. So the offset of s1 and the version of t do not match. +curl -X GET -s http://localhost:8081/v1/tenants/system/stream_status\?stream_name=s1 | jq .has_data +curl -X GET -s http://localhost:8081/v1/tenants/system/stream_status\?stream_name\=s2\&database\=db_stream | jq .has_data + +echo "drop stream if exists default.s1" | $BENDSQL_CLIENT_CONNECT +echo "drop stream if exists db_stream.s2" | $BENDSQL_CLIENT_CONNECT +echo "drop table if exists db_stream.t" | $BENDSQL_CLIENT_CONNECT +echo "drop database if exists db_stream" | $BENDSQL_CLIENT_CONNECT