Skip to content

Commit

Permalink
normalize connector acceptance test names (#3539)
Browse files Browse the repository at this point in the history
* Rename standard tests to acceptance tests

* Normalize the names so that the nouns are always in the same order so it is easier to find tests
  • Loading branch information
cgardens committed May 22, 2021
1 parent 3fbb382 commit 8983f09
Show file tree
Hide file tree
Showing 37 changed files with 86 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import io.airbyte.commons.io.IOs;
import io.airbyte.commons.json.Jsons;
import io.airbyte.integrations.standardtest.source.StandardSourceTest;
import io.airbyte.integrations.standardtest.source.SourceAcceptanceTest;
import io.airbyte.protocol.models.ConfiguredAirbyteCatalog;
import io.airbyte.protocol.models.ConnectorSpecification;
import java.nio.file.Path;
Expand All @@ -39,7 +39,7 @@
* Extends TestSource such that it can be called using resources pulled from the file system. Will
* also add the ability to execute arbitrary scripts in the next version.
*/
public class ExecutableTestSource extends StandardSourceTest {
public class ExecutableTestSource extends SourceAcceptanceTest {

public static class TestConfig {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class TestDestination {
public abstract class DestinationAcceptanceTest {

private static final String JOB_ID = "0";
private static final int JOB_ATTEMPT = 0;

private static final Logger LOGGER = LoggerFactory.getLogger(TestDestination.class);
private static final Logger LOGGER = LoggerFactory.getLogger(DestinationAcceptanceTest.class);

private TestDestinationEnv testEnv;

Expand Down Expand Up @@ -290,7 +290,7 @@ public void testGetSpec() throws WorkerException {

/**
* Verify that when given valid credentials, that check connection returns a success response.
* Assume that the {@link TestDestination#getConfig()} is valid.
* Assume that the {@link DestinationAcceptanceTest#getConfig()} is valid.
*/
@Test
public void testCheckConnection() throws Exception {
Expand All @@ -299,7 +299,7 @@ public void testCheckConnection() throws Exception {

/**
* Verify that when given invalid credentials, that check connection returns a failed response.
* Assume that the {@link TestDestination#getFailCheckConfig()} is invalid.
* Assume that the {@link DestinationAcceptanceTest#getFailCheckConfig()} is invalid.
*/
@Test
public void testCheckConnectionInvalidCredentials() throws Exception {
Expand Down
12 changes: 8 additions & 4 deletions airbyte-integrations/bases/standard-source-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ dependencies {
}

def getFullPath(String className) {
def matchingFiles = project.fileTree("src/main/java").filter { file -> file.toString().endsWith("${className}.java") }.asCollection()
if (matchingFiles.size() != 1) {
def matchingFiles = project.fileTree("src/main/java")
.filter { file -> file.getName().equals("${className}.java".toString())}.asCollection()
if (matchingFiles.size() == 0) {
throw new IllegalArgumentException("Ambiguous class name ${className}: no file found.")
}
if (matchingFiles.size() > 1) {
throw new IllegalArgumentException("Ambiguous class name ${className}: more than one matching file was found. Files found: ${matchingFiles}")
}
def absoluteFilePath = matchingFiles[0].toString()
Expand All @@ -42,7 +46,7 @@ task generateSourceTestDocs(type: Javadoc) {
destinationDir = javadocOutputDir

doLast {
def className = "StandardSourceTest" // this can be made into a list once we have multiple standard tests, and can also be used for destinations
def className = "SourceAcceptanceTest" // this can be made into a list once we have multiple standard tests, and can also be used for destinations
def pathInPackage = getFullPath(className)
def stdSrcTest = project.file("${javadocOutputDir}/${pathInPackage}.html").readLines().join("\n")
def methodList = Jsoup.parse(stdSrcTest).body().select("section.methodDetails>ul>li>section")
Expand Down Expand Up @@ -70,5 +74,5 @@ task generateSourceTestDocs(type: Javadoc) {
project.build.dependsOn(generateSourceTestDocs)

application {
mainClass = 'io.airbyte.integrations.standardtest.source.TestPythonSourceMain'
mainClass = 'io.airbyte.integrations.standardtest.source.PythonSourceAcceptanceTest'
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
* Extends TestSource such that it can be called using resources pulled from the file system. Will
* also add the ability to execute arbitrary scripts in the next version.
*/
public class PythonTestSource extends StandardSourceTest {
public class PythonSourceAcceptanceTest extends SourceAcceptanceTest {

private static final Logger LOGGER = LoggerFactory.getLogger(PythonTestSource.class);
private static final Logger LOGGER = LoggerFactory.getLogger(PythonSourceAcceptanceTest.class);
private static final String OUTPUT_FILENAME = "output.json";

public static String IMAGE_NAME;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class StandardSourceTest {
public abstract class SourceAcceptanceTest {

public static final String CDC_LSN = "_ab_cdc_lsn";
public static final String CDC_UPDATED_AT = "_ab_cdc_updated_at";
Expand All @@ -83,7 +83,7 @@ public abstract class StandardSourceTest {
private static final long JOB_ID = 0L;
private static final int JOB_ATTEMPT = 0;

private static final Logger LOGGER = LoggerFactory.getLogger(StandardSourceTest.class);
private static final Logger LOGGER = LoggerFactory.getLogger(SourceAcceptanceTest.class);

private TestDestinationEnv testEnv;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ public static void main(String[] args) {
final String imageName = ns.getString("imageName");
final String pythonContainerName = ns.getString("pythonContainerName");

PythonTestSource.IMAGE_NAME = imageName;
PythonTestSource.PYTHON_CONTAINER_NAME = pythonContainerName;
PythonSourceAcceptanceTest.IMAGE_NAME = imageName;
PythonSourceAcceptanceTest.PYTHON_CONTAINER_NAME = pythonContainerName;

TestRunner.runTestClass(PythonTestSource.class);
TestRunner.runTestClass(PythonSourceAcceptanceTest.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import io.airbyte.commons.json.Jsons;
import io.airbyte.integrations.base.JavaBaseConstants;
import io.airbyte.integrations.destination.StandardNameTransformer;
import io.airbyte.integrations.standardtest.destination.TestDestination;
import io.airbyte.integrations.standardtest.destination.DestinationAcceptanceTest;
import java.io.ByteArrayInputStream;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -60,9 +60,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BigQueryStandardTest extends TestDestination {
public class BigQueryDestinationAcceptanceTest extends DestinationAcceptanceTest {

private static final Logger LOGGER = LoggerFactory.getLogger(BigQueryStandardTest.class);
private static final Logger LOGGER = LoggerFactory.getLogger(BigQueryDestinationAcceptanceTest.class);

private static final Path CREDENTIALS_PATH = Path.of("secrets/credentials.json");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import io.airbyte.commons.json.Jsons;
import io.airbyte.integrations.base.JavaBaseConstants;
import io.airbyte.integrations.destination.StandardNameTransformer;
import io.airbyte.integrations.standardtest.destination.TestDestination;
import io.airbyte.integrations.standardtest.destination.DestinationAcceptanceTest;
import java.io.FileReader;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -42,7 +42,7 @@
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVRecord;

public class CsvDestinationIntegrationTest extends TestDestination {
public class CsvDestinationAcceptanceTest extends DestinationAcceptanceTest {

private static final Path RELATIVE_PATH = Path.of("integration_test/test");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import io.airbyte.db.Databases;
import io.airbyte.integrations.base.JavaBaseConstants;
import io.airbyte.integrations.destination.ExtendedNameTransformer;
import io.airbyte.integrations.standardtest.destination.TestDestination;
import io.airbyte.integrations.standardtest.destination.DestinationAcceptanceTest;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -39,7 +39,7 @@
import org.jooq.JSONFormat.RecordFormat;
import org.testcontainers.containers.PostgreSQLContainer;

public class JdbcIntegrationTest extends TestDestination {
public class JdbcDestinationAcceptanceTest extends DestinationAcceptanceTest {

private static final JSONFormat JSON_FORMAT = new JSONFormat().recordFormat(RecordFormat.OBJECT);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
import io.airbyte.commons.json.Jsons;
import io.airbyte.integrations.base.JavaBaseConstants;
import io.airbyte.integrations.destination.StandardNameTransformer;
import io.airbyte.integrations.standardtest.destination.TestDestination;
import io.airbyte.integrations.standardtest.destination.DestinationAcceptanceTest;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

public class LocalJsonDestinationIntegrationTest extends TestDestination {
public class LocalJsonDestinationAcceptanceTest extends DestinationAcceptanceTest {

private static final Path RELATIVE_PATH = Path.of("integration_test/test");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import io.airbyte.commons.json.Jsons;
import io.airbyte.commons.stream.MoreStreams;
import io.airbyte.commons.text.Names;
import io.airbyte.integrations.standardtest.destination.TestDestination;
import io.airbyte.integrations.standardtest.destination.DestinationAcceptanceTest;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -42,7 +42,7 @@
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.utility.DockerImageName;

public class MeiliSearchStandardTest extends TestDestination {
public class MeiliSearchDestinationAcceptanceTest extends DestinationAcceptanceTest {

private static final Integer DEFAULT_MEILI_SEARCH_PORT = 7700;
private static final Integer EXPOSED_PORT = 7701;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import io.airbyte.db.Databases;
import io.airbyte.integrations.base.JavaBaseConstants;
import io.airbyte.integrations.destination.ExtendedNameTransformer;
import io.airbyte.integrations.standardtest.destination.TestDestination;
import io.airbyte.integrations.standardtest.destination.DestinationAcceptanceTest;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -44,7 +44,7 @@
import org.junit.jupiter.api.BeforeAll;
import org.testcontainers.containers.MSSQLServerContainer;

public class MSSQLIntegrationTest extends TestDestination {
public class MSSQLDestinationAcceptanceTest extends DestinationAcceptanceTest {

private static final JSONFormat JSON_FORMAT = new JSONFormat().recordFormat(RecordFormat.OBJECT);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import io.airbyte.db.Databases;
import io.airbyte.integrations.base.JavaBaseConstants;
import io.airbyte.integrations.destination.ExtendedNameTransformer;
import io.airbyte.integrations.standardtest.destination.TestDestination;
import io.airbyte.integrations.standardtest.destination.DestinationAcceptanceTest;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -45,7 +45,7 @@
import org.testcontainers.containers.MSSQLServerContainer;
import org.testcontainers.utility.DockerImageName;

public class MSSQLIntegrationTestSSL extends TestDestination {
public class MSSQLDestinationAcceptanceTestSSL extends DestinationAcceptanceTest {

private static final JSONFormat JSON_FORMAT = new JSONFormat().recordFormat(RecordFormat.OBJECT);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import io.airbyte.db.Databases;
import io.airbyte.integrations.base.JavaBaseConstants;
import io.airbyte.integrations.destination.ExtendedNameTransformer;
import io.airbyte.integrations.standardtest.destination.TestDestination;
import io.airbyte.integrations.standardtest.destination.DestinationAcceptanceTest;
import java.sql.SQLException;
import java.util.List;
import java.util.stream.Collectors;
Expand All @@ -40,7 +40,7 @@
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.MySQLContainer;

public class MySQLIntegrationTest extends TestDestination {
public class MySQLDestinationAcceptanceTest extends DestinationAcceptanceTest {

private static final JSONFormat JSON_FORMAT = new JSONFormat().recordFormat(RecordFormat.OBJECT);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import io.airbyte.db.Databases;
import io.airbyte.integrations.base.JavaBaseConstants;
import io.airbyte.integrations.destination.ExtendedNameTransformer;
import io.airbyte.integrations.standardtest.destination.TestDestination;
import io.airbyte.integrations.standardtest.destination.DestinationAcceptanceTest;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -39,7 +39,7 @@
import org.jooq.JSONFormat.RecordFormat;
import org.testcontainers.containers.PostgreSQLContainer;

public class PostgresIntegrationTest extends TestDestination {
public class PostgresDestinationAcceptanceTest extends DestinationAcceptanceTest {

private static final JSONFormat JSON_FORMAT = new JSONFormat().recordFormat(RecordFormat.OBJECT);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import io.airbyte.db.Database;
import io.airbyte.db.Databases;
import io.airbyte.integrations.base.JavaBaseConstants;
import io.airbyte.integrations.standardtest.destination.TestDestination;
import io.airbyte.integrations.standardtest.destination.DestinationAcceptanceTest;
import java.nio.file.Path;
import java.sql.SQLException;
import java.util.ArrayList;
Expand All @@ -45,7 +45,7 @@
* Integration test testing {@link RedshiftCopyS3Destination}. The default Redshift integration test
* credentials contain S3 credentials - this automatically causes COPY to be selected.
*/
public class RedshiftCopyIntegrationTest extends TestDestination {
public class RedshiftCopyDestinationAcceptanceTest extends DestinationAcceptanceTest {

private static final JSONFormat JSON_FORMAT = new JSONFormat().recordFormat(RecordFormat.OBJECT);
// config from which to create / delete schemas.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* Integration test testing the {@link RedshiftInsertDestination}. As the Redshift test credentials
* contain S3 credentials by default, we remove these credentials.
*/
public class RedshiftInsertIntegrationTest extends RedshiftCopyIntegrationTest {
public class RedshiftInsertDestinationAcceptanceTest extends RedshiftCopyDestinationAcceptanceTest {

public JsonNode getStaticConfig() {
return purge(Jsons.deserialize(IOs.readFile(Path.of("secrets/config.json"))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import io.airbyte.commons.json.Jsons;
import java.nio.file.Path;

public class SnowflakeGcsCopyIntegrationTest extends SnowflakeInsertIntegrationTest {
public class SnowflakeGcsCopyDestinationAcceptanceTest extends SnowflakeInsertDestinationAcceptanceTest {

@Override
public JsonNode getStaticConfig() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
import io.airbyte.db.jdbc.JdbcUtils;
import io.airbyte.integrations.base.JavaBaseConstants;
import io.airbyte.integrations.destination.ExtendedNameTransformer;
import io.airbyte.integrations.standardtest.destination.TestDestination;
import io.airbyte.integrations.standardtest.destination.DestinationAcceptanceTest;
import java.nio.file.Path;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.RandomStringUtils;

public class SnowflakeInsertIntegrationTest extends TestDestination {
public class SnowflakeInsertDestinationAcceptanceTest extends DestinationAcceptanceTest {

// config from which to create / delete schemas.
private JsonNode baseConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import io.airbyte.commons.json.Jsons;
import java.nio.file.Path;

public class SnowflakeS3CopyIntegrationTest extends SnowflakeInsertIntegrationTest {
public class SnowflakeS3CopyDestinationAcceptanceTest extends SnowflakeInsertDestinationAcceptanceTest {

@Override
public JsonNode getStaticConfig() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
import io.airbyte.commons.json.Jsons;
import io.airbyte.integrations.source.clickhouse.ClickHouseSource;
import io.airbyte.integrations.source.jdbc.AbstractJdbcSource;
import io.airbyte.integrations.source.jdbc.test.JdbcSourceStandardTest;
import io.airbyte.integrations.source.jdbc.test.JdbcSourceAcceptanceTest;
import java.sql.SQLException;
import java.util.List;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.testcontainers.containers.ClickHouseContainer;

public class ClickHouseJdbcStandardSourceTest extends JdbcSourceStandardTest {
public class ClickHouseJdbcSourceAcceptanceTest extends JdbcSourceAcceptanceTest {

private static final String SCHEMA_NAME = "default";
private ClickHouseContainer db;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import io.airbyte.db.jdbc.JdbcDatabase;
import io.airbyte.db.jdbc.JdbcUtils;
import io.airbyte.integrations.source.clickhouse.ClickHouseSource;
import io.airbyte.integrations.standardtest.source.StandardSourceTest;
import io.airbyte.integrations.standardtest.source.SourceAcceptanceTest;
import io.airbyte.protocol.models.CatalogHelpers;
import io.airbyte.protocol.models.ConfiguredAirbyteCatalog;
import io.airbyte.protocol.models.ConfiguredAirbyteStream;
Expand All @@ -47,7 +47,7 @@
import java.util.List;
import org.testcontainers.containers.ClickHouseContainer;

public class ClickHouseStandardSourceTest extends StandardSourceTest {
public class ClickHouseSourceAcceptanceTest extends SourceAcceptanceTest {

private ClickHouseContainer db;
private JsonNode config;
Expand Down

0 comments on commit 8983f09

Please sign in to comment.