Skip to content

Commit 202e25f

Browse files
committed
integration test successful
1 parent 318c600 commit 202e25f

3 files changed

Lines changed: 21 additions & 35 deletions

File tree

tests/templates/kuttl/client-spooling/03-install-test-helper.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spec:
1616
resources:
1717
requests:
1818
cpu: "250m"
19-
memory: "512Mi"
19+
memory: "1024Mi"
2020
limits:
2121
cpu: "250m"
22-
memory: "1024Mi"
22+
memory: "2048Mi"
Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
import trino
33
import argparse
4+
import urllib3
45

56

67
def get_connection(coordinator):
@@ -17,6 +18,8 @@ def get_connection(coordinator):
1718

1819

1920
if __name__ == "__main__":
21+
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
22+
2023
# Construct an argument parser
2124
all_args = argparse.ArgumentParser()
2225

@@ -35,42 +38,25 @@ def get_connection(coordinator):
3538
try:
3639
cursor = conn.cursor()
3740

38-
# Test that TPCH connector is working
39-
cursor.execute("SELECT COUNT(*) FROM tpch.tiny.nation")
40-
result = cursor.fetchone()
41-
if result[0] != 25: # TPCH tiny.nation has 25 rows
42-
print(f"TPCH test failed: expected 25 nations, got {result[0]}")
43-
exit(-1)
44-
45-
print("TPCH connector test passed")
41+
print("🚜 fetching many rows from Trino to trigger spooling...")
4642

47-
# Test a more complex query
48-
cursor.execute("""
49-
SELECT
50-
nation.name,
51-
COUNT(*) AS num_cust
52-
FROM
53-
tpch.tiny.customer
54-
JOIN
55-
tpch.tiny.nation ON customer.nationkey = nation.nationkey
56-
GROUP BY
57-
nation.name
58-
ORDER BY
59-
num_cust DESC
60-
""")
61-
results = cursor.fetchall()
62-
if len(results) == 0:
63-
print("Complex query returned no results")
64-
exit(-1)
43+
cursor.execute("SELECT * FROM tpch.sf100.customer")
44+
customer_count = 0
45+
batch = 10
46+
while batch > 0:
47+
print(f"⏳ fetching batch {batch} of 1000 rows...")
48+
cursor.fetchmany(1_000)
49+
customer_count += 1_000
50+
batch = batch - 1
51+
# assert customer_count == 15_000_000, f"TPCH test failed: expected 15 mil customers, got {customer_count}"
6552

66-
print("Complex query test passed")
53+
print("🎉 major success!")
6754

6855
cursor.close()
69-
conn.close()
7056

7157
except Exception as e:
72-
print(f"Test failed with error: {e}")
73-
import traceback
58+
print(f"💀 oh noes! cannot fetch customers from Trino: {e}")
59+
raise e
7460

75-
traceback.print_exc()
76-
exit(-1)
61+
finally:
62+
conn.close()

tests/templates/kuttl/client-spooling/05-assert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ kind: TestAssert
44
timeout: 300
55
commands:
66
- script: kubectl exec -n $NAMESPACE trino-test-helper -- python /tmp/check-active-workers.py -u admin -p "" -c trino-coordinator -w 2
7+
- script: kubectl exec -n $NAMESPACE deployment/minio -- mc alias set local https://localhost:9000 minioAccessKey minioSecretKey --api S3v4
78
# Verify that the spooling bucket contains data
89
- script: |
9-
kubectl exec -n $NAMESPACE deployment/minio -- mc alias set local https://localhost:9000 minioAccessKey minioSecretKey --api S3v4
1010
count=$(kubectl exec -n $NAMESPACE deployment/minio -- mc stat --insecure local/spooling-bucket | awk '/Objects count:/ {print $3}')
1111
if [ "$count" -gt 0 ]; then
1212
echo "Objects count is $count (> 0)"

0 commit comments

Comments
 (0)