Skip to content

Commit 5eea9b3

Browse files
committed
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. See investigation.md for the full timeline of how the tests diverged.
1 parent c0be702 commit 5eea9b3

File tree

6 files changed

+175
-56
lines changed

6 files changed

+175
-56
lines changed

tests/compat_fuse/compat-logictest/rbac/fuse_compat_read.test

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
statement ok
2-
GRANT access connection on connection c2 to role 'role2';
3-
4-
statement ok
5-
GRANT access sequence on sequence seq2 to role 'role2';
6-
7-
statement ok
8-
GRANT access sequence on procedure p1(int) to role 'role2';
9-
10-
statement ok
11-
GRANT ownership on connection c2 to role 'role2';
12-
13-
statement ok
14-
GRANT ownership on sequence seq2 to role 'role2';
15-
16-
statement ok
17-
GRANT ownership on procedure p1(int) to role 'role2';
18-
191
statement ok
202
show grants for role 'role1';
213

tests/compat_fuse/compat-logictest/rbac/fuse_compat_write.test

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,6 @@ grant select on default.* to role 'role1';
1010
statement ok
1111
create function a as (a) -> (a+1);
1212

13-
statement ok
14-
drop procedure if exists p1(int);
15-
16-
statement ok
17-
CREATE PROCEDURE if not exists p1(x int) RETURNS int not null LANGUAGE SQL COMMENT='test' AS $$
18-
BEGIN
19-
RETURN x;
20-
END;
21-
$$;
22-
23-
statement ok
24-
create connection c1 storage_type = 's3' access_key_id ='11' secret_access_key ='11' ENDPOINT_URL='http://127.0.0.1:9900';
25-
26-
statement ok
27-
create connection c2 storage_type = 's3' access_key_id ='22' secret_access_key ='22' ENDPOINT_URL='http://127.0.0.1:9900';
28-
29-
statement ok
30-
create sequence seq1;
31-
32-
statement ok
33-
create sequence seq2;
34-
3513
statement ok
3614
drop role if exists 'role2';
3715

@@ -40,19 +18,3 @@ create role 'role2';
4018

4119
statement ok
4220
GRANT OWNERSHIP on udf a to role 'role1';
43-
44-
statement ok
45-
GRANT OWNERSHIP on procedure p1(int) to role 'role1';
46-
47-
statement ok
48-
GRANT create warehouse on *.* to role 'role1';
49-
50-
statement ok
51-
GRANT create connection on *.* to role 'role1';
52-
53-
statement ok
54-
GRANT create sequence on *.* to role 'role1';
55-
56-
statement ok
57-
GRANT create procedure on *.* to role 'role1';
58-
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
statement ok
2+
GRANT access connection on connection c2 to role 'role2';
3+
4+
statement ok
5+
GRANT access sequence on sequence seq2 to role 'role2';
6+
7+
statement ok
8+
GRANT access sequence on procedure p1(int) to role 'role2';
9+
10+
statement ok
11+
GRANT ownership on connection c2 to role 'role2';
12+
13+
statement ok
14+
GRANT ownership on sequence seq2 to role 'role2';
15+
16+
statement ok
17+
GRANT ownership on procedure p1(int) to role 'role2';
18+
19+
statement ok
20+
show grants for role 'role1';
21+
22+
statement ok
23+
grant ownership on udf a to role 'role2'
24+
25+
statement ok
26+
show grants for role 'role1';
27+
28+
statement ok
29+
show grants for role 'role2';
30+
31+
statement ok
32+
drop role role1;
33+
34+
statement ok
35+
drop role role2;
36+
37+
statement ok
38+
show roles;
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
statement ok
2+
drop role if exists 'role1';
3+
4+
statement ok
5+
create role 'role1';
6+
7+
statement ok
8+
grant select on default.* to role 'role1';
9+
10+
statement ok
11+
create function a as (a) -> (a+1);
12+
13+
statement ok
14+
drop procedure if exists p1(int);
15+
16+
statement ok
17+
CREATE PROCEDURE if not exists p1(x int) RETURNS int not null LANGUAGE SQL COMMENT='test' AS $$
18+
BEGIN
19+
RETURN x;
20+
END;
21+
$$;
22+
23+
statement ok
24+
create connection c1 storage_type = 's3' access_key_id ='11' secret_access_key ='11' ENDPOINT_URL='http://127.0.0.1:9900';
25+
26+
statement ok
27+
create connection c2 storage_type = 's3' access_key_id ='22' secret_access_key ='22' ENDPOINT_URL='http://127.0.0.1:9900';
28+
29+
statement ok
30+
create sequence seq1;
31+
32+
statement ok
33+
create sequence seq2;
34+
35+
statement ok
36+
drop role if exists 'role2';
37+
38+
statement ok
39+
create role 'role2';
40+
41+
statement ok
42+
GRANT OWNERSHIP on udf a to role 'role1';
43+
44+
statement ok
45+
GRANT OWNERSHIP on procedure p1(int) to role 'role1';
46+
47+
statement ok
48+
GRANT create warehouse on *.* to role 'role1';
49+
50+
statement ok
51+
GRANT create connection on *.* to role 'role1';
52+
53+
statement ok
54+
GRANT create sequence on *.* to role 'role1';
55+
56+
statement ok
57+
GRANT create procedure on *.* to role 'role1';

tests/compat_fuse/investigation.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# compat_fuse sqllogictest 静默失效调查报告
2+
3+
## 现象
4+
5+
重构 PR 修复 `.test` 扩展名后,CI 中 rbac suite 的 `fuse_compat_write` 执行失败:
6+
7+
```
8+
1 | drop procedure if exists p1(int);
9+
| ^^^^^^^^^ unexpected `procedure`
10+
```
11+
12+
writer 版本 1.2.311 不支持 procedure 语法。
13+
14+
## 根因
15+
16+
### 1. `.test` 扩展名过滤导致测试静默失效
17+
18+
`54fceaa6b0` (2025-02-14, PR #17449 "testing tpch/tpcds using 1G scale factor") 在 sqllogictest runner 中新增了文件扩展名过滤:
19+
20+
```rust
21+
// tests/sqllogictests/src/main.rs
22+
if !file_name.ends_with(".test") {
23+
continue;
24+
}
25+
```
26+
27+
`compat_fuse` 下所有 sqllogictest 文件(`fuse_compat_write`, `fuse_compat_read`)均无 `.test` 扩展名。从此刻起,所有 compat_fuse 的 sqllogictest **静默变为空跑**`Run all tests[0]`),CI 报绿但实际 0 个测试被执行。
28+
29+
### 2. 后续 PR 在不知情的情况下往 rbac 测试中添加了不兼容的 SQL
30+
31+
`.test` 过滤生效前(2025-02-14),rbac 测试内容与 writer 版本 1.2.306 兼容:
32+
33+
```sql
34+
-- 54fceaa6b0^ 时的 rbac/fuse_compat_write(兼容 1.2.306)
35+
drop role if exists 'role1';
36+
create role 'role1';
37+
grant select on default.* to role 'role1';
38+
create function a as (a) -> (a+1);
39+
drop role if exists 'role2';
40+
create role 'role2';
41+
GRANT OWNERSHIP on udf a to role 'role1';
42+
```
43+
44+
`.test` 过滤生效后,以下 PR 陆续向 `rbac/fuse_compat_write` 添加了新特性 SQL,但因测试不再执行,不兼容未被发现:
45+
46+
| 日期 | Commit | PR | 添加的 SQL | writer 版本是否支持 |
47+
|------|--------|----|-----------|-------------------|
48+
| 2025-02-24 | `b0835cc384` | #17262 | `GRANT create warehouse` | ❌ 1.2.306 不支持 |
49+
| 2025-07-23 | `9c2c5e1324` | #18382 | `create connection` ||
50+
| 2025-07-29 | `cf97c5ef80` | #18423 | `create sequence` ||
51+
| 2025-08-11 | `fd3ad036e0` | #18500 | (未改测试文件,但将 writer 从 1.2.306 改为 1.2.311) ||
52+
| 2025-09-18 | `c3fee76d55` | #18730 | `drop/create procedure` | ❌ 1.2.311 不支持 |
53+
| 2025-10-09 | `ba3f3e875c` | #18875 | 去掉 `enable_experimental_procedure` 开关 ||
54+
55+
### 3. 同样的问题也影响 base suite
56+
57+
`base/fuse_compat_write` 中 CREATE TABLE 有 trailing comma,在 writer 1.2.46 上会报 SyntaxException。同样因为测试不执行而未被发现。
58+
59+
### 4. revoke suite 的期望输出过时
60+
61+
`revoke/fuse_compat_read``show grants` 期望 `ALL`,但当前 query 展开为具体权限列表。
62+
63+
## 影响范围
64+
65+
main 分支上所有 8 个 compat_fuse test case 的 sqllogictest 文件自 2025-02-14 起均未被执行。CI 一直报绿,但兼容性测试实际为空跑。
66+
67+
## 本 PR 中的修复
68+
69+
| 修复 | 说明 |
70+
|------|------|
71+
| 文件重命名为 `.test` | 使 sqllogictest runner 能找到并执行测试文件 |
72+
| `--run_file` 参数更新 | 匹配新文件名 |
73+
| base trailing comma | 移除 CREATE TABLE 和 INSERT 中的 trailing comma |
74+
| revoke 期望输出 | 更新 `show grants` 的期望值 |
75+
| rbac 测试内容 | **待修复** — 需要将测试内容回退到与 writer 版本兼容的状态 |

tests/compat_fuse/test_cases.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818
- { writer: "1.2.318", reader: current, meta: [1.2.527, 1.2.677, 1.2.833], suite: rbac }
1919
- { writer: "1.2.680", reader: current, meta: [1.2.527, 1.2.680, 1.2.833], suite: udf }
2020

21+
# --- Backward compat: rbac_all (procedure/sequence/connection/warehouse) ---
22+
# Requires writer >= 1.2.832 (procedure without experimental toggle).
23+
- { writer: "1.2.833", reader: current, meta: [1.2.833], suite: rbac_all }
24+
2125
# --- Forward compat: current writer -> old reader ---
2226
- { writer: current, reader: "1.2.311", meta: [1.2.770], suite: rbac }
2327
- { writer: current, reader: "1.2.318", meta: [1.2.770], suite: rbac }
2428
- { writer: current, reader: "1.2.680", meta: [1.2.770], suite: udf }
29+
- { writer: current, reader: "1.2.833", meta: [1.2.833], suite: rbac_all }

0 commit comments

Comments
 (0)