-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add pinot-sink integration test into ci workflow #14257
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
20aba79
test: add pinot-sink integration test into ci
xuefengze 3eb2322
update
xuefengze 9e6c111
update
xuefengze 10463c5
update format
xuefengze 4061366
update
xuefengze 3bd49a7
Merge branch 'main' into fz/add_pinot_sink_test
xuefengze File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes.