Skip to content

Commit 22f5588

Browse files
authored
refactor: extract fuse compat test matrix into test_cases.yaml (#19441)
* refactor: rewrite test_compat_fuse * refactor: extract fuse compat test matrix into test_cases.yaml * docs: update compat_fuse README to match current implementation * refactor: merge compat-stateless flashback tests into parameterized script and wire into CI * fix: correct NEW_FMT_VER for v2 case and document stateless field in README * fix: use current meta for reader phase in meta compression cases * refactor: replace hand-rolled yaml parser with PyYAML * fix: add intermediate meta upgrade steps for meta compression cases * fix: restore original meta chains and download reader binary * fix: bump meta versions to satisfy current query min-compatible-metasrv-version * fix: remove V0 compat tests (1.0.56/1.1.30) dropped since ea91e06 * fix: add .test extension to sqllogictest files so runner actually executes them The sqllogictest runner filters files by `.test` extension (tests/sqllogictests/src/main.rs:308). Without it, `--run_file` never matches and 0 tests are executed. This is a pre-existing bug on main that affects all compat_fuse cases. * fix: remove trailing commas in base/fuse_compat_write.test Old query (1.2.46) does not support trailing commas in CREATE TABLE column definitions or INSERT VALUES. This was never caught because the test files were never actually executed (missing .test extension). * fix: update expected show grants output in revoke/fuse_compat_read Current query expands ALL into individual privilege names (CREATE,SELECT,INSERT,...) instead of showing ALL. * fix: split rbac tests into basic (1.2.311) and full (1.2.833) suites rbac/ reverted to pre-54fceaa6b0 content compatible with writer 1.2.311. rbac_all/ preserves the expanded test (procedure/sequence/connection/ warehouse) with writer 1.2.833 which supports all these features. * fix: typo in rbac_all read test - access procedure, not access sequence PR #18730 wrote "GRANT access sequence on procedure" which is syntactically wrong. Should be "GRANT access procedure on procedure". Never caught because the test was never executed. * refactor: rename rbac test suites to include version context rbac -> rbac_v1_2_311 (compatible with writer 1.2.311/1.2.318) rbac_all -> rbac_current (requires current query features) * fix: suppress noisy CI output from git advice and old binary backtraces - Add -c advice.detachedHead=false to git clone in git_partial_clone() - Capture --cmd ver output to suppress backtrace from old binaries * refactor: improve version check output in CI logs - Add context message before/after version checks - Only print the "version:" line from --cmd ver output - Use "checking metasrv/query" prefix for clarity * fix: lazy-import PyYAML so single-case mode works without it * docs: clarify procedure version comment in test_cases.yaml * docs: fix sqllogictest filenames in README to include .test extension * docs: fix docstring to cover both backward and forward compat * fix: use explicit privilege list instead of ALL in revoke write test
1 parent 3ecf0d4 commit 22f5588

File tree

23 files changed

+542
-1114
lines changed

23 files changed

+542
-1114
lines changed

.github/actions/test_compat_fuse/action.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,8 @@ runs:
1111
- name: Test compatibility
1212
shell: bash
1313
run: |
14-
bash ./tests/compat_fuse/test_compat_fuse.sh --writer-version 1.2.46 --reader-version current --meta-versions 1.2.527 1.2.677 1.2.833 --logictest-path base
15-
bash ./tests/compat_fuse/test_compat_fuse.sh --writer-version 1.2.241 --reader-version current --meta-versions 1.2.527 1.2.677 1.2.833 --logictest-path revoke
16-
bash ./tests/compat_fuse/test_compat_fuse.sh --writer-version 1.2.311 --reader-version current --meta-versions 1.2.527 1.2.677 1.2.833 --logictest-path rbac
17-
bash ./tests/compat_fuse/test_compat_fuse.sh --writer-version 1.2.318 --reader-version current --meta-versions 1.2.527 1.2.677 1.2.833 --logictest-path rbac
18-
bash ./tests/compat_fuse/test_compat_fuse.sh --writer-version 1.2.680 --reader-version current --meta-versions 1.2.680 1.2.833 --logictest-path udf
19-
20-
bash ./tests/compat_fuse/test_compat_fuse.sh --writer-version current --reader-version 1.2.311 --meta-versions 1.2.770 --logictest-path rbac
21-
bash ./tests/compat_fuse/test_compat_fuse.sh --writer-version current --reader-version 1.2.318 --meta-versions 1.2.770 --logictest-path rbac
22-
bash ./tests/compat_fuse/test_compat_fuse.sh --writer-version current --reader-version 1.2.680 --meta-versions 1.2.770 --logictest-path udf
14+
pip install pyyaml -q
15+
python3 ./tests/compat_fuse/test_compat_fuse.py --run-all
2316
- name: Upload failure
2417
if: failure()
2518
uses: ./.github/actions/artifact_failure

tests/compat_fuse/README.md

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,68 @@
11
# Fuse table compatibility test
22

3-
This script tests whether a newer version databend-query can read fuse table data written
4-
by a older version databend-query.
3+
Tests write-then-read compatibility of fuse-table format across databend-query versions.
4+
5+
- **Backward compat**: old writer → current reader
6+
- **Forward compat**: current writer → old reader
7+
8+
## Test matrix
9+
10+
All test cases are defined in `test_cases.yaml`. Each entry specifies:
11+
12+
| Field | Description |
13+
|------------|--------------------------------------------------------------------|
14+
| `writer` | Query version that writes data (`"current"` = latest build) |
15+
| `reader` | Query version that reads data (`"current"` = latest build) |
16+
| `meta` | Meta-service versions to run in order (upgrades on-disk meta data) |
17+
| `suite` | sqllogictest sub-directory under `compat-logictest/` |
18+
19+
To add a test case, append an entry to `test_cases.yaml`.
520

621
## Usage
722

23+
Run all cases (CI mode):
24+
825
```shell
9-
tests/compat_fuse/test_compat_fuse.sh <old_ver>
10-
tests/compat_fuse/test_compat_fuse_forward.sh <old_ver>
26+
python3 tests/compat_fuse/test_compat_fuse.py --run-all
1127
```
1228

13-
E.g. `tests/compat_fuse/test-compat_fuse.sh 0.7.151` tests if the fuse-table written
14-
by **databend-query-0.7.151** can be read by **current** version databend-query.
29+
Dry run (print cases without executing):
1530

16-
`tests/compat_fuse/test-fuse-forward-compat.sh 1.2.307` tests if the fuse-table written
17-
by **current** can be read by **databend-query-0.7.151** version databend-query.
31+
```shell
32+
python3 tests/compat_fuse/test_compat_fuse.py --run-all --dry-run
33+
```
34+
35+
Run a single case (local debugging):
36+
37+
```shell
38+
python3 tests/compat_fuse/test_compat_fuse.py \
39+
--writer-version 1.2.46 \
40+
--reader-version current \
41+
--meta-versions 1.2.527 1.2.677 1.2.833 \
42+
--logictest-path base
43+
```
1844

1945
## Prerequisites
2046

21-
- Current version of databend-query and databend-meta must reside in `./bins`:
22-
- `./bins/current/databend-query`
23-
- `./bins/current/databend-meta`
47+
Current version binaries must reside in `./bins/current/bin/`:
48+
49+
- `databend-query`
50+
- `databend-meta`
51+
- `databend-sqllogictests`
52+
53+
This is handled by the CI setup action. Old version binaries are downloaded automatically.
54+
55+
## Test flow
2456

25-
Since building a binary takes several minutes,
26-
this step is usually done by the calling process, e.g., the CI script.
57+
For each case, the script runs three phases:
2758

59+
1. **Write** — start meta (first version) + query (writer version), run `fuse_compat_write.test`
60+
2. **Meta upgrade** — cycle through all meta versions to upgrade on-disk data
61+
3. **Read** — start meta (last version) + query (reader version), run `fuse_compat_read.test`
2862

2963
## Testing data
3064

31-
- Suite `tests/compat_fuse/compat-logictest/fuse_compat_write` writes data into a fuse table via an old version query.
32-
- Suite `tests/compat_fuse/compat-logictest/fuse_compat_read` reads the data via current version query.
65+
Each suite under `compat-logictest/` contains two sqllogictest files:
3366

34-
Fuse table maintainers update these two `logictest` scripts to let the write/read
35-
operations cover fuse-table features.
67+
- `fuse_compat_write.test` — creates tables and writes data
68+
- `fuse_compat_read.test` — reads and verifies the data

tests/compat_fuse/compat-logictest/01_meta_compression/fuse_compat_read

Lines changed: 0 additions & 67 deletions
This file was deleted.

tests/compat_fuse/compat-logictest/01_meta_compression/fuse_compat_write

Lines changed: 0 additions & 97 deletions
This file was deleted.

tests/compat_fuse/compat-logictest/02_meta_compression_v3_to_v4/fuse_compat_read

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)