-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write DAT(s) that test different type combinations #10325
Merged
DoNotPanicUA
merged 12 commits into
master
from
aleonets/9443-data-type-acceptence-test
Feb 23, 2022
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d368362
add data type test with compatibility support
DoNotPanicUA d1eddac
add data for basic data type tests
DoNotPanicUA 35d94a7
use test with normalization
DoNotPanicUA 07fae9d
run the test using or not using normalization based on a destination
DoNotPanicUA 1c7f645
add object test data + schema
DoNotPanicUA ba6967a
add array test data + schema
DoNotPanicUA a1515a7
add object/array/object test data + schema
DoNotPanicUA 1749b03
format
DoNotPanicUA 2690fed
Update airbyte-integrations/bases/standard-destination-test/src/main/…
DoNotPanicUA 83f6cd6
Merge remote-tracking branch 'origin/master' into aleonets/9443-data-…
DoNotPanicUA 16ed25e
Merge remote-tracking branch 'origin/aleonets/9443-data-type-accepten…
DoNotPanicUA a1a2294
review
DoNotPanicUA File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
88 changes: 88 additions & 0 deletions
88
...n/java/io/airbyte/integrations/standardtest/destination/DataTypeTestArgumentProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* Copyright (c) 2021 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.integrations.standardtest.destination; | ||
|
||
import java.util.stream.Stream; | ||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.ArgumentsProvider; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class DataTypeTestArgumentProvider implements ArgumentsProvider { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(DataTypeTestArgumentProvider.class); | ||
|
||
public static final CatalogMessageTestConfigWithCompatibility BASIC_TEST = | ||
new CatalogMessageTestConfigWithCompatibility("data_type_basic_test_catalog.json", "data_type_basic_test_messages.txt", | ||
new TestCompatibility(true, false, false)); | ||
public static final CatalogMessageTestConfigWithCompatibility ARRAY_TEST = | ||
new CatalogMessageTestConfigWithCompatibility("data_type_array_test_catalog.json", "data_type_array_test_messages.txt", | ||
new TestCompatibility(true, true, false)); | ||
public static final CatalogMessageTestConfigWithCompatibility OBJECT_TEST = | ||
new CatalogMessageTestConfigWithCompatibility("data_type_object_test_catalog.json", "data_type_object_test_messages.txt", | ||
new TestCompatibility(true, false, true)); | ||
public static final CatalogMessageTestConfigWithCompatibility OBJECT_WITH_ARRAY_TEST = | ||
new CatalogMessageTestConfigWithCompatibility("data_type_array_object_test_catalog.json", "data_type_array_object_test_messages.txt", | ||
new TestCompatibility(true, true, true)); | ||
|
||
@Override | ||
public Stream<? extends Arguments> provideArguments(ExtensionContext context) throws Exception { | ||
return Stream.of( | ||
getArguments(BASIC_TEST), | ||
getArguments(ARRAY_TEST), | ||
getArguments(OBJECT_TEST), | ||
getArguments(OBJECT_WITH_ARRAY_TEST)); | ||
} | ||
|
||
private Arguments getArguments(CatalogMessageTestConfigWithCompatibility testConfig) { | ||
return Arguments.of(testConfig.messageFile, testConfig.catalogFile, testConfig.testCompatibility); | ||
} | ||
|
||
public record TestCompatibility(boolean requireBasicCompatibility, | ||
boolean requireArrayCompatibility, | ||
boolean requireObjectCompatibility) { | ||
|
||
public boolean isTestCompatible(boolean supportBasicDataTypeTest, boolean supportArrayDataTypeTest, boolean supportObjectDataTypeTest) { | ||
LOGGER.info("---- Data type test compatibility ----"); | ||
LOGGER.info("| Data type test | Require | Support |"); | ||
LOGGER.info("| Basic test | {} | {} |", (requireBasicCompatibility ? "true " : "false"), | ||
(supportBasicDataTypeTest ? "true " : "false")); | ||
LOGGER.info("| Array test | {} | {} |", (requireArrayCompatibility ? "true " : "false"), | ||
(supportArrayDataTypeTest ? "true " : "false")); | ||
LOGGER.info("| Object test | {} | {} |", (requireObjectCompatibility ? "true " : "false"), | ||
(supportObjectDataTypeTest ? "true " : "false")); | ||
LOGGER.info("--------------------------------------"); | ||
|
||
if (requireBasicCompatibility && !supportBasicDataTypeTest) { | ||
LOGGER.warn("The destination doesn't support required Basic data type test. The test is skipped!"); | ||
return false; | ||
} | ||
if (requireArrayCompatibility && !supportArrayDataTypeTest) { | ||
LOGGER.warn("The destination doesn't support required Array data type test. The test is skipped!"); | ||
return false; | ||
} | ||
if (requireObjectCompatibility && !supportObjectDataTypeTest) { | ||
LOGGER.warn("The destination doesn't support required Object data type test. The test is skipped!"); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
} | ||
|
||
public static class CatalogMessageTestConfigWithCompatibility extends DataArgumentsProvider.CatalogMessageTestConfigPair { | ||
|
||
final TestCompatibility testCompatibility; | ||
|
||
public CatalogMessageTestConfigWithCompatibility(String catalogFile, String messageFile, TestCompatibility testCompatibility) { | ||
super(catalogFile, messageFile); | ||
this.testCompatibility = testCompatibility; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...ses/standard-destination-test/src/main/resources/data_type_array_object_test_catalog.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"streams": [ | ||
{ | ||
"name": "object_array_test_1", | ||
"json_schema": { | ||
"type": ["object"], | ||
"properties": { | ||
"property_string": { | ||
"type": ["string"] | ||
}, | ||
"property_array": { | ||
"type": ["array"], | ||
"items": { | ||
"type": ["object"], | ||
"properties": { | ||
"property_string": { "type": "string" }, | ||
"property_date": { "type": "string", "format": "date" }, | ||
"property_timestamp_with_timezone": { | ||
"type": "string", | ||
"format": "date-time", | ||
"airbyte_type": "timestamp_with_timezone" | ||
}, | ||
"property_timestamp_without_timezone": { | ||
"type": "string", | ||
"format": "date-time", | ||
"airbyte_type": "timestamp_without_timezone" | ||
}, | ||
"property_number": { "type": "number" }, | ||
"property_big_number": { | ||
"type": "string", | ||
"airbyte_type": "big_number" | ||
}, | ||
"property_integer": { "type": "integer" }, | ||
"property_big_integer": { | ||
"type": "string", | ||
"airbyte_type": "big_integer" | ||
}, | ||
"property_boolean": { "type": "boolean" } | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} |
2 changes: 2 additions & 0 deletions
2
...ses/standard-destination-test/src/main/resources/data_type_array_object_test_messages.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{"type": "RECORD", "record": {"stream": "object_array_test_1", "emitted_at": 1602637589100, "data": { "property_string" : "qqq", "property_array" : [ { "property_string": "foo bar", "property_date": "2021-01-23", "property_timestamp_with_timezone": "2022-11-22T01:23:45+00:00", "property_timestamp_without_timezone": "2022-11-22T01:23:45", "property_number": 56.78, "property_big_number": "100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.1234", "property_integer": 42, "property_big_integer": "123141241234124123141241234124123141241234124123141241234124123141241234124", "property_boolean": true } ] }}} | ||
{"type": "STATE", "state": { "data": {"start_date": "2022-02-14"}}} |
72 changes: 72 additions & 0 deletions
72
...ions/bases/standard-destination-test/src/main/resources/data_type_array_test_catalog.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"streams": [ | ||
{ | ||
"name": "array_test_1", | ||
"json_schema": { | ||
"properties": { | ||
"string_array": { | ||
"type": ["array"], | ||
"items": { | ||
"type": ["string"] | ||
} | ||
}, | ||
"array_date": { | ||
"type": ["array"], | ||
"items": { | ||
"type": "string", | ||
"format": "date" | ||
} | ||
}, | ||
"array_timestamp_with_timezone": { | ||
"type": ["array"], | ||
"items": { | ||
"type": "string", | ||
"format": "date-time", | ||
"airbyte_type": "timestamp_with_timezone" | ||
} | ||
}, | ||
"array_timestamp_without_timezone": { | ||
"type": ["array"], | ||
"items": { | ||
"type": "string", | ||
"format": "date-time", | ||
"airbyte_type": "timestamp_without_timezone" | ||
} | ||
}, | ||
"array_number": { | ||
"type": ["array"], | ||
"items": { | ||
"type": "number" | ||
} | ||
}, | ||
"array_big_number": { | ||
"type": ["array"], | ||
"items": { | ||
"type": "string", | ||
"airbyte_type": "big_number" | ||
} | ||
}, | ||
"array_integer": { | ||
"type": ["array"], | ||
"items": { | ||
"type": "integer" | ||
} | ||
}, | ||
"array_big_integer": { | ||
"type": ["array"], | ||
"items": { | ||
"type": "string", | ||
"airbyte_type": "big_integer" | ||
} | ||
}, | ||
"array_boolean": { | ||
"type": ["array"], | ||
"items": { | ||
"type": "boolean" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} |
2 changes: 2 additions & 0 deletions
2
...ions/bases/standard-destination-test/src/main/resources/data_type_array_test_messages.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{"type": "RECORD", "record": {"stream": "array_test_1", "emitted_at": 1602637589100, "data": { "string_array" : ["foo bar", "some random special characters: ࠈൡሗ"], "array_date" : ["2021-01-23", "1504-02-29"], "array_timestamp_with_timezone" : ["2022-11-22T01:23:45+05:00", "9999-12-21T01:23:45-05:00"], "array_timestamp_without_timezone" : ["2022-11-22T01:23:45", "1504-02-29T01:23:45"], "array_number" : [56.78, 0, -12345.678], "array_big_number" : ["-12345.678", "100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.1234"], "array_integer" : [42, 0, 12345], "array_big_integer" : ["0", "123141241234124123141241234124123141241234124123141241234124123141241234124"], "array_boolean" : [true, false] }}} | ||
{"type": "STATE", "state": { "data": {"start_date": "2022-02-14"}}} |
101 changes: 101 additions & 0 deletions
101
...ions/bases/standard-destination-test/src/main/resources/data_type_basic_test_catalog.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
"streams": [ | ||
{ | ||
"name": "string_test_1", | ||
"json_schema": { | ||
"properties": { | ||
"data": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "date_test_1", | ||
"json_schema": { | ||
"properties": { | ||
"data": { | ||
"type": "string", | ||
"format": "date" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "datetime_test_1", | ||
"json_schema": { | ||
"properties": { | ||
"data": { | ||
"type": "string", | ||
"format": "date-time", | ||
"airbyte_type": "timestamp_with_timezone" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "datetime_test_2", | ||
"json_schema": { | ||
"properties": { | ||
"data": { | ||
"type": "string", | ||
"format": "date-time", | ||
"airbyte_type": "timestamp_without_timezone" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "number_test_1", | ||
"json_schema": { | ||
"properties": { | ||
"data": { | ||
"type": "number" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "bignumber_test_1", | ||
"json_schema": { | ||
"properties": { | ||
"data": { | ||
"type": "string", | ||
"airbyte_type": "big_number" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "integer_test_1", | ||
"json_schema": { | ||
"properties": { | ||
"data": { | ||
"type": "integer" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "big_integer_test_1", | ||
"json_schema": { | ||
"properties": { | ||
"data": { | ||
"type": "string", | ||
"airbyte_type": "big_integer" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "boolean_test_1", | ||
"json_schema": { | ||
"properties": { | ||
"data": { | ||
"type": "boolean" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checking my understanding: once the items in your comment are resolved, this will be true for all destinations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, we need to upgrade our abstract test part for the proper result validation. As it's a common part, we apply it for all future destinations after we do for one destination.