Skip to content

Commit

Permalink
Destination Clickhouse : Enable and fix DAT tests (#12566)
Browse files Browse the repository at this point in the history
* enable DAT for the default clickhouse destination

* disable normalization in the tests fully due to broken normalization container for the Clickhouse.
  • Loading branch information
DoNotPanicUA authored May 5, 2022
1 parent 0c843e3 commit b752d82
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import io.airbyte.integrations.destination.ExtendedNameTransformer;
import io.airbyte.integrations.standardtest.destination.DestinationAcceptanceTest;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import io.airbyte.integrations.standardtest.destination.comparator.TestDataComparator;
import org.junit.jupiter.api.Disabled;
import org.testcontainers.containers.ClickHouseContainer;

Expand All @@ -35,7 +35,7 @@ protected String getImageName() {

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

@Override
Expand All @@ -48,6 +48,26 @@ protected boolean implementsNamespaces() {
return true;
}

@Override
protected TestDataComparator getTestDataComparator() {
return new ClickhouseTestDataComparator();
}

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

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

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

@Override
protected String getDefaultSchema(final JsonNode config) {
if (config.get("database") == null) {
Expand Down Expand Up @@ -105,19 +125,6 @@ private List<JsonNode> retrieveRecordsFromTable(final String tableName, final St
return jdbcDB.queryJsons(query);
}

@Override
protected List<String> resolveIdentifier(final String identifier) {
final List<String> result = new ArrayList<>();
final String resolved = namingResolver.getIdentifier(identifier);
result.add(identifier);
result.add(resolved);
if (!resolved.startsWith("\"")) {
result.add(resolved.toLowerCase());
result.add(resolved.toUpperCase());
}
return result;
}

private static JdbcDatabase getDatabase(final JsonNode config) {
return Databases.createJdbcDatabase(
config.get("username").asText(),
Expand Down Expand Up @@ -181,4 +188,8 @@ public void testSyncWithNormalization(final String messagesFilename, final Strin
super.testSyncWithNormalization(messagesFilename, catalogFilename);
}

@Disabled
public void specNormalizationValueShouldBeCorrect() throws Exception {
super.specNormalizationValueShouldBeCorrect();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package io.airbyte.integrations.destination.clickhouse;

import io.airbyte.integrations.destination.ExtendedNameTransformer;
import io.airbyte.integrations.standardtest.destination.comparator.AdvancedTestDataComparator;

import java.util.ArrayList;
import java.util.List;

public class ClickhouseTestDataComparator extends AdvancedTestDataComparator {

private final ExtendedNameTransformer namingResolver = new ExtendedNameTransformer();

@Override
protected List<String> resolveIdentifier(final String identifier) {
final List<String> result = new ArrayList<>();
final String resolved = namingResolver.getIdentifier(identifier);
result.add(identifier);
result.add(resolved);
if (!resolved.startsWith("\"")) {
result.add(resolved.toLowerCase());
result.add(resolved.toUpperCase());
}
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

import io.airbyte.integrations.standardtest.destination.comparator.TestDataComparator;
import org.junit.jupiter.api.Disabled;
import org.testcontainers.containers.ClickHouseContainer;

Expand All @@ -42,7 +44,7 @@ protected String getImageName() {

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

@Override
Expand All @@ -55,6 +57,26 @@ protected boolean implementsNamespaces() {
return true;
}

@Override
protected TestDataComparator getTestDataComparator() {
return new ClickhouseTestDataComparator();
}

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

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

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

@Override
protected String getDefaultSchema(final JsonNode config) {
if (config.get("database") == null) {
Expand Down Expand Up @@ -184,4 +206,9 @@ public void testSyncWithNormalization(final String messagesFilename, final Strin
super.testSyncWithNormalization(messagesFilename, catalogFilename);
}

@Disabled
public void specNormalizationValueShouldBeCorrect() throws Exception {
super.specNormalizationValueShouldBeCorrect();
}

}

0 comments on commit b752d82

Please sign in to comment.