Skip to content

Commit 01334e5

Browse files
authored
Merge branch 'main' into feat/support-catalog-property-removal
2 parents 3d03a26 + bc6af37 commit 01334e5

File tree

3 files changed

+80
-26
lines changed

3 files changed

+80
-26
lines changed

tests/templates/kuttl/opa-authorization/02-install-minio.yaml.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ commands:
55
- script: >-
66
helm install minio
77
--namespace $NAMESPACE
8-
--version 12.6.4
8+
--version 15.0.7
99
-f helm-bitnami-minio-values.yaml
10-
--repo https://charts.bitnami.com/bitnami minio
10+
oci://registry-1.docker.io/bitnamicharts/minio
1111
timeout: 240

tests/templates/kuttl/opa-authorization/check-opa.py

Lines changed: 75 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from trino.exceptions import TrinoUserError
88

99
import urllib3
10+
1011
urllib3.disable_warnings()
1112

1213
# Currently missing operation checks:
@@ -32,7 +33,13 @@
3233
# ExecuteQuery, FilterCatalogs
3334
{
3435
"query": "SHOW CATALOGS",
35-
"expected": [["iceberg"], ["lakehouse"], ["system"], ["tpcds"], ["tpch"]],
36+
"expected": [
37+
["iceberg"],
38+
["lakehouse"],
39+
["system"],
40+
["tpcds"],
41+
["tpch"],
42+
],
3643
},
3744
# ExecuteQuery, FilterCatalogs, ImpersonateUser
3845
{
@@ -44,18 +51,34 @@
4451
{
4552
"query": "SET SESSION iceberg.test=true",
4653
# The requests are authorized, just a fake property
47-
"error": "Session property 'iceberg.test' does not exist",
54+
"error": "Session property iceberg.test does not exist",
4855
},
4956
# ## SCHEMA ##
5057
# ExecuteQuery, AccessCatalog, ShowSchemas, SelectFromColumns, FilterCatalogs, FilterSchemas
5158
{
5259
"query": "SHOW SCHEMAS in tpch",
53-
"expected": [["information_schema"], ["sf1"], ["sf100"], ["sf1000"], ["sf10000"], ["sf100000"], ["sf300"], ["sf3000"], ["sf30000"], ["tiny"]],
60+
"expected": [
61+
["information_schema"],
62+
["sf1"],
63+
["sf100"],
64+
["sf1000"],
65+
["sf10000"],
66+
["sf100000"],
67+
["sf300"],
68+
["sf3000"],
69+
["sf30000"],
70+
["tiny"],
71+
],
5472
},
5573
# ExecuteQuery, AccessCatalog, ShowSchemas, SelectFromColumns, FilterCatalogs, FilterSchemas
5674
{
5775
"query": "SHOW SCHEMAS in system",
58-
"expected": [["information_schema"], ["jdbc"], ["metadata"], ["runtime"]],
76+
"expected": [
77+
["information_schema"],
78+
["jdbc"],
79+
["metadata"],
80+
["runtime"],
81+
],
5982
},
6083
# ExecuteQuery, AccessCatalog, CreateSchema
6184
{
@@ -65,7 +88,11 @@
6588
# ExecuteQuery, AccessCatalog, ShowCreateSchema
6689
{
6790
"query": "SHOW CREATE SCHEMA iceberg.test",
68-
"expected": [["CREATE SCHEMA iceberg.test\nAUTHORIZATION USER admin\nWITH (\n location = 's3a://trino/iceberg/test'\n)"]],
91+
"expected": [
92+
[
93+
"CREATE SCHEMA iceberg.test\nAUTHORIZATION USER admin\nWITH (\n location = 's3a://trino/iceberg/test'\n)"
94+
]
95+
],
6996
},
7097
# ExecuteQuery, AccessCatalog, SetSchemaAuthorization
7198
{
@@ -88,7 +115,16 @@
88115
# ExecuteQuery, AccessCatalog, ShowTables, SelectFromColumns, FilterCatalogs, FilterTables
89116
{
90117
"query": "SHOW TABLES in tpch.sf1",
91-
"expected": [["customer"], ["lineitem"], ["nation"], ["orders"], ["part"], ["partsupp"], ["region"], ["supplier"]],
118+
"expected": [
119+
["customer"],
120+
["lineitem"],
121+
["nation"],
122+
["orders"],
123+
["part"],
124+
["partsupp"],
125+
["region"],
126+
["supplier"],
127+
],
92128
},
93129
# ExecuteQuery, AccessCatalog, CreateTable
94130
{
@@ -129,7 +165,10 @@
129165
# ExecuteQuery, AccessCatalog, ShowColumns, SelectFromColumns, FilterCatalogs, FilterTables, FilterColumns
130166
{
131167
"query": "DESCRIBE iceberg.test.test",
132-
"expected": [["col1", "bigint", "", "This is a column comment!"], ["col2", "bigint", "", ""]],
168+
"expected": [
169+
["col1", "bigint", "", "This is a column comment!"],
170+
["col2", "bigint", "", ""],
171+
],
133172
},
134173
# ExecuteQuery, AccessCatalog, InsertIntoTable
135174
{
@@ -194,7 +233,11 @@
194233
# ExecuteQuery, AccessCatalog, ShowCreateTable
195234
{
196235
"query": "SHOW CREATE VIEW iceberg.test.v_customer_renamed",
197-
"expected": [["CREATE VIEW iceberg.test.v_customer_renamed COMMENT 'This is a test view!' SECURITY DEFINER AS\nSELECT\n name\n, address\nFROM\n tpch.sf1.customer"]],
236+
"expected": [
237+
[
238+
"CREATE VIEW iceberg.test.v_customer_renamed COMMENT 'This is a test view!' SECURITY DEFINER AS\nSELECT\n name\n, address\nFROM\n tpch.sf1.customer"
239+
]
240+
],
198241
},
199242
# ExecuteQuery, AccessCatalog, DropView
200243
{
@@ -250,7 +293,7 @@
250293
# ## SystemSessionProperties ##
251294
# ExecuteQuery, SetSystemSessionProperty
252295
{
253-
"query": "SET SESSION optimize_hash_generation = true",
296+
"query": "SET SESSION dictionary_aggregation = true",
254297
"expected": [],
255298
},
256299
# ## PROCEDURES ##
@@ -266,14 +309,13 @@
266309
"query": "SELECT COUNT(*) FROM (SELECT * FROM system.runtime.queries LIMIT 1)",
267310
"expected": [[1]],
268311
},
269-
270312
# ## CLEAN UP ##
271313
# ExecuteQuery, AccessCatalog, DropSchema
272314
{
273315
"query": "DROP SCHEMA iceberg.test",
274316
"expected": [],
275317
},
276-
]
318+
],
277319
},
278320
{
279321
# User lakehouse can:
@@ -313,7 +355,18 @@
313355
},
314356
{
315357
"query": "SELECT * FROM lakehouse.sf1.customer ORDER BY name LIMIT 1",
316-
"expected": [[1, 'Customer#000000001', 'IVhzIApeRb ot,c,E', 15, '25-989-741-2988', 711.56, 'BUILDING', 'to the even, regular platelets. regular, ironic epitaphs nag e']],
358+
"expected": [
359+
[
360+
1,
361+
"Customer#000000001",
362+
"IVhzIApeRb ot,c,E",
363+
15,
364+
"25-989-741-2988",
365+
711.56,
366+
"BUILDING",
367+
"to the even, regular platelets. regular, ironic epitaphs nag e",
368+
]
369+
],
317370
},
318371
{
319372
"query": "SELECT * FROM tpch.tiny.customer ORDER BY name LIMIT 1",
@@ -323,8 +376,8 @@
323376
# fake values, authorization is checked first
324377
"query": "INSERT INTO lakehouse.tiny.customer VALUES(1)",
325378
"error": "Access Denied: Cannot insert into table lakehouse.tiny.customer",
326-
}
327-
]
379+
},
380+
],
328381
},
329382
{
330383
# User banned-user cannot do anything
@@ -337,7 +390,7 @@
337390
"query": "SHOW CATALOGS",
338391
"error": "Access Denied: Cannot execute query",
339392
},
340-
]
393+
],
341394
},
342395
{
343396
# User iceberg can:
@@ -404,13 +457,12 @@
404457
"query": "DROP SCHEMA iceberg.test2",
405458
"expected": [],
406459
},
407-
]
408-
}
460+
],
461+
},
409462
]
410463

