Skip to content

Commit

Permalink
Extend template for the Java JDBC template by SAT SPEC (#19660)
Browse files Browse the repository at this point in the history
* extend template for the Java JDBC template by SAT SPEC

* extend example source scaffold-java-jdbc

* review upd

* add other SAT tests to the template

* review upd

* comment non-spec tests

* Revert "comment non-spec tests"

This reverts commit 8c78049.

* Revert "add other SAT tests to the template"

This reverts commit c15b4dc.

* review

* review

* typo

* typo

* new line
  • Loading branch information
DoNotPanicUA committed Dec 6, 2022
1 parent bedc3b9 commit 39c8801
Show file tree
Hide file tree
Showing 12 changed files with 214 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See [Source Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/source-acceptance-tests-reference)
# for more information about how to configure these tests
connector_image: airbyte/source-{{dashCase name}}:dev
tests:
spec:
- spec_path: "src/test-integration/resources/expected_spec.json"
config_path: "src/test-integration/resources/dummy_config.json"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env sh

# Build latest connector image
docker build . -t $(cat acceptance-test-config.yml | grep "connector_image" | head -n 1 | cut -d: -f2-)

# Pull latest acctest image
docker pull airbyte/source-acceptance-test:latest

# Run
docker run --rm -it \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp:/tmp \
-v $(pwd):/test_input \
airbyte/source-acceptance-test \
--acceptance-test-config /test_input
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'application'
id 'airbyte-docker'
id 'airbyte-integration-test-java'
id 'airbyte-source-acceptance-test'
}

application {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#


import pytest

pytest_plugins = ("source_acceptance_test.plugin",)


@pytest.fixture(scope="session", autouse=True)
def connector_setup():
"""This fixture is a placeholder for external resources that acceptance test might require."""
# TODO: setup test dependencies if needed. otherwise remove the TODO comments
yield
# TODO: clean up test dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"host": "default",
"port": 5555,
"database": "default",
"username": "default",
"replication_method": "STANDARD"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"documentationUrl": "https://docs.airbyte.com/integrations/sources/{{snakeCase name}}",
"connectionSpecification": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "{{pascalCase name}} Source Spec",
"type": "object",
"required": ["host", "port", "database", "username", "replication_method"],
"properties": {
"host": {
"title": "Host",
"description": "Hostname of the database.",
"type": "string",
"order": 0
},
"port": {
"title": "Port",
"description": "Port of the database.",
"type": "integer",
"minimum": 0,
"maximum": 65536,
"default": 3306,
"examples": ["3306"],
"order": 1
},
"database": {
"title": "Database",
"description": "Name of the database.",
"type": "string",
"order": 2
},
"username": {
"title": "Username",
"description": "Username to use to access the database.",
"type": "string",
"order": 3
},
"password": {
"title": "Password",
"description": "Password associated with the username.",
"type": "string",
"airbyte_secret": true,
"order": 4
},
"jdbc_url_params": {
"title": "JDBC URL params",
"description": "Additional properties to pass to the JDBC URL string when connecting to the database formatted as 'key=value' pairs separated by the symbol '&'. (example: key1=value1&key2=value2&key3=value3)",
"type": "string",
"order": 5
},
"replication_method": {
"title": "Replication method",
"description": "Replication method to use for extracting data from the database. STANDARD replication requires no setup on the DB side but will not be able to represent deletions incrementally. CDC uses the Binlog to detect inserts, updates, and deletes. This needs to be configured on the source database itself.",
"type": "string",
"order": 6,
"default": "STANDARD",
"enum": ["STANDARD", "CDC"]
}
}
},
"supported_destination_sync_modes": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See [Source Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/source-acceptance-tests-reference)
# for more information about how to configure these tests
connector_image: airbyte/source-scaffold-java-jdbc:dev
tests:
spec:
- spec_path: "src/test-integration/resources/expected_spec.json"
config_path: "src/test-integration/resources/dummy_config.json"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env sh

# Build latest connector image
docker build . -t $(cat acceptance-test-config.yml | grep "connector_image" | head -n 1 | cut -d: -f2-)

# Pull latest acctest image
docker pull airbyte/source-acceptance-test:latest

# Run
docker run --rm -it \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp:/tmp \
-v $(pwd):/test_input \
airbyte/source-acceptance-test \
--acceptance-test-config /test_input
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'application'
id 'airbyte-docker'
id 'airbyte-integration-test-java'
id 'airbyte-source-acceptance-test'
}

application {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#


import pytest

pytest_plugins = ("source_acceptance_test.plugin",)


@pytest.fixture(scope="session", autouse=True)
def connector_setup():
"""This fixture is a placeholder for external resources that acceptance test might require."""
# TODO: setup test dependencies if needed. otherwise remove the TODO comments
yield
# TODO: clean up test dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"host": "default",
"port": 5555,
"database": "default",
"username": "default",
"replication_method": "STANDARD"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"documentationUrl": "https://docs.airbyte.com/integrations/sources/scaffold_java_jdbc",
"connectionSpecification": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ScaffoldJavaJdbc Source Spec",
"type": "object",
"required": ["host", "port", "database", "username", "replication_method"],
"properties": {
"host": {
"title": "Host",
"description": "Hostname of the database.",
"type": "string",
"order": 0
},
"port": {
"title": "Port",
"description": "Port of the database.",
"type": "integer",
"minimum": 0,
"maximum": 65536,
"default": 3306,
"examples": ["3306"],
"order": 1
},
"database": {
"title": "Database",
"description": "Name of the database.",
"type": "string",
"order": 2
},
"username": {
"title": "Username",
"description": "Username to use to access the database.",
"type": "string",
"order": 3
},
"password": {
"title": "Password",
"description": "Password associated with the username.",
"type": "string",
"airbyte_secret": true,
"order": 4
},
"jdbc_url_params": {
"title": "JDBC URL params",
"description": "Additional properties to pass to the JDBC URL string when connecting to the database formatted as 'key=value' pairs separated by the symbol '&'. (example: key1=value1&key2=value2&key3=value3)",
"type": "string",
"order": 5
},
"replication_method": {
"title": "Replication method",
"description": "Replication method to use for extracting data from the database. STANDARD replication requires no setup on the DB side but will not be able to represent deletions incrementally. CDC uses the Binlog to detect inserts, updates, and deletes. This needs to be configured on the source database itself.",
"type": "string",
"order": 6,
"default": "STANDARD",
"enum": ["STANDARD", "CDC"]
}
}
},
"supported_destination_sync_modes": []
}

0 comments on commit 39c8801

Please sign in to comment.