Skip to content

Commit 24860ed

Browse files
committed
Add CloudSQLMySQLErrorDetailsProvider
1 parent fa9635e commit 24860ed

File tree

5 files changed

+47
-0
lines changed

5 files changed

+47
-0
lines changed

cloudsql-mysql-plugin/src/e2e-test/features/sink/CloudMySqlRunTimeMacro.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ Feature: CloudMySql Sink - Run time scenarios (macro)
142142
Then Enter runtime argument value "invalidTablename" for key "invalidTablename"
143143
Then Run the Pipeline in Runtime with runtime arguments
144144
Then Wait till pipeline is in running state
145+
And Open and capture logs
145146
And Verify the pipeline status is "Failed"
147+
And Close the pipeline logs
146148
Then Open Pipeline logs and verify Log entries having below listed Level and Message:
147149
| Level | Message |
148150
| ERROR | errorLogsMessageInvalidTableName |
@@ -181,7 +183,9 @@ Feature: CloudMySql Sink - Run time scenarios (macro)
181183
Then Enter runtime argument value "invalidPassword" for key "Password"
182184
Then Run the Pipeline in Runtime with runtime arguments
183185
Then Wait till pipeline is in running state
186+
And Open and capture logs
184187
And Verify the pipeline status is "Failed"
188+
And Close the pipeline logs
185189
Then Open Pipeline logs and verify Log entries having below listed Level and Message:
186190
| Level | Message |
187191
| ERROR | errorLogsMessageInvalidCredentials |

cloudsql-mysql-plugin/src/e2e-test/features/source/CloudMySqlRunTime.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,9 @@ Feature: CloudMySql Source - Run time scenarios
224224
Then Deploy the pipeline
225225
Then Run the Pipeline in Runtime
226226
Then Wait till pipeline is in running state
227+
And Open and capture logs
227228
And Verify the pipeline status is "Failed"
229+
And Close the pipeline logs
228230
Then Open Pipeline logs and verify Log entries having below listed Level and Message:
229231
| Level | Message |
230232
| ERROR | errorLogsMessageInvalidBoundingQuery |
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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.mysql;
18+
19+
20+
import io.cdap.plugin.mysql.MysqlErrorDetailsProvider;
21+
22+
/**
23+
* A custom ErrorDetailsProvider for CloudSQL MySQL plugins.
24+
*/
25+
public class CloudSQLMySQLErrorDetailsProvider extends MysqlErrorDetailsProvider {
26+
27+
@Override
28+
protected String getExternalDocumentationLink() {
29+
return "https://cloud.google.com/sql/docs/mysql/error-messages";
30+
}
31+
}

cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSink.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ String getDbColumns() {
103103
return dbColumns;
104104
}
105105

106+
@Override
107+
protected String getErrorDetailsProviderClassName() {
108+
return CloudSQLMySQLErrorDetailsProvider.class.getName();
109+
}
110+
106111
@Override
107112
protected LineageRecorder getLineageRecorder(BatchSinkContext context) {
108113
String host;

cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ protected SchemaReader getSchemaReader() {
127127
return new MysqlSchemaReader(null, cloudsqlMysqlSourceConfig.getConnectionArguments());
128128
}
129129

130+
@Override
131+
protected String getErrorDetailsProviderClassName() {
132+
return CloudSQLMySQLErrorDetailsProvider.class.getName();
133+
}
134+
130135
/** CloudSQL MySQL source config. */
131136
public static class CloudSQLMySQLSourceConfig extends AbstractDBSpecificSourceConfig {
132137

0 commit comments

Comments
 (0)