411464

412465
class TestOpa:
413-
414466
def __init__(self, test_data, namespace):
415467
self.data = test_data
416468
self.namespace = namespace
@@ -428,7 +480,9 @@ def run(self):
428480
impersonation = test["impersonation"]
429481

430482
# could be optimized to not create a connection for every call (currently due to user impersonation)
431-
connection = TestOpa.get_connection(user, password, self.namespace, impersonation)
483+
connection = TestOpa.get_connection(
484+
user, password, self.namespace, impersonation
485+
)
432486

433487
if "error" in test:
434488
error = test["error"]
@@ -444,8 +498,8 @@ def run(self):
444498
print("")
445499

446500
def log(user, query):
447-
timestamp = datetime.utcnow().isoformat(sep=' ', timespec='milliseconds')
448-
print(f'[{timestamp}] - {user:20s} -> {query}')
501+
timestamp = datetime.utcnow().isoformat(sep=" ", timespec="milliseconds")
502+
print(f"[{timestamp}] - {user:20s} -> {query}")
449503

450504
def run_query(connection, query):
451505
cursor = connection.cursor()

tests/test-definition.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ dimensions:
3232
- name: hive
3333
values:
3434
- 3.1.3
35-
- 4.0.0
35+
- 4.0.1
3636
- name: hive-latest
3737
values:
38-
- 4.0.0
38+
- 4.0.1
3939
- name: opa
4040
values:
4141
- 1.0.1
@@ -44,7 +44,7 @@ dimensions:
4444
- 3.4.0
4545
- name: zookeeper
4646
values:
47-
- 3.9.2
47+
- 3.9.3
4848
- name: keycloak
4949
values:
5050
- 25.0.0

0 commit comments

Comments
 (0)