1
0
mirror of synced 2025-12-23 21:03:15 -05:00

Source Postgres: Added additional unit tests for postgres spec (#26430)

* additional unit testing added for postgres source connector spec.

* Fixed character issues in postgres unit tests.

* Fix the removal of testing comment.

---------

Co-authored-by: Marcos Marx <marcosmarxm@users.noreply.github.com>
This commit is contained in:
Danny Do
2023-05-24 08:12:17 -07:00
committed by GitHub
parent 804087a052
commit 0032a7703a

View File

@@ -157,4 +157,39 @@ public class PostgresSpecTest {
assertTrue(validator.test(schema, config));
}
@Test
void testLsnCommitBehaviourPropertyWithWrongValue() {
final JsonNode replicationMethod = Jsons.jsonNode(ImmutableMap.builder()
.put("method", "CDC")
.put("replication_slot", "replication_slot")
.put("publication", "PUBLICATION")
.put("plugin", "pgoutput")
.put("initial_waiting_seconds", 30)
.put("lsn_commit_behaviour", "wrong_value")
.build());
final JsonNode config = Jsons.jsonNode(ImmutableMap.builder()
.put(JdbcUtils.HOST_KEY, "host")
.put(JdbcUtils.PORT_KEY, 5432)
.put(JdbcUtils.DATABASE_KEY, "dbName")
.put(JdbcUtils.SCHEMAS_KEY, List.of("MODELS_SCHEMA", "MODELS_SCHEMA" + "_random"))
.put(JdbcUtils.USERNAME_KEY, "user")
.put(JdbcUtils.PASSWORD_KEY, "password")
.put(JdbcUtils.SSL_KEY, false)
.put("replication_method", replicationMethod)
.build());
assertFalse(validator.test(schema, config));
}
@Test
void testPortProperty() {
final JsonNode config = Jsons.deserialize(CONFIGURATION);
assertTrue(validator.test(schema, config));
}
@Test
void testPortMissing() {
final JsonNode config = Jsons.deserialize(CONFIGURATION);
((ObjectNode) config).remove(JdbcUtils.PORT_KEY);
assertFalse(validator.test(schema, config));
}
}