Skip to content
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

Destination Clickhouse : Enable and fix DAT tests #12566

Merged
merged 2 commits into from
May 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}

}