Skip to content

Commit fc158e9

Browse files
committed
Add CloudSQLPostgreSQLErrorDetailsProvider
1 parent 23af441 commit fc158e9

File tree

4 files changed

+43
-1
lines changed

4 files changed

+43
-1
lines changed

cloudsql-postgresql-plugin/src/e2e-test/features/source/RunTime.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ Feature: CloudSQL-PostGreSQL Source - Run Time scenarios
147147
And Save and Deploy Pipeline
148148
And Run the Pipeline in Runtime
149149
And Wait till pipeline is in running state
150+
And Open and capture logs
150151
And Verify the pipeline status is "Failed"
152+
And Close the pipeline logs
151153
Then Open Pipeline logs and verify Log entries having below listed Level and Message:
152154
| Level | Message |
153155
| ERROR | errorLogsMessageInvalidBoundingQuery |
@@ -189,6 +191,7 @@ Feature: CloudSQL-PostGreSQL Source - Run Time scenarios
189191
Then Save the pipeline
190192
Then Preview and run the pipeline
191193
Then Wait till pipeline preview is in running state
194+
Then Open and capture pipeline preview logs
192195
Then Verify the preview run status of pipeline in the logs is "failed"
193196

194197
@CLOUDSQLPOSTGRESQL_SOURCE_TEST @CLOUDSQLPOSTGRESQL_TARGET_TEST
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright © 2024 Cask Data, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
package io.cdap.plugin.cloudsql.postgres;
18+
19+
import io.cdap.plugin.db.DBErrorDetailsProvider;
20+
21+
/**
22+
* A custom ErrorDetailsProvider for CloudSQL PostgreSQL plugin.
23+
*/
24+
public class CloudSQLPostgreSQLErrorDetailsProvider extends DBErrorDetailsProvider {
25+
@Override
26+
protected String getExternalDocumentationLink() {
27+
return "https://www.postgresql.org/docs/current/errcodes-appendix.html";
28+
}
29+
}

cloudsql-postgresql-plugin/src/main/java/io/cdap/plugin/cloudsql/postgres/CloudSQLPostgreSQLSink.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ protected LineageRecorder getLineageRecorder(BatchSinkContext context) {
147147
return new LineageRecorder(context, assetBuilder.build());
148148
}
149149

150+
@Override
151+
protected String getErrorDetailsProviderClassName() {
152+
return CloudSQLPostgreSQLErrorDetailsProvider.class.getName();
153+
}
154+
150155
/** CloudSQL PostgreSQL sink config. */
151156
public static class CloudSQLPostgreSQLSinkConfig extends AbstractDBSpecificSinkConfig {
152157

cloudsql-postgresql-plugin/src/main/java/io/cdap/plugin/cloudsql/postgres/CloudSQLPostgreSQLSource.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public CloudSQLPostgreSQLSource(CloudSQLPostgreSQLSourceConfig cloudsqlPostgresq
6060
super(cloudsqlPostgresqlSourceConfig);
6161
this.cloudsqlPostgresqlSourceConfig = cloudsqlPostgresqlSourceConfig;
6262
}
63-
63+
6464
@Override
6565
public void configurePipeline(PipelineConfigurer pipelineConfigurer) {
6666
FailureCollector failureCollector = pipelineConfigurer.getStageConfigurer().getFailureCollector();
@@ -86,6 +86,11 @@ protected Class<? extends DBWritable> getDBRecordType() {
8686
return PostgresDBRecord.class;
8787
}
8888

89+
@Override
90+
protected String getErrorDetailsProviderClassName() {
91+
return CloudSQLPostgreSQLErrorDetailsProvider.class.getName();
92+
}
93+
8994
@Override
9095
protected String createConnectionString() {
9196
if (CloudSQLUtil.PRIVATE_INSTANCE.equalsIgnoreCase(

0 commit comments

Comments
 (0)