Skip to content

Commit

Permalink
Load CDK: Expanded namespace coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
johnny-schmidt committed Jan 22, 2025
1 parent 60d2d64 commit b7cf463
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,9 @@ abstract class BasicFunctionalityIntegrationTest(
@Test
open fun testNamespaces() {
assumeTrue(verifyDataWriting)
fun makeStream(namespace: String) =
fun makeStream(namespace: String?, name: String = "test_stream") =
DestinationStream(
DestinationStream.Descriptor(namespace, "test_stream"),
DestinationStream.Descriptor(namespace, name),
Append,
ObjectType(linkedMapOf("id" to intType)),
generationId = 0,
Expand All @@ -460,12 +460,14 @@ abstract class BasicFunctionalityIntegrationTest(
)
val stream1 = makeStream(randomizedNamespace + "_1")
val stream2 = makeStream(randomizedNamespace + "_2")
val streamWithNullNamespace = makeStream(null, randomizedNamespace + "_stream")
runSync(
configContents,
DestinationCatalog(
listOf(
stream1,
stream2,
streamWithNullNamespace,
)
),
listOf(
Expand All @@ -481,6 +483,12 @@ abstract class BasicFunctionalityIntegrationTest(
data = """{"id": 5678}""",
emittedAtMs = 1234,
),
InputRecord(
namespace = streamWithNullNamespace.descriptor.namespace,
name = streamWithNullNamespace.descriptor.name,
data = """{"id": 91011}""",
emittedAtMs = 1234,
),
)
)
assertAll(
Expand Down Expand Up @@ -515,6 +523,22 @@ abstract class BasicFunctionalityIntegrationTest(
listOf(listOf("id")),
cursor = null
)
},
{
dumpAndDiffRecords(
parsedConfig,
listOf(
OutputRecord(
extractedAt = 1234,
generationId = 0,
data = mapOf("id" to 91011),
airbyteMeta = OutputRecord.Meta(syncId = 42)
)
),
streamWithNullNamespace,
listOf(listOf("id")),
cursor = null
)
}
)
}
Expand All @@ -525,9 +549,10 @@ abstract class BasicFunctionalityIntegrationTest(
fun makeStream(
name: String,
schema: LinkedHashMap<String, FieldType> = linkedMapOf("id" to intType),
namespaceSuffix: String = "",
) =
DestinationStream(
DestinationStream.Descriptor(randomizedNamespace, name),
DestinationStream.Descriptor(randomizedNamespace + namespaceSuffix, name),
Append,
ObjectType(schema),
generationId = 0,
Expand Down Expand Up @@ -569,6 +594,11 @@ abstract class BasicFunctionalityIntegrationTest(
"groups",
linkedMapOf("id" to intType, "authorization" to stringType)
),
makeStream(
"streamWithSpecialCharactersInNamespace",
namespaceSuffix = "_spøcial"
),
makeStream("streamWithOperatorInNamespace", namespaceSuffix = "_operator-1"),
)
)
// For each stream, generate a record containing every field in the schema.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ object AvroExpectedRecordMapper : ExpectedRecordMapper {
): DestinationStream.Descriptor {
// Map the special character but not the '+', because only the former is replaced in file
// paths.
return descriptor.copy(name = descriptor.name.replace("é", "e"))
return descriptor.copy(
namespace = descriptor.namespace?.replace("ø", "o"),
name = descriptor.name.replace("é", "e")
)
}

private fun fieldNameMangler(value: AirbyteValue): AirbyteValue =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ class GlueWriteTest :
override fun testFunkyCharacters() {
super.testFunkyCharacters()
}

@Test
@Disabled("https://github.com/airbytehq/airbyte-internal-issues/issues/11439")
override fun testNamespaces() {
super.testNamespaces()
}
}

class GlueAssumeRoleWriteTest :
Expand All @@ -126,12 +132,16 @@ class GlueAssumeRoleWriteTest :
S3DataLakeTestUtil.getAWSSystemCredentialsAsMap()
) {
@Test
@Disabled(
"https://github.com/airbytehq/airbyte-internal-issues/issues/11439"
)
@Disabled("https://github.com/airbytehq/airbyte-internal-issues/issues/11439")
override fun testFunkyCharacters() {
super.testFunkyCharacters()
}

@Test
@Disabled("https://github.com/airbytehq/airbyte-internal-issues/issues/11439")
override fun testNamespaces() {
super.testNamespaces()
}
}

@Disabled(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,7 @@ class S3V2WriteTestAvroUncompressed :
allTypesBehavior = StronglyTyped(integerCanBeLarge = false),
nullEqualsUnset = true,
nullUnknownTypes = true,
) {
@Test
override fun testUnknownTypes() {
super.testUnknownTypes()
}

@Test
override fun testFunkyCharacters() {
super.testFunkyCharacters()
}
}
)

class S3V2WriteTestAvroBzip2 :
S3V2WriteTest(
Expand Down

0 comments on commit b7cf463

Please sign in to comment.