Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public abstract class JDBCBaseIT extends TemplateTestBase {
// The versions of each of the JDBC drivers to use.
// NOTE: These versions must correspond to the versions declared in the `pom.xml` file.
private static final String MYSQL_VERSION = "8.0.30";
private static final String POSTGRES_VERSION = "42.6.1";
private static final String POSTGRES_VERSION = "42.7.10";
private static final String ORACLE_VERSION = "23.9.0.25.07";
private static final String MSSQL_VERSION = "13.2.1.jre11";

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<!-- Note: File it/src/main/java/com/google/cloud/teleport/it/common/JDBCBaseIT.java -->
<!-- should be updated when these versions are changed. -->
<mysql-connector-java.version>8.0.30</mysql-connector-java.version>
<postgresql.version>42.6.1</postgresql.version>
<postgresql.version>42.7.10</postgresql.version>
<ojdbc8.version>23.26.1.0.0</ojdbc8.version>
<mssql-jdbc.version>13.4.0.jre11</mssql-jdbc.version>
<neo4j-driver.version>5.28.12</neo4j-driver.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,15 @@ public void testDataStreamPostgresToPostgres() throws IOException {
}

private void runTest(String sourceTableName) throws IOException {
this.replicationSlot = "ds_it_slot_" + RandomStringUtils.randomAlphanumeric(4).toLowerCase();
String publication = "ds_it_pub_" + RandomStringUtils.randomAlphanumeric(4).toLowerCase();
String user = cloudSqlSourceResourceManager.getUsername();
String schema = cloudSqlSourceResourceManager.getDatabaseName();
cloudSqlSourceResourceManager.runSQLUpdate(
String.format("ALTER USER %s WITH REPLICATION;", user));

// Try to create the replication slot, with retry logic if slots are full
createReplicationSlotWithRetry(this.replicationSlot);
cloudSqlSourceResourceManager.runSQLUpdate(
String.format(
"CREATE PUBLICATION %s FOR TABLE %s.%s;", publication, schema, sourceTableName));
CloudPostgresResourceManager.ReplicationInfo replicationInfo =
cloudSqlSourceResourceManager.createLogicalReplication(
List.of(cloudSqlSourceResourceManager.getFullTableName(sourceTableName)));
this.replicationSlot = replicationInfo.getReplicationSlotName();
String publication = replicationInfo.getPublicationName();

cloudSqlSourceResourceManager.runSQLUpdate(
String.format("GRANT USAGE ON SCHEMA %s TO %s;", schema, user));
cloudSqlSourceResourceManager.runSQLUpdate(
Expand All @@ -175,9 +172,9 @@ private void runTest(String sourceTableName) throws IOException {
.setAllowedTables(
Map.of(cloudSqlSourceResourceManager.getDatabaseName(), List.of(sourceTableName)))
.build();
String gcsPrefix = getGcsPath(testName + "/cdc/").replace("gs://" + artifactBucketName, "");
String gcsPrefixForNotification =
getGcsPath(testName + "/cdc/").replace("gs://" + artifactBucketName + "/", "");
String gcsPrefix = gcsPrefixForNotification;
SourceConfig sourceConfig =
datastreamResourceManager.buildJDBCSourceConfig("postgres-profile", jdbcSource);
DestinationConfig destinationConfig =
Expand Down Expand Up @@ -206,6 +203,7 @@ private void runTest(String sourceTableName) throws IOException {
.addParameter("inputFileFormat", "json")
.addParameter("streamName", stream.getName())
.addParameter("databaseType", "postgres")
.addParameter("datastreamSourceType", "postgresql")
.addParameter("databaseName", cloudSqlDestinationResourceManager.getDatabaseName())
.addParameter("schemaMap", schemaMap)
.addParameter("databaseHost", cloudSqlDestinationResourceManager.getHost())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ public void setUp() throws IOException {
.setPassword(password)
.build();

gcsPrefix = getGcsPath(testName + "/cdc/").replace("gs://" + artifactBucketName, "");
dlqGcsPrefix = getGcsPath(testName + "/dlq/").replace("gs://" + artifactBucketName, "");
gcsPrefix = getGcsPath(testName + "/cdc/").replace("gs://" + artifactBucketName + "/", "");
dlqGcsPrefix = getGcsPath(testName + "/dlq/").replace("gs://" + artifactBucketName + "/", "");
}

@After
Expand Down Expand Up @@ -448,8 +448,8 @@ private SubscriptionName createGcsNotifications() throws IOException {
TopicName dlqTopic = pubsubResourceManager.createTopic("dlq");
SubscriptionName subscription = pubsubResourceManager.createSubscription(topic, "it-sub");

gcsClient.createNotification(topic.toString(), gcsPrefix.substring(1));
gcsClient.createNotification(dlqTopic.toString(), dlqGcsPrefix.substring(1));
gcsClient.createNotification(topic.toString(), gcsPrefix);
gcsClient.createNotification(dlqTopic.toString(), dlqGcsPrefix);

return subscription;
}
Expand Down
Loading