Skip to content

Commit

Permalink
test: refactor pg tvf tests into inline tests (#19004)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel authored Oct 22, 2024
1 parent f637d0f commit 9b42fb0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions ci/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
services:
# TODO: Rename this to `postgres`
db:
image: postgres:15-alpine
environment:
Expand Down
3 changes: 0 additions & 3 deletions ci/scripts/e2e-source-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ risedev slt './e2e_test/source_legacy/cdc/cdc.check_new_rows.slt'
# drop relations
risedev slt './e2e_test/source_legacy/cdc/cdc_share_stream_drop.slt'

echo "--- postgres_query tvf test"
risedev slt './e2e_test/source_legacy/tvf/postgres_query.slt'

echo "--- Kill cluster"
risedev ci-kill
export RISINGWAVE_CI=true
Expand Down
2 changes: 1 addition & 1 deletion ci/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ steps:
mount-buildkite-agent: true
upload-container-logs: always
- ./ci/plugins/upload-failure-logs
timeout_in_minutes: 18
timeout_in_minutes: 20
retry: *auto-retry

- label: "end-to-end sink test"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
control substitution on

system ok
PGDATABASE=source_test createdb

system ok
PGHOST=db PGPORT=5432 PGUSER=postgres PGPASSWORD=postgres PGDATABASE=cdc_test psql -c "
PGDATABASE=source_test psql -c "
CREATE TABLE test (
id bigint primary key,
v1 bool,
Expand All @@ -21,12 +26,12 @@ CREATE TABLE test (
);"

system ok
PGHOST=db PGPORT=5432 PGUSER=postgres PGPASSWORD=postgres PGDATABASE=cdc_test psql -c "
PGDATABASE=source_test psql -c "
INSERT INTO test SELECT generate_series(1, 100), true, 1, 1, 1, 1.0, 1.0, 1.0, '2021-01-01', '00:00:00', '2021-01-01 00:00:00', '2021-01-01 00:00:00 pst', 'text', 'varchar', '1 day', '{}', '\x01';
"

query II
select * from postgres_query('db', '5432', 'postgres', 'postgres', 'cdc_test', 'select * from test where id > 90;');
select * from postgres_query('$PGHOST', '$PGPORT', '$PGUSER', '$PGPASSWORD', 'source_test', 'select * from test where id > 90;');
----
91 t 1 1 1 1 1 1.0 2021-01-01 00:00:00 2021-01-01 00:00:00 2021-01-01 08:00:00+00:00 text varchar 1 day {} \x01
92 t 1 1 1 1 1 1.0 2021-01-01 00:00:00 2021-01-01 00:00:00 2021-01-01 08:00:00+00:00 text varchar 1 day {} \x01
Expand Down
6 changes: 6 additions & 0 deletions risedev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,12 @@ profile:
user: root
password: 123456
user-managed: true
- use: postgres
port: 5432
address: db
user: postgres
password: postgres
user-managed: true

ci-redis:
config-path: src/config/ci.toml
Expand Down
2 changes: 1 addition & 1 deletion src/risedevtool/src/risedev_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub fn generate_risedev_env(services: &Vec<ServiceConfig>) -> String {
writeln!(env, r#"PUBSUB_EMULATOR_HOST="{address}:{port}""#,).unwrap();
writeln!(env, r#"RISEDEV_PUBSUB_WITH_OPTIONS_COMMON="connector='google_pubsub',pubsub.emulator_host='{address}:{port}'""#,).unwrap();
}
ServiceConfig::Postgres(c) if c.application != Application::Metastore => {
ServiceConfig::Postgres(c) => {
let host = &c.address;
let port = &c.port;
let user = &c.user;
Expand Down

0 comments on commit 9b42fb0

Please sign in to comment.