From c9d968ea1b1dcccda917ec4c93e9d7fc83056d08 Mon Sep 17 00:00:00 2001 From: Sumukh-Phalgaonkar Date: Tue, 23 Jul 2024 19:29:41 +0530 Subject: [PATCH] [BACKPORT 2024.1][#23240] CDCSDK: Make test replicationConnectionConsumptionAllDataTypes more resilient Summary: ######Backport Description No merge conflicts were encountered. ######Original Description In the tests `TestPgReplicationSlot#replicationConnectionConsumptionAllDataTypesWithYbOutput` and `TestPgReplicationSlot#replicationConnectionConsumptionAllDataTypesWithPgOutput` we create a table with dynamic types. This means that the typeoid of such types is allocated at runtime. The tests assert on the relation message to check the type_oid of every column. This makes the tests fragile as any change in the Oids allotment will cause the test to fail. This diff makes these tests more robust by skipping the type_oid assertions for dynamic types. Jira: DB-12173 Original commit: fe37ffdb44473506691f4ec6e6faf8161e616058 / D36763 Test Plan: Jenkins: .*TestPgReplicationSlot.* Reviewers: siddharth.shah, stiwary Reviewed By: siddharth.shah Subscribers: ycdcxcluster Tags: #jenkins-ready Differential Revision: https://phorge.dev.yugabyte.com/D36773 --- .../org/yb/pgsql/TestPgReplicationSlot.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgReplicationSlot.java b/java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgReplicationSlot.java index 28fcf1fbc9d1..a229562ad6bc 100644 --- a/java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgReplicationSlot.java +++ b/java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgReplicationSlot.java @@ -1003,11 +1003,14 @@ void replicationConnectionConsumptionAllDataTypes(String pluginName) throws Exce PgOutputRelationMessageColumn.CreateForComparison("col_tstzrange", 3910), PgOutputRelationMessageColumn.CreateForComparison("col_daterange", 3912), // The Oids for columns below are not fixed. Changing the order of creation of - // objects (extensions, tables etc.) in the test will these Oids. - PgOutputRelationMessageColumn.CreateForComparison("col_hstore", 16385), + // objects (extensions, tables etc.) in the test will change these Oids. Hence, + // skip comparing the Oids of these types. + PgOutputRelationMessageColumn.CreateForComparison( + "col_hstore", 16385, /* compareDataType */ false), PgOutputRelationMessageColumn.CreateForComparison( "col_discount", 16518, /* compareDataType */ false), - PgOutputRelationMessageColumn.CreateForComparison("col_discount_array",16517)))); + PgOutputRelationMessageColumn.CreateForComparison( + "col_discount_array", 16517, /* compareDataType */ false)))); } else { // The replica identity for test_table in case of pgoutput is DEFAULT. add(PgOutputRelationMessage.CreateForComparison("public", "test_table", 'd', @@ -1047,11 +1050,14 @@ void replicationConnectionConsumptionAllDataTypes(String pluginName) throws Exce PgOutputRelationMessageColumn.CreateForComparison("col_tstzrange", 3910), PgOutputRelationMessageColumn.CreateForComparison("col_daterange", 3912), // The Oids for columns below are not fixed. Changing the order of creation of - // objects (extensions, tables etc.) in the test will these Oids. - PgOutputRelationMessageColumn.CreateForComparison("col_hstore", 16385), + // objects (extensions, tables etc.) in the test will change these Oids. Hence, + // skip comparing the Oids of these types. + PgOutputRelationMessageColumn.CreateForComparison( + "col_hstore", 16385, /* compareDataType */ false), PgOutputRelationMessageColumn.CreateForComparison( "col_discount", 16518, /* compareDataType */ false), - PgOutputRelationMessageColumn.CreateForComparison("col_discount_array",16517)))); + PgOutputRelationMessageColumn.CreateForComparison( + "col_discount_array", 16517, /* compareDataType */ false)))); } add(PgOutputInsertMessage.CreateForComparison(new PgOutputMessageTuple((short) 38, Arrays.asList(new PgOutputMessageTupleColumnValue("1"),