Skip to content

Commit

Permalink
destination-e2e: convert test code to kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-airbyte committed Sep 18, 2024
1 parent b64a103 commit 9024b73
Show file tree
Hide file tree
Showing 11 changed files with 239 additions and 235 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ data:
connectorSubtype: file
connectorType: destination
definitionId: a7bcc9d8-13b3-4e49-b80d-d020b90045e3
dockerImageTag: 0.4.0
dockerImageTag: 0.4.1
dockerRepository: airbyte/destination-dev-null
githubIssueLabel: destination-dev-null
icon: airbyte.svg
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright (c) 2023 Airbyte, Inc., all rights reserved.
*/
package io.airbyte.integrations.destination.dev_null

import com.fasterxml.jackson.databind.JsonNode
import io.airbyte.cdk.integrations.standardtest.destination.DestinationAcceptanceTest
import io.airbyte.commons.json.Jsons
import io.airbyte.protocol.models.v0.AirbyteMessage
import io.airbyte.protocol.models.v0.AirbyteRecordMessage
import java.util.*
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test

class DevNullDestinationAcceptanceTest : DestinationAcceptanceTest() {
override fun getImageName(): String {
return "airbyte/destination-dev-null:dev"
}

override fun getConfig(): JsonNode {
return Jsons.jsonNode(
Collections.singletonMap(
"test_destination",
Collections.singletonMap("test_destination_type", "SILENT")
)
)
}

override fun getFailCheckConfig(): JsonNode {
return Jsons.jsonNode(
Collections.singletonMap(
"test_destination",
Collections.singletonMap("test_destination_type", "invalid")
)
)
}

override fun retrieveRecords(
testEnv: TestDestinationEnv,
streamName: String,
namespace: String?,
streamSchema: JsonNode
): List<JsonNode> {
return emptyList()
}

override fun setup(testEnv: TestDestinationEnv, TEST_SCHEMAS: HashSet<String>) {
// do nothing
}

override fun tearDown(testEnv: TestDestinationEnv) {
// do nothing
}

override fun assertSameMessages(
expected: List<AirbyteMessage>,
actual: List<AirbyteRecordMessage>,
pruneAirbyteInternalFields: Boolean
) {
Assertions.assertEquals(0, actual.size)
}

// Skip because `retrieveRecords` returns an empty list at all times.
@Disabled @Test override fun testSyncNotFailsWithNewFields() {}

// This test assumes that dedup support means normalization support.
// Override it to do nothing.
@Disabled
@Test
@Throws(Exception::class)
override fun testIncrementalDedupeSync() {
super.testIncrementalDedupeSync()
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2023 Airbyte, Inc., all rights reserved.
*/
package io.airbyte.integrations.destination.dev_null

import io.airbyte.commons.json.Jsons
import io.airbyte.commons.resources.MoreResources
import io.airbyte.protocol.models.v0.ConnectorSpecification
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test

internal class DevNullDestinationTest {
@Test
@Throws(Exception::class)
fun testSpec() {
val actual = DevNullDestination().spec()
val expected =
Jsons.deserialize(
MoreResources.readResource("expected_spec.json"),
ConnectorSpecification::class.java
)

Assertions.assertEquals(expected, actual)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ data:
connectorSubtype: unknown
connectorType: destination
definitionId: 2eb65e87-983a-4fd7-b3e3-9d9dc6eb8537
dockerImageTag: 0.4.0
dockerImageTag: 0.4.1
dockerRepository: airbyte/destination-e2e-test
githubIssueLabel: destination-e2e-test
icon: airbyte.svg
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright (c) 2023 Airbyte, Inc., all rights reserved.
*/
package io.airbyte.integrations.destination.e2e_test

import com.fasterxml.jackson.databind.JsonNode
import io.airbyte.cdk.integrations.standardtest.destination.DestinationAcceptanceTest
import io.airbyte.commons.json.Jsons
import io.airbyte.integrations.destination.e2e_test.TestingDestinations.TestDestinationType
import io.airbyte.protocol.models.v0.*
import java.util.*
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test

class TestingSilentDestinationAcceptanceTest : DestinationAcceptanceTest() {
override fun getImageName(): String {
return "airbyte/destination-e2e-test:dev"
}

override fun getConfig(): JsonNode {
return Jsons.jsonNode(
Collections.singletonMap(
"test_destination",
Collections.singletonMap("test_destination_type", TestDestinationType.SILENT.name)
)
)
}

override fun getFailCheckConfig(): JsonNode {
return Jsons.jsonNode(
Collections.singletonMap(
"test_destination",
Collections.singletonMap("test_destination_type", "invalid")
)
)
}

override fun retrieveRecords(
testEnv: TestDestinationEnv?,
streamName: String?,
namespace: String?,
streamSchema: JsonNode?
): List<JsonNode> {
return emptyList()
}

override fun setup(testEnv: TestDestinationEnv, TEST_SCHEMAS: HashSet<String>) {
// do nothing
}

override fun tearDown(testEnv: TestDestinationEnv) {
// do nothing
}

override fun assertSameMessages(
expected: List<AirbyteMessage>,
actual: List<AirbyteRecordMessage>,
pruneAirbyteInternalFields: Boolean
) {
Assertions.assertEquals(0, actual.size)
}

// Skip because `retrieveRecords` returns an empty list at all times.
@Disabled @Test override fun testSyncNotFailsWithNewFields() {}

// This test assumes that dedup support means normalization support.
// Override it to do nothing.
@Disabled
@Test
@Throws(Exception::class)
override fun testIncrementalDedupeSync() {
super.testIncrementalDedupeSync()
}
}
Loading

0 comments on commit 9024b73

Please sign in to comment.