From fe37ffdb44473506691f4ec6e6faf8161e616058 Mon Sep 17 00:00:00 2001 From: Sumukh-Phalgaonkar Date: Tue, 23 Jul 2024 12:01:32 +0530 Subject: [PATCH] [#23240] CDCSDK: Make test replicationConnectionConsumptionAllDataTypes more resilient Summary: 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 Test Plan: Jenkins: .*TestPgReplicationSlot.* Reviewers: siddharth.shah, stiwary Reviewed By: siddharth.shah Subscribers: ycdcxcluster Tags: #jenkins-ready Differential Revision: https://phorge.dev.yugabyte.com/D36763 --- .../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 4fe714230623..24f9d6871daa 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 @@ -1010,11 +1010,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', @@ -1054,11 +1057,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"),