forked from airbytehq/airbyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎉 Testing destination: multiple logging modes (airbytehq#8824)
* Implement destination null * Update existing testing destinations * Merge in logging consumer * Remove old destination null * Add documentation * Add destination to build and summary * Fix test * Update acceptance test * Log state message * Remove unused variable * Remove extra statement * Remove old null doc * Add dev null destination * Update doc to include changelog for dev null * Format code * Fix doc * Register e2e test destination in seed
- Loading branch information
Showing
32 changed files
with
1,028 additions
and
69 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
3 changes: 3 additions & 0 deletions
3
airbyte-integrations/connectors/destination-dev-null/.dockerignore
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,3 @@ | ||
* | ||
!Dockerfile | ||
!build |
10 changes: 10 additions & 0 deletions
10
airbyte-integrations/connectors/destination-dev-null/Dockerfile
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,10 @@ | ||
FROM airbyte/integration-base-java:dev | ||
|
||
WORKDIR /airbyte | ||
ENV APPLICATION destination-dev-null | ||
|
||
COPY build/distributions/${APPLICATION}*.tar ${APPLICATION}.tar | ||
RUN tar xf ${APPLICATION}.tar --strip-components=1 | ||
|
||
LABEL io.airbyte.version=0.1.0 | ||
LABEL io.airbyte.name=airbyte/destination-dev-null |
51 changes: 51 additions & 0 deletions
51
airbyte-integrations/connectors/destination-dev-null/README.md
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,51 @@ | ||
# Destination Dev Null | ||
|
||
This destination is a "safe" version of the [E2E Test destination](https://docs.airbyte.io/integrations/destinations/e2e-test). It only allows the "silent" mode. | ||
|
||
## Local development | ||
|
||
#### Building via Gradle | ||
From the Airbyte repository root, run: | ||
``` | ||
./gradlew :airbyte-integrations:connectors:destination-dev-null:build | ||
``` | ||
|
||
### Locally running the connector docker image | ||
|
||
#### Build | ||
Build the connector image via Gradle: | ||
``` | ||
./gradlew :airbyte-integrations:connectors:destination-dev-null:airbyteDocker | ||
``` | ||
When building via Gradle, the docker image name and tag, respectively, are the values of the `io.airbyte.name` and `io.airbyte.version` `LABEL`s in | ||
the Dockerfile. | ||
|
||
#### Run | ||
Then run any of the connector commands as follows: | ||
``` | ||
docker run --rm airbyte/destination-dev-null:dev spec | ||
docker run --rm -v $(pwd)/secrets:/secrets airbyte/destination-dev-null:dev check --config /secrets/config.json | ||
docker run --rm -v $(pwd)/secrets:/secrets airbyte/destination-dev-null:dev discover --config /secrets/config.json | ||
docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/destination-dev-null:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json | ||
``` | ||
|
||
### Using gradle to run tests | ||
All commands should be run from airbyte project root. | ||
To run unit tests: | ||
``` | ||
./gradlew :airbyte-integrations:connectors:destination-dev-null:unitTest | ||
``` | ||
To run acceptance and custom integration tests: | ||
``` | ||
./gradlew :airbyte-integrations:connectors:destination-dev-null:integrationTest | ||
``` | ||
|
||
## Dependency Management | ||
|
||
### Publishing a new version of the connector | ||
You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what? | ||
1. Make sure your changes are passing unit and integration tests. | ||
1. Bump the connector version in `Dockerfile` -- just increment the value of the `LABEL io.airbyte.version` appropriately (we use [SemVer](https://semver.org/)). | ||
1. Create a Pull Request. | ||
1. Pat yourself on the back for being an awesome contributor. | ||
1. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master. |
20 changes: 20 additions & 0 deletions
20
airbyte-integrations/connectors/destination-dev-null/build.gradle
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,20 @@ | ||
plugins { | ||
id 'application' | ||
id 'airbyte-docker' | ||
id 'airbyte-integration-test-java' | ||
} | ||
|
||
application { | ||
mainClass = 'io.airbyte.integrations.destination.dev_null.DevNullDestination' | ||
} | ||
|
||
dependencies { | ||
implementation project(':airbyte-config:models') | ||
implementation project(':airbyte-protocol:models') | ||
implementation project(':airbyte-integrations:bases:base-java') | ||
implementation project(':airbyte-integrations:connectors:destination-e2e-test') | ||
implementation files(project(':airbyte-integrations:bases:base-java').airbyteDocker.outputs) | ||
|
||
integrationTestJavaImplementation project(':airbyte-integrations:bases:standard-destination-test') | ||
integrationTestJavaImplementation project(':airbyte-integrations:connectors:destination-dev-null') | ||
} |
55 changes: 55 additions & 0 deletions
55
...v-null/src/main/java/io/airbyte/integrations/destination/dev_null/DevNullDestination.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,55 @@ | ||
/* | ||
* Copyright (c) 2021 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.integrations.destination.dev_null; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.node.ArrayNode; | ||
import com.fasterxml.jackson.databind.node.ObjectNode; | ||
import io.airbyte.commons.json.Jsons; | ||
import io.airbyte.integrations.base.Destination; | ||
import io.airbyte.integrations.base.IntegrationRunner; | ||
import io.airbyte.integrations.base.spec_modification.SpecModifyingDestination; | ||
import io.airbyte.integrations.destination.e2e_test.TestingDestinations; | ||
import io.airbyte.protocol.models.ConnectorSpecification; | ||
import java.util.Iterator; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class DevNullDestination extends SpecModifyingDestination implements Destination { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(DevNullDestination.class); | ||
private static final String DEV_NULL_DESTINATION_TITLE = "Dev Null Destination Spec"; | ||
|
||
public DevNullDestination() { | ||
super(new TestingDestinations()); | ||
} | ||
|
||
public static void main(final String[] args) throws Exception { | ||
LOGGER.info("Starting destination: {}", DevNullDestination.class); | ||
new IntegrationRunner(new DevNullDestination()).run(args); | ||
LOGGER.info("Completed destination: {}", DevNullDestination.class); | ||
} | ||
|
||
/** | ||
* 1. Update the title. 2. Only keep the "silent" mode. | ||
*/ | ||
@Override | ||
public ConnectorSpecification modifySpec(final ConnectorSpecification originalSpec) { | ||
final ConnectorSpecification spec = Jsons.clone(originalSpec); | ||
|
||
((ObjectNode) spec.getConnectionSpecification()).put("title", DEV_NULL_DESTINATION_TITLE); | ||
|
||
final ArrayNode types = (ArrayNode) spec.getConnectionSpecification().get("oneOf"); | ||
final Iterator<JsonNode> typesIterator = types.elements(); | ||
while (typesIterator.hasNext()) { | ||
final JsonNode typeNode = typesIterator.next(); | ||
if (!typeNode.get("properties").get("type").get("const").asText().equalsIgnoreCase("silent")) { | ||
typesIterator.remove(); | ||
} | ||
} | ||
return spec; | ||
} | ||
|
||
} |
59 changes: 59 additions & 0 deletions
59
...n/java/io/airbyte/integrations/destination/dev_null/DevNullDestinationAcceptanceTest.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,59 @@ | ||
/* | ||
* Copyright (c) 2021 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.integrations.destination.dev_null; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import io.airbyte.commons.json.Jsons; | ||
import io.airbyte.integrations.standardtest.destination.DestinationAcceptanceTest; | ||
import io.airbyte.protocol.models.AirbyteMessage; | ||
import io.airbyte.protocol.models.AirbyteRecordMessage; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public class DevNullDestinationAcceptanceTest extends DestinationAcceptanceTest { | ||
|
||
@Override | ||
protected String getImageName() { | ||
return "airbyte/destination-dev-null:dev"; | ||
} | ||
|
||
@Override | ||
protected JsonNode getConfig() { | ||
return Jsons.jsonNode(Collections.singletonMap("type", "SILENT")); | ||
} | ||
|
||
@Override | ||
protected JsonNode getFailCheckConfig() { | ||
return Jsons.jsonNode(Collections.singletonMap("type", "invalid")); | ||
} | ||
|
||
@Override | ||
protected List<JsonNode> retrieveRecords(final TestDestinationEnv testEnv, | ||
final String streamName, | ||
final String namespace, | ||
final JsonNode streamSchema) { | ||
return Collections.emptyList(); | ||
} | ||
|
||
@Override | ||
protected void setup(final TestDestinationEnv testEnv) { | ||
// do nothing | ||
} | ||
|
||
@Override | ||
protected void tearDown(final TestDestinationEnv testEnv) { | ||
// do nothing | ||
} | ||
|
||
@Override | ||
protected void assertSameMessages(final List<AirbyteMessage> expected, | ||
final List<AirbyteRecordMessage> actual, | ||
final boolean pruneAirbyteInternalFields) { | ||
assertEquals(0, actual.size()); | ||
} | ||
|
||
} |
Oops, something went wrong.