From f550ee47ab185dd650631761fa306b8206a2643b Mon Sep 17 00:00:00 2001 From: Roshan Jobanputra Date: Wed, 9 Oct 2024 14:53:40 -0400 Subject: [PATCH] Add test cases to validate new refresh statement --- test/testdrive/source-tables.td | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/testdrive/source-tables.td b/test/testdrive/source-tables.td index 1f0020d7ab28d..d9712574afdec 100644 --- a/test/testdrive/source-tables.td +++ b/test/testdrive/source-tables.td @@ -288,12 +288,41 @@ var1 5678 var0 5555 6666 var1 4444 12 +# Validate that the available source references table reflects the state of the upstream +# when the create source was run +> SELECT u.name, u.namespace, u.columns + FROM mz_sources s + JOIN mz_internal.mz_source_references u ON s.id = u.source_id + WHERE + s.name = 'mysql_source' + ORDER BY u.name; +mysql_table public {a,b} + +# Create a new table in MySQL and refresh to see if the new available reference is picked up +$ mysql-execute name=mysql +USE public; +CREATE TABLE mysql_table_new (foo INTEGER, bar INTEGER); + +> REFRESH SOURCE REFERENCES mysql_source; + +> SELECT u.name, u.namespace, u.columns + FROM mz_sources s + JOIN mz_internal.mz_source_references u ON s.id = u.source_id + WHERE + s.name = 'mysql_source' + ORDER BY u.name; +mysql_table public {a,b,c} +mysql_table_new public {foo,bar} + > DROP SOURCE mysql_source CASCADE; # ensure that CASCADE propagates to the tables ! SELECT * FROM mysql_table_3; contains:unknown catalog item 'mysql_table_3' +> SELECT count(*) FROM mz_internal.mz_source_references; +0 + # # Kafka source using source-fed tables #