Skip to content

Commit

Permalink
Merge pull request #9683 from ariesdevil/management-tests
Browse files Browse the repository at this point in the history
chore(sqllogictest): add sqllogic tests for management mode
  • Loading branch information
mergify[bot] authored Jan 20, 2023
2 parents a182bf0 + ed0847e commit 403dbb1
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 4 deletions.
33 changes: 33 additions & 0 deletions .github/actions/test_sqllogic_management_mode_linux/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Test sqllogic management mode"
description: "Running sqllogic tests in management mode"
inputs:
profile:
description: "The profile for this test"
required: true
default: "debug"
target:
description: ""
required: true
default: "x86_64-unknown-linux-gnu"
dirs:
description: "logic test suites dirs"
required: true
default: ""
handlers:
description: "logic test handlers, mysql,http,clickhouse"
required: false
default: ""
runs:
using: "composite"
steps:
- name: Download artifact
uses: ./.github/actions/artifact_download
with:
profile: ${{ inputs.profile }}
sha: ${{ github.sha }}
target: ${{ inputs.target }}
- name: Run sqllogic Tests with management mode
shell: bash
env:
TEST_HANDLERS: ${{ inputs.handlers }}
run: bash ./scripts/ci/ci-run-sqllogic-tests-management-mode.sh ${{ inputs.dirs }}
18 changes: 18 additions & 0 deletions .github/workflows/dev-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,24 @@ jobs:
dirs: ${{ matrix.dirs }}
handlers: ${{ matrix.handlers }}

test_sqllogic_management_mode_linux:
timeout-minutes: 30
name: test_sqllogic_${{ matrix.dirs }}_linux
runs-on: [ self-hosted, X64, Linux, development ]
needs: build_gnu
strategy:
matrix:
dirs:
- "management"
handlers:
- "mysql,http,clickhouse"
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test_sqllogic_management_mode_linux
with:
dirs: ${{ matrix.dirs }}
handlers: ${{ matrix.handlers }}

test_sqllogic_cluster_linux:
timeout-minutes: 30
name: test_sqllogic_${{ matrix.dirs }}_cluster_linux
Expand Down
20 changes: 20 additions & 0 deletions scripts/ci/ci-run-sqllogic-tests-management-mode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# Copyright 2020-2021 The Databend Authors.
# SPDX-License-Identifier: Apache-2.0.

set -e

echo "Starting standalone DatabendQuery and DatabendMeta"
./scripts/ci/deploy/databend-query-management-mode.sh

TEST_HANDLERS=${TEST_HANDLERS:-"mysql,http,clickhouse"}
BUILD_PROFILE=${BUILD_PROFILE:-debug}

RUN_DIR=""
if [ $# -gt 0 ]; then
RUN_DIR="--run_dir $*"
fi
echo "Run suites using argument: $RUN_DIR"

echo "Starting databend-sqllogic tests"
target/${BUILD_PROFILE}/databend-sqllogictests --handlers ${TEST_HANDLERS} ${RUN_DIR} --enable_sandbox --debug
4 changes: 2 additions & 2 deletions scripts/ci/deploy/config/databend-query-management-mode.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ mysql_handler_port = 3307

# Databend Query ClickHouse Handler.
clickhouse_http_handler_host = "0.0.0.0"
clickhouse_http_handler_port = 8127
clickhouse_http_handler_port = 8124

# Databend Query HTTP Handler.
http_handler_host = "0.0.0.0"
http_handler_port = 8001
http_handler_port = 8000

# In mgr mode, we also need to config the tenant_id, such as system.
tenant_id = "system"
Expand Down
6 changes: 4 additions & 2 deletions scripts/ci/deploy/databend-query-management-mode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ nohup target/${BUILD_PROFILE}/databend-meta --single --log-level=ERROR &
echo "Waiting on databend-meta 10 seconds..."
python3 scripts/ci/wait_tcp.py --timeout 5 --port 9191

echo 'Start databend-query...'
echo 'Start databend-query management-mode node'
nohup target/${BUILD_PROFILE}/databend-query -c scripts/ci/deploy/config/databend-query-management-mode.toml &
echo "Waiting on databend-query 10 seconds..."
python3 scripts/ci/wait_tcp.py --timeout 5 --port 3307
python3 scripts/ci/wait_tcp.py --timeout 5 --port 9091

echo "All done..."
23 changes: 23 additions & 0 deletions tests/sqllogictests/suites/management/management_calls
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
statement ok
DROP TABLE if EXISTS call_t

statement ok
CREATE TABLE call_t(a UInt64 null, b UInt32 null) CLUSTER BY(a+1) Engine = Fuse

# need to check the result later, currently just use ok to skip
onlyif todo
statement ok
call system$search_tables('call_t')


query T
call system$clustering_information('default', 'call_t')
----
((a + 1)) 0 0 0.0 0.0 {}


query T
call admin$tenant_quota('admin')
----
0 0 0 0

1 comment on commit 403dbb1

@vercel
Copy link

@vercel vercel bot commented on 403dbb1 Jan 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

databend – ./

databend-git-main-databend.vercel.app
databend.vercel.app
databend-databend.vercel.app
databend.rs

Please sign in to comment.