From a2bcd4904caa1dccdb6c39e286727beb8e28aa11 Mon Sep 17 00:00:00 2001 From: Akash Kulkarni <113392464+akashkulk@users.noreply.github.com> Date: Wed, 29 May 2024 14:44:21 -0700 Subject: [PATCH] [DB sources] : Exit when encountering a config error (#38538) --- airbyte-cdk/java/airbyte-cdk/README.md | 1 + .../integrations/base/IntegrationRunner.kt | 1 + .../src/main/resources/version.properties | 2 +- .../base/IntegrationRunnerTest.kt | 27 ------------------- .../connectors/source-mysql/build.gradle | 2 +- .../connectors/source-mysql/metadata.yaml | 2 +- docs/integrations/sources/mysql.md | 1 + 7 files changed, 6 insertions(+), 30 deletions(-) diff --git a/airbyte-cdk/java/airbyte-cdk/README.md b/airbyte-cdk/java/airbyte-cdk/README.md index 1241e376199b..4090b092551d 100644 --- a/airbyte-cdk/java/airbyte-cdk/README.md +++ b/airbyte-cdk/java/airbyte-cdk/README.md @@ -174,6 +174,7 @@ corresponds to that version. | Version | Date | Pull Request | Subject | |:--------|:-----------|:-----------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 0.36.2 | 2024-05-29 | [\#38538](https://github.com/airbytehq/airbyte/pull/38357) | Exit connector when encountering a config error. | | 0.36.0 | 2024-05-29 | [\#38358](https://github.com/airbytehq/airbyte/pull/38358) | Plumb generation_id / sync_id to destinations code | | 0.35.14 | 2024-05-28 | [\#38738](https://github.com/airbytehq/airbyte/pull/38738) | make ThreadCreationInfo cast as nullable | | 0.35.13 | 2024-05-28 | [\#38632](https://github.com/airbytehq/airbyte/pull/38632) | minor changes to allow conversion of snowflake tests to kotlin | diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/IntegrationRunner.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/IntegrationRunner.kt index 7a4a7ade3325..b22cf8c74dcb 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/IntegrationRunner.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/IntegrationRunner.kt @@ -253,6 +253,7 @@ internal constructor( ConnectorExceptionUtil.getDisplayMessage(rootConfigErrorThrowable), ) // On receiving a config error, the container should be immediately shut down. + System.exit(1) } else if (ConnectorExceptionUtil.isTransientError(rootTransientErrorThrowable)) { AirbyteTraceMessageUtility.emitTransientErrorTrace( e, diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/resources/version.properties b/airbyte-cdk/java/airbyte-cdk/core/src/main/resources/version.properties index 9e7a0d669263..663e5832f1db 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/resources/version.properties +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/resources/version.properties @@ -1 +1 @@ -version=0.36.1 +version=0.36.2 \ No newline at end of file diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/IntegrationRunnerTest.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/IntegrationRunnerTest.kt index 5bf2809155c7..7503bd2f0b7e 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/IntegrationRunnerTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/IntegrationRunnerTest.kt @@ -26,7 +26,6 @@ import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicBoolean import java.util.function.Consumer import org.apache.commons.lang3.ThreadUtils -import org.assertj.core.api.AssertionsForClassTypes import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @@ -221,32 +220,6 @@ internal class IntegrationRunnerTest { Mockito.verify(jsonSchemaValidator).validate(any(), any()) } - @Test - @Throws(Exception::class) - fun testReadException() { - val intConfig = IntegrationConfig.read(configPath, configuredCatalogPath, statePath) - val configErrorException = ConfigErrorException("Invalid configuration") - - Mockito.`when`(cliParser.parse(ARGS)).thenReturn(intConfig) - Mockito.`when`(source.read(CONFIG, CONFIGURED_CATALOG, STATE)) - .thenThrow(configErrorException) - - val expectedConnSpec = Mockito.mock(ConnectorSpecification::class.java) - Mockito.`when`(source.spec()).thenReturn(expectedConnSpec) - Mockito.`when`(expectedConnSpec.connectionSpecification).thenReturn(CONFIG) - - val jsonSchemaValidator = Mockito.mock(JsonSchemaValidator::class.java) - val throwable = - AssertionsForClassTypes.catchThrowable { - IntegrationRunner(cliParser, stdoutConsumer, null, source, jsonSchemaValidator) - .run(ARGS) - } - - AssertionsForClassTypes.assertThat(throwable).isInstanceOf(ConfigErrorException::class.java) - // noinspection resource - Mockito.verify(source).read(CONFIG, CONFIGURED_CATALOG, STATE) - } - @Test @Throws(Exception::class) fun testCheckNestedException() { diff --git a/airbyte-integrations/connectors/source-mysql/build.gradle b/airbyte-integrations/connectors/source-mysql/build.gradle index 170bae02911f..e325fbf84579 100644 --- a/airbyte-integrations/connectors/source-mysql/build.gradle +++ b/airbyte-integrations/connectors/source-mysql/build.gradle @@ -6,7 +6,7 @@ plugins { } airbyteJavaConnector { - cdkVersionRequired = '0.35.11' + cdkVersionRequired = '0.36.2' features = ['db-sources'] useLocalCdk = false } diff --git a/airbyte-integrations/connectors/source-mysql/metadata.yaml b/airbyte-integrations/connectors/source-mysql/metadata.yaml index 48b031581d81..d199f866c38f 100644 --- a/airbyte-integrations/connectors/source-mysql/metadata.yaml +++ b/airbyte-integrations/connectors/source-mysql/metadata.yaml @@ -9,7 +9,7 @@ data: connectorSubtype: database connectorType: source definitionId: 435bb9a5-7887-4809-aa58-28c27df0d7ad - dockerImageTag: 3.4.5 + dockerImageTag: 3.4.6 dockerRepository: airbyte/source-mysql documentationUrl: https://docs.airbyte.com/integrations/sources/mysql githubIssueLabel: source-mysql diff --git a/docs/integrations/sources/mysql.md b/docs/integrations/sources/mysql.md index 9e877480bce7..f72a6573f6dd 100644 --- a/docs/integrations/sources/mysql.md +++ b/docs/integrations/sources/mysql.md @@ -230,6 +230,7 @@ Any database or table encoding combination of charset and collation is supported | Version | Date | Pull Request | Subject | |:--------|:-----------| :--------------------------------------------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------| +| 3.4.6 | 2024-05-29 | [38538](https://github.com/airbytehq/airbyte/pull/38538) | Exit connector when encountering a config error. | | 3.4.5 | 2024-05-23 | [38198](https://github.com/airbytehq/airbyte/pull/38198) | Sync sending trace status messages indicating progress. | | 3.4.4 | 2024-05-15 | [38208](https://github.com/airbytehq/airbyte/pull/38208) | disable counts in full refresh stream in state message. | | 3.4.3 | 2024-05-13 | [38104](https://github.com/airbytehq/airbyte/pull/38104) | Handle transient error messages. |