Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] add compatibility test with old metasrv and latest query #5520

Merged
merged 13 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/actions/test_compat/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: "Test old metasrv is compatible with new query"
description: "Download old binaries and current binaries, run stateless test with old `meta` and latest `query`"
inputs:
profile:
description: ""
required: true
default: "debug"
target:
description: ""
required: true
default: "x86_64-unknown-linux-gnu"
runs:
using: "composite"
steps:
- name: Maximize build space
uses: ./.github/actions/cleanup

- name: Setup Build Tool
uses: ./.github/actions/setup_build_tool

- name: Install python dependences
shell: bash
run: |
pip3 install --user boto3 "moto[all]" yapf shfmt-py mysql-connector pymysql sqlalchemy clickhouse_driver

- uses: actions/download-artifact@v2
with:
name: ${{ inputs.profile }}-${{ github.sha }}-${{ inputs.target }}
path: ./current/

- uses: dsaltares/fetch-gh-release-asset@master
with:
repo: 'datafuselabs/databend'
# 2022-05-23
version: 'tags/v0.7.57-nightly'
file: 'databend-v0.7.57-nightly-x86_64-unknown-linux-gnu.tar.gz'

- shell: bash
run: |
mkdir ./old
tar -xf databend-v0.7.57-nightly-x86_64-unknown-linux-gnu.tar.gz -C ./old

- name: Test compatibility
shell: bash
run: |
chmod +x ./tests/compat/test-compat.sh
build-tool bash ./tests/compat/test-compat.sh

- name: Upload artifact
uses: actions/upload-artifact@v3
if: failure()
with:
name: test-compat
path: |
_local_fs/
_logs*/
_meta*/
metasrv/_logs*/
query/_logs*/
store/_logs*/
nohup.out
7 changes: 7 additions & 0 deletions .github/workflows/developing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ jobs:
- uses: actions/checkout@v2
- uses: ./.github/actions/test_metactl

test_compat:
runs-on: ubuntu-latest
needs: build_linux
steps:
- uses: actions/checkout@v2
Copy link
Member

Choose a reason for hiding this comment

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

checkout should be done with extra config

        with:
          fetch-depth: 0

to fetch all tags

- uses: ./.github/actions/test_compat

test_stateless_standalone_linux:
runs-on: ubuntu-latest
needs: build_linux
Expand Down
62 changes: 62 additions & 0 deletions tests/compat/test-compat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/sh

usage()
{
echo "test query being compatible with old metasrv"
echo "Expect current release binaries are in ./current/."
echo "Expect old release binaries are in ./old/."
echo "Usage: $0"
}

SCRIPT_PATH="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)"

echo "SCRIPT_PATH: $SCRIPT_PATH"

# go to work tree root
cd "$SCRIPT_PATH/../../"

pwd

mkdir -p ./target/debug/
chmod +x ./current/*
chmod +x ./old/*

cp ./old/databend-query ./target/debug/
cp ./current/databend-meta ./target/debug/

./target/debug/databend-meta --version
./target/debug/databend-query --version

# Not all cases in the latest repo will pass
echo "Run some specific SQL tests."

echo "Starting standalone DatabendQuery(debug)"

killall databend-query
killall databend-meta
sleep 1

for bin in databend-query databend-meta; do
if test -n "$(pgrep $bin)"; then
echo "The $bin is not killed. force killing."
killall -9 $bin
fi
done

BIN=debug

echo 'Start databend-meta...'
nohup target/${BIN}/databend-meta --single --log-level=DEBUG &
echo "Waiting on databend-meta 10 seconds..."
python3 scripts/ci/wait_tcp.py --timeout 5 --port 9191

echo 'Start databend-query...'
nohup target/${BIN}/databend-query -c scripts/ci/deploy/config/databend-query-node-1.toml &

echo "Waiting on databend-query 10 seconds..."
python3 scripts/ci/wait_tcp.py --timeout 5 --port 3307

cd tests

echo "Starting metasrv related test: 05_ddl"
./databend-test --mode 'standalone' --run-dir 0_stateless -- 05_