Skip to content

Commit

Permalink
destination acceptance tests: get normalization and dbt support from …
Browse files Browse the repository at this point in the history
…definition (#21299)
  • Loading branch information
alafanechere authored Jan 18, 2023
1 parent 747d15f commit 6c2b9a1
Show file tree
Hide file tree
Showing 25 changed files with 7 additions and 238 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,20 +285,6 @@ protected boolean implementsOverwrite() throws WorkerException {
}
}

/**
* Override to return true to if the destination implements basic normalization and it should be
* tested here.
*
* @return - a boolean.
*/
protected boolean supportsNormalization() {
return false;
}

protected boolean supportsDBT() {
return false;
}

/**
* Override to return true if a destination implements size limits on record size (then destination
* should redefine getMaxRecordValueLimit() too)
Expand Down Expand Up @@ -570,10 +556,8 @@ public void testLineBreakCharacters() throws Exception {
}

@Test
public void specNormalizationValueShouldBeCorrect() throws Exception {
final boolean normalizationFromDefinition = normalizationFromDefinition();
assertEquals(normalizationFromDefinition, supportsNormalization());
if (normalizationFromDefinition) {
public void normalizationFromDefinitionValueShouldBeCorrect() {
if (normalizationFromDefinition()) {
boolean normalizationRunnerFactorySupportsDestinationImage;
try {
new DefaultNormalizationRunner(
Expand All @@ -584,15 +568,10 @@ public void specNormalizationValueShouldBeCorrect() throws Exception {
} catch (final IllegalStateException e) {
normalizationRunnerFactorySupportsDestinationImage = false;
}
assertEquals(normalizationFromDefinition, normalizationRunnerFactorySupportsDestinationImage);
assertEquals(normalizationFromDefinition(), normalizationRunnerFactorySupportsDestinationImage);
}
}

@Test
public void specDBTValueShouldBeCorrect() {
assertEquals(dbtFromDefinition(), supportsDBT());
}

/**
* Verify that the integration successfully writes records incrementally. The second run should
* append records to the datastore instead of overwriting the previous run.
Expand Down Expand Up @@ -1781,7 +1760,7 @@ public void testSyncIntegerInfinityDataType() throws Exception {

private void runAndCheck(final AirbyteCatalog catalog, final ConfiguredAirbyteCatalog configuredCatalog, final List<AirbyteMessage> messages)
throws Exception {
if (supportsNormalization()) {
if (normalizationFromDefinition()) {
LOGGER.info("Normalization is supported! Run test with normalization.");
runAndCheckWithNormalization(messages, configuredCatalog, catalog);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,6 @@ protected JsonNode getFailCheckConfig() {
return config;
}

@Override
protected boolean supportsNormalization() {
return true;
}

@Override
protected boolean supportsDBT() {
return true;
}

@Override
protected boolean implementsNamespaces() {
return true;
Expand Down Expand Up @@ -170,7 +160,7 @@ protected List<JsonNode> retrieveRecordsFromTable(final String tableName, final
}

protected void setUpBigQuery() throws IOException {
//secrets file should be set by the inhereting class
// secrets file should be set by the inhereting class
Assertions.assertNotNull(secretsFile);
final String datasetId = Strings.addRandomSuffix("airbyte_tests", "_", 8);
config = BigQueryDestinationTestUtils.createConfig(secretsFile, datasetId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,6 @@ protected String getImageName() {
return "airbyte/destination-clickhouse-strict-encrypt:dev";
}

@Override
protected boolean supportsNormalization() {
return true;
}

@Override
protected boolean supportsDBT() {
return false;
}

@Override
protected boolean implementsNamespaces() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,6 @@ protected String getImageName() {
return "airbyte/destination-clickhouse:dev";
}

@Override
protected boolean supportsNormalization() {
return true;
}

@Override
protected boolean supportsDBT() {
return false;
}

@Override
protected boolean implementsNamespaces() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@ protected String getImageName() {
return "airbyte/destination-clickhouse:dev";
}

@Override
protected boolean supportsNormalization() {
return true;
}

@Override
protected boolean supportsDBT() {
return false;
}

@Override
protected boolean implementsNamespaces() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ protected boolean implementsNamespaces() {
return true;
}

@Override
protected boolean supportsNormalization() {
return false;
}

@Override
protected boolean supportBasicDataTypeTest() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ protected boolean implementsNamespaces() {
return true;
}

@Override
protected boolean supportsNormalization() {
return false;
}

@Override
protected boolean supportBasicDataTypeTest() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,6 @@ protected String getImageName() {
return "airbyte/destination-mssql-strict-encrypt:dev";
}

@Override
protected boolean supportsDBT() {
return true;
}

@Override
protected boolean supportsNormalization() {
return true;
}

private JsonNode getConfig(final MSSQLServerContainer<?> db) {
return Jsons.jsonNode(ImmutableMap.builder()
.put(JdbcUtils.HOST_KEY, db.getHost())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@ protected String getImageName() {
return "airbyte/destination-mssql:dev";
}

@Override
protected boolean supportsDBT() {
return true;
}

@Override
protected boolean supportsNormalization() {
return true;
}

private JsonNode getConfig(final MSSQLServerContainer<?> db) {
return Jsons.jsonNode(ImmutableMap.builder()
.put(JdbcUtils.HOST_KEY, HostPortResolver.resolveHost(db))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,6 @@ protected String getImageName() {
return "airbyte/destination-mssql:dev";
}

@Override
protected boolean supportsDBT() {
return true;
}

@Override
protected boolean supportsNormalization() {
return true;
}

private JsonNode getConfig(final MSSQLServerContainer<?> db) {

return Jsons.jsonNode(ImmutableMap.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,11 @@ protected List<JsonNode> retrieveRecords(final TestDestinationEnv env,
.collect(Collectors.toList());
}

@Override
protected boolean supportsDBT() {
return true;
}

@Override
protected boolean implementsNamespaces() {
return true;
}

@Override
protected boolean supportsNormalization() {
return true;
}

private static Database getDatabaseFromConfig(final JsonNode config) {
final DSLContext dslContext = DSLContextFactory.create(
config.get(JdbcUtils.USERNAME_KEY).asText(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,12 @@ protected String getImageName() {
return "airbyte/destination-mysql-strict-encrypt:dev";
}

@Override
protected boolean supportsDBT() {
return true;
}

@Override
protected boolean implementsNamespaces() {
return true;
}

@Override
protected boolean supportsNormalization() {
return true;
}

@Override
protected TestDataComparator getTestDataComparator() {
return new MySqlTestDataComparator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,12 @@ protected String getImageName() {
return "airbyte/destination-mysql:dev";
}

@Override
protected boolean supportsDBT() {
return true;
}

@Override
protected boolean implementsNamespaces() {
return true;
}

@Override
protected boolean supportsNormalization() {
return true;
}

@Override
protected TestDataComparator getTestDataComparator() {
return new MySqlTestDataComparator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,6 @@ protected List<JsonNode> retrieveRecords(final TestDestinationEnv env,
.collect(Collectors.toList());
}

@Override
protected boolean supportsNormalization() {
return true;
}

@Override
protected boolean supportsDBT() {
return true;
}

@Override
protected boolean implementsNamespaces() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ protected boolean implementsNamespaces() {
return true;
}

@Override
protected boolean supportsDBT() {
return false;
}

@Override
protected List<JsonNode> retrieveNormalizedRecords(final TestDestinationEnv env,
final String streamName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,6 @@ protected void tearDown(final TestDestinationEnv testEnv) throws Exception {
sshBastionContainer.stopAndCloseContainers(db);
}

@Override
protected boolean supportsDBT() {
return false;
}

@Override
protected boolean implementsNamespaces() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ protected boolean implementsNamespaces() {
return true;
}

@Override
protected boolean supportsDBT() {
return false;
}

@Override
protected TestDataComparator getTestDataComparator() {
return new OracleTestDataComparator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,6 @@ protected List<JsonNode> retrieveRecords(final TestDestinationEnv env,
.collect(Collectors.toList());
}

@Override
protected boolean supportsNormalization() {
return true;
}

@Override
protected boolean supportsDBT() {
return true;
}

@Override
protected boolean implementsNamespaces() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,6 @@ protected List<JsonNode> retrieveRecords(final TestDestinationEnv env,
.collect(Collectors.toList());
}

@Override
protected boolean supportsNormalization() {
return true;
}

@Override
protected boolean supportsDBT() {
return true;
}

@Override
protected boolean implementsNamespaces() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,6 @@ protected List<JsonNode> retrieveRecords(final TestDestinationEnv env,
.collect(Collectors.toList());
}

@Override
protected boolean supportsNormalization() {
return true;
}

@Override
protected boolean supportsDBT() {
return true;
}

@Override
protected boolean implementsNamespaces() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@ protected List<JsonNode> retrieveRecords(final TestDestinationEnv env,
.collect(Collectors.toList());
}

@Override
protected boolean supportsNormalization() {
return true;
}

@Override
protected boolean supportsDBT() {
return true;
}

@Override
protected boolean implementsNamespaces() {
Expand Down
Loading

0 comments on commit 6c2b9a1

Please sign in to comment.