Skip to content

Commit

Permalink
add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
StrikeW committed Sep 19, 2024
1 parent 32a5f04 commit d77f47c
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
25 changes: 25 additions & 0 deletions e2e_test/source/cdc_inline/auto_schema_map_mysql.slt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ mysql --protocol=tcp -u root mytest -e "
);
INSERT INTO mysql_types_test VALUES ( False, 0, null, null, -8388608, -2147483647, 9223372036854775806, -10.0, -9999.999999, -10000.0, 'c', 'd', '', '', '1001-01-01', '-838:59:59.000000', '2000-01-01 00:00:00.000000', null, 'happy', '[1,2]');
INSERT INTO mysql_types_test VALUES ( True, 1, -128, -32767, -8388608, -2147483647, -9223372036854775807, -10.0, -9999.999999, -10000.0, 'a', 'b', '', '', '1001-01-01', '00:00:00', '1998-01-01 00:00:00.000000', '1970-01-01 00:00:01', 'sad', '[3,4]');
CREATE TABLE IF NOT EXISTS test_default(
id int,
name varchar(255) DEFAULT 'default_name',
age int DEFAULT 18,
v1 real DEFAULT 1.1,
v2 double precision DEFAULT 2.2,
v3 decimal(5,2) DEFAULT 3.3,
v4 boolean DEFAULT false,
v5 date DEFAULT '2020-01-01',
v6 time DEFAULT '12:34:56',
v7 timestamp DEFAULT '2020-01-01 12:34:56',
v8 datetime DEFAULT '2020-01-01 12:34:56'
);
INSERT INTO test_default(id) VALUES (1),(2);
"

statement ok
Expand Down Expand Up @@ -70,6 +84,17 @@ HINT: Please define the schema manually
statement ok
ALTER SYSTEM SET license_key TO DEFAULT;

statement ok
create table test_default (*) from mysql_source table 'mytest.test_default';
sleep 3s

query TTTTTTTTTTTTT
SELECT * FROM test_default order by id;
----
1 default_name 18 1.1 2.2 3.30 f 2020-01-01 12:34:56 2020-01-01 12:34:56 2020-01-01 12:34:56+00
2 default_name 18 1.1 2.2 3.30 f 2020-01-01 12:34:56 2020-01-01 12:34:56 2020-01-01 12:34:56+00


statement ok
create table rw_customers (*) from mysql_source table 'mytest.customers';

Expand Down
34 changes: 34 additions & 0 deletions e2e_test/source/cdc_inline/auto_schema_map_pg.slt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,24 @@ psql -c "
INSERT INTO postgres_types_test VALUES ( False, -32767, -2147483647, -9223372036854775807, -10.0, -9999.999999, -10000.0, 'd', '00'::bytea, '0001-01-01', '00:00:00', '2001-01-01 00:00:00'::timestamp, '2001-01-01 00:00:00-8'::timestamptz, interval '0 second', '{}', 'bb488f9b-330d-4012-b849-12adeb49e57e', 'happy', array[False::boolean]::boolean[], array[-32767::smallint]::smallint[], array[-2147483647::integer]::integer[], array[-9223372036854775807::bigint]::bigint[], array[-10.0::decimal]::decimal[], array[-9999.999999::real]::real[], array[-10000.0::double precision]::double precision[], array[''::varchar]::varchar[], array['00'::bytea]::bytea[], array['0001-01-01'::date]::date[], array['00:00:00'::time]::time[], array['2001-01-01 00:00:00'::timestamp::timestamp]::timestamp[], array['2001-01-01 00:00:00-8'::timestamptz::timestamptz]::timestamptz[], array[interval '0 second'::interval]::interval[], array['{}'::jsonb]::jsonb[], '{bb488f9b-330d-4012-b849-12adeb49e57e}', '{happy,ok,sad}');
INSERT INTO postgres_types_test VALUES ( False, 1, 123, 1234567890, 123.45, 123.45, 123.456, 'a_varchar', 'DEADBEEF'::bytea, '0024-01-01', '12:34:56', '2024-05-19 12:34:56', '2024-05-19 12:34:56+00', INTERVAL '1 day', to_jsonb('hello'::text), '123e4567-e89b-12d3-a456-426614174000', 'happy', ARRAY[NULL, TRUE]::boolean[], ARRAY[NULL, 1::smallint], ARRAY[NULL, 123], ARRAY[NULL, 1234567890], ARRAY[NULL, 123.45::numeric], ARRAY[NULL, 123.45::real], ARRAY[NULL, 123.456], ARRAY[NULL, 'a_varchar'], ARRAY[NULL, 'DEADBEEF'::bytea], ARRAY[NULL, '2024-05-19'::date], ARRAY[NULL, '12:34:56'::time], ARRAY[NULL, '2024-05-19 12:34:56'::timestamp], ARRAY[NULL, '2024-05-19 12:34:56+00'::timestamptz], ARRAY[NULL, INTERVAL '1 day'], ARRAY[NULL, to_jsonb('hello'::text)], ARRAY[NULL, '123e4567-e89b-12d3-a456-426614174000'::uuid], ARRAY[NULL, 'happy'::mood]);
INSERT INTO postgres_types_test VALUES ( False, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, '0024-05-19', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

CREATE TABLE IF NOT EXISTS test_default(
id int,
name varchar(255) DEFAULT 'default_name',
age int DEFAULT 18,
v1 real DEFAULT 1.1,
v2 double precision DEFAULT 2.2,
v3 numeric DEFAULT 3.3,
v4 boolean DEFAULT false,
v5 date DEFAULT '2020-01-01',
v6 time DEFAULT '12:34:56',
v7 timestamp DEFAULT '2020-01-01 12:34:56',
v8 timestamptz DEFAULT '2020-01-01 12:34:56+00',
v9 interval DEFAULT '1 day',
v10 jsonb DEFAULT '{}',
PRIMARY KEY (id)
);
INSERT INTO test_default(id,name,age) VALUES (1, 'name1', 20), (2, 'name2', 21), (3, 'name3', 22);
"

statement ok
Expand All @@ -58,6 +76,22 @@ create source pg_source with (
slot.name = 'pg_slot'
);

statement ok
create table test_default (*) from pg_source table 'public.test_default';
sleep 3s

statement ok
insert into test_default(id) values (4),(5);

query TTTTTTTTTTTTT
SELECT * from test_default order by id;
----
1 name1 20 1.1 2.2 3.3 f 2020-01-01 12:34:56 2020-01-01 12:34:56 2020-01-01 12:34:56+00 1 day {}
2 name2 21 1.1 2.2 3.3 f 2020-01-01 12:34:56 2020-01-01 12:34:56 2020-01-01 12:34:56+00 1 day {}
3 name3 22 1.1 2.2 3.3 f 2020-01-01 12:34:56 2020-01-01 12:34:56 2020-01-01 12:34:56+00 1 day {}
4 default_name 18 1.1 2.2 3.3 f 2020-01-01 12:34:56 2020-01-01 12:34:56 2020-01-01 12:34:56+00 1 day {}
5 default_name 18 1.1 2.2 3.3 f 2020-01-01 12:34:56 2020-01-01 12:34:56 2020-01-01 12:34:56+00 1 day {}


statement ok
create table rw_postgres_types_test (*) from pg_source table 'public.postgres_types_test';
Expand Down

0 comments on commit d77f47c

Please sign in to comment.