-
Notifications
You must be signed in to change notification settings - Fork 596
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add pinot-sink integration test into ci workflow (#14257)
- Loading branch information
1 parent
547395b
commit 1a1b0e5
Showing
10 changed files
with
75 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 13 additions & 1 deletion
14
integration_tests/pinot-sink/insert.sql → ...ration_tests/pinot-sink/create_source.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
CREATE TABLE IF NOT EXISTS orders | ||
( | ||
id INT PRIMARY KEY, | ||
user_id BIGINT, | ||
product_id BIGINT, | ||
status VARCHAR, | ||
quantity INT, | ||
total FLOAT, | ||
created_at BIGINT, | ||
updated_at BIGINT | ||
); | ||
|
||
insert into orders values (1, 10, 100, 'INIT', 1, 1.0, 1685421033000, 1685421033000); | ||
insert into orders values (2, 10, 100, 'INIT', 1, 1.0, 1685421033000, 1685421033000); | ||
insert into orders values (3, 10, 100, 'INIT', 1, 1.0, 1685421033000, 1685421033000); | ||
insert into orders values (3, 10, 100, 'INIT', 1, 1.0, 1685421033000, 1685421033000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
# setup kafka | ||
docker compose exec kafka \ | ||
kafka-topics --create --topic orders.upsert.log --bootstrap-server localhost:9092 | ||
|
||
# setup pinot | ||
docker exec -it pinot-controller /opt/pinot/bin/pinot-admin.sh AddTable \ | ||
-tableConfigFile /config/orders_table.json \ | ||
-schemaFile /config/orders_schema.json -exec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import subprocess | ||
import sys | ||
import json | ||
|
||
relations = ["orders"] | ||
|
||
failed_cases = [] | ||
for rel in relations: | ||
sql = f'SELECT COUNT(*) as count FROM {rel}' | ||
print(f"Running SQL: {sql} on Pinot") | ||
command = f'{{"sql":"{sql}"}}' | ||
rows = subprocess.check_output(["docker", "compose", "exec", "pinot-broker", "curl", "-H", "Content-Type: application/json", "-X", "POST", "-d", command, "http://localhost:8099/query/sql"]) | ||
rows = json.loads(rows.decode('utf-8'))['resultTable']['rows'][0][0] | ||
print(rows) | ||
print(f"{rows} rows in {rel}") | ||
if rows < 1: | ||
failed_cases.append(rel) | ||
|
||
# update data | ||
subprocess.run(["docker", "compose", "exec", "postgres", "bash", "-c", "psql -h risingwave-standalone -p 4566 -d dev -U root -f update.sql"]) | ||
|
||
sql = f'SELECT status FROM orders WHERE id = 1' | ||
command = f'{{"sql":"{sql}"}}' | ||
output = subprocess.check_output(["docker", "compose", "exec", "pinot-broker", "curl", "-H", "Content-Type: application/json", "-X", "POST", "-d", command, "http://localhost:8099/query/sql"]) | ||
output = json.loads(output.decode('utf-8'))['resultTable']['rows'][0][0] | ||
if output != "PROCESSING": | ||
failed_cases.append(f"expected PROCESSING, get {output}") | ||
|
||
if len(failed_cases) != 0: | ||
print(f"Data check failed for case {failed_cases}") | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
update orders set status = 'PROCESSING' where id = 1; | ||
update orders set status = 'PROCESSING' where id = 1; | ||
FLUSH; |