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

Enable SPEC SAT for Java sources #18779

Merged
merged 36 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
838618e
enable py spec compatibility tests
DoNotPanicUA Nov 1, 2022
ce22526
add missing properties
DoNotPanicUA Nov 1, 2022
413439e
use expected spec file instead of the source spec.json + use dummy co…
DoNotPanicUA Nov 2, 2022
ab7ee60
add missing files for the clickhouse
DoNotPanicUA Nov 2, 2022
b968723
move test files to the integration-test from the unit test folder
DoNotPanicUA Nov 2, 2022
999d716
add missing files to cockroachdb
DoNotPanicUA Nov 2, 2022
d579289
add missing files to db2 + fix spec format
DoNotPanicUA Nov 2, 2022
1daeddb
add missing files to elasticsearch + fix spec format
DoNotPanicUA Nov 2, 2022
4ecef1c
add missing files to jdbc
DoNotPanicUA Nov 2, 2022
02a6bfa
add missing files to mongodb_v2 + fix spec format
DoNotPanicUA Nov 2, 2022
f747e13
add missing files to mssql + fix spec format
DoNotPanicUA Nov 3, 2022
d09b7f3
add missing files to mysql + fix spec format
DoNotPanicUA Nov 3, 2022
4d71efd
add missing files to postgres + fix spec format
DoNotPanicUA Nov 3, 2022
c46a5d3
add missing files to oracle + fix spec format
DoNotPanicUA Nov 3, 2022
189cdb6
add missing files to redshift
DoNotPanicUA Nov 3, 2022
46f1763
add missing files to sftp
DoNotPanicUA Nov 3, 2022
27f21ab
add missing files to snowflake + fix spec format
DoNotPanicUA Nov 3, 2022
c85f053
add missing files to tidb
DoNotPanicUA Nov 3, 2022
9601782
add missing files to kafka - fix spec format
DoNotPanicUA Nov 3, 2022
3d7ce65
Merge branch 'master' into aleonets/17580-enable-py-spec-test
grubberr Nov 4, 2022
a4813d2
airbyte-source-acceptance-test added
grubberr Nov 4, 2022
89b2b88
add missing import
DoNotPanicUA Nov 4, 2022
5d6036c
Delete acceptance-test-config.yml
DoNotPanicUA Nov 5, 2022
a560e82
Delete acceptance-test-docker.sh
DoNotPanicUA Nov 5, 2022
a02a0b7
Update build.gradle
DoNotPanicUA Nov 5, 2022
1b9664a
Update build.gradle
DoNotPanicUA Nov 5, 2022
564f116
format
DoNotPanicUA Nov 7, 2022
5f6a7af
Merge remote-tracking branch 'origin/aleonets/17580-enable-py-spec-te…
DoNotPanicUA Nov 7, 2022
98ff91e
revert changes
DoNotPanicUA Nov 7, 2022
60f467f
manual .sh files format
DoNotPanicUA Nov 7, 2022
39ca8fe
Merge branch 'master' into aleonets/17580-enable-py-spec-test
DoNotPanicUA Nov 7, 2022
116bf78
upd expected spec
DoNotPanicUA Nov 8, 2022
c67136b
Merge remote-tracking branch 'origin/aleonets/17580-enable-py-spec-te…
DoNotPanicUA Nov 9, 2022
b1ed0da
format
DoNotPanicUA Nov 9, 2022
235269b
fix SAT after master merge
DoNotPanicUA Nov 9, 2022
c5efca9
Merge branch 'master' into aleonets/17580-enable-py-spec-test
DoNotPanicUA Nov 9, 2022
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
@@ -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-bigquery:dev
tests:
spec:
- spec_path: "src/test-integration/resources/expected_spec.json"
config_path: "src/test-integration/resources/dummy_config.json"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW in source python connectors we usually store dummy, invalid configs here:
integration_tests/invalid_config.json
it just FYI

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, this is a valid config, but mocked :)
we don't have any configs actually before we up test environment.

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):dev

# 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 @@
#
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these /integration_tests files are needed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evantahler
if want to run the tests only locally as we see here, yes.
If you want to run it as part of the CI testing, you have to add it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The acceptance.py is indeed required to launch the test suite with the SAT plugin. We should find a better way because it's far from ideal. @DoNotPanicUA could you please create an issue about this?

# 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,5 @@
{
"dataset_id": "dataset",
"project_id": "project",
"credentials_json": "credentials"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"documentationUrl": "https://docs.airbyte.com/integrations/sources/bigquery",
"supportsIncremental": true,
"supportsNormalization": true,
"supportsDBT": true,
"supported_destination_sync_modes": [],
"supported_sync_modes": ["overwrite", "append", "append_dedup"],
"connectionSpecification": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "BigQuery Source Spec",
"type": "object",
"required": ["project_id", "credentials_json"],
"properties": {
"project_id": {
"type": "string",
"description": "The GCP project ID for the project containing the target BigQuery dataset.",
"title": "Project ID"
},
"dataset_id": {
"type": "string",
"description": "The dataset ID to search for tables and views. If you are only loading data from one dataset, setting this option could result in much faster schema discovery.",
"title": "Default Dataset ID"
},
"credentials_json": {
"type": "string",
"description": "The contents of your Service Account Key JSON file. See the <a href=\"https://docs.airbyte.com/integrations/sources/bigquery#setup-the-bigquery-source-in-airbyte\">docs</a> for more information on how to obtain this key.",
"title": "Credentials JSON",
"airbyte_secret": true
}
}
}
}
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-clickhouse: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):dev

# 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,6 @@
{
"host": "default",
"port": 8123,
"database": "default",
"username": "default"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
{
"documentationUrl": "https://docs.airbyte.com/integrations/destinations/clickhouse",
"connectionSpecification": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ClickHouse Source Spec",
"type": "object",
"required": ["host", "port", "database", "username"],
"properties": {
"host": {
"description": "The host endpoint of the Clickhouse cluster.",
"title": "Host",
"type": "string",
"order": 0
},
"port": {
"description": "The port of the database.",
"title": "Port",
"type": "integer",
"minimum": 0,
"maximum": 65536,
"default": 8123,
"examples": ["8123"],
"order": 1
},
"database": {
"description": "The name of the database.",
"title": "Database",
"type": "string",
"examples": ["default"],
"order": 2
},
"username": {
"description": "The username which is used to access the database.",
"title": "Username",
"type": "string",
"order": 3
},
"password": {
"description": "The password associated with this username.",
"title": "Password",
"type": "string",
"airbyte_secret": true,
"order": 4
},
"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 '&'. (Eg. key1=value1&key2=value2&key3=value3). For more information read about <a href=\"https://jdbc.postgresql.org/documentation/head/connect.html\">JDBC URL parameters</a>.",
"title": "JDBC URL Parameters (Advanced)",
"type": "string",
"order": 5
},
"ssl": {
"title": "SSL Connection",
"description": "Encrypt data using SSL.",
"type": "boolean",
"default": true,
"order": 6
},
"tunnel_method": {
"type": "object",
"title": "SSH Tunnel Method",
"description": "Whether to initiate an SSH tunnel before connecting to the database, and if so, which kind of authentication to use.",
"oneOf": [
{
"title": "No Tunnel",
"required": ["tunnel_method"],
"properties": {
"tunnel_method": {
"description": "No ssh tunnel needed to connect to database",
"type": "string",
"const": "NO_TUNNEL",
"order": 0
}
}
},
{
"title": "SSH Key Authentication",
"required": [
"tunnel_method",
"tunnel_host",
"tunnel_port",
"tunnel_user",
"ssh_key"
],
"properties": {
"tunnel_method": {
"description": "Connect through a jump server tunnel host using username and ssh key",
"type": "string",
"const": "SSH_KEY_AUTH",
"order": 0
},
"tunnel_host": {
"title": "SSH Tunnel Jump Server Host",
"description": "Hostname of the jump server host that allows inbound ssh tunnel.",
"type": "string",
"order": 1
},
"tunnel_port": {
"title": "SSH Connection Port",
"description": "Port on the proxy/jump server that accepts inbound ssh connections.",
"type": "integer",
"minimum": 0,
"maximum": 65536,
"default": 22,
"examples": ["22"],
"order": 2
},
"tunnel_user": {
"title": "SSH Login Username",
"description": "OS-level username for logging into the jump server host.",
"type": "string",
"order": 3
},
"ssh_key": {
"title": "SSH Private Key",
"description": "OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )",
"type": "string",
"airbyte_secret": true,
"multiline": true,
"order": 4
}
}
},
{
"title": "Password Authentication",
"required": [
"tunnel_method",
"tunnel_host",
"tunnel_port",
"tunnel_user",
"tunnel_user_password"
],
"properties": {
"tunnel_method": {
"description": "Connect through a jump server tunnel host using username and password authentication",
"type": "string",
"const": "SSH_PASSWORD_AUTH",
"order": 0
},
"tunnel_host": {
"title": "SSH Tunnel Jump Server Host",
"description": "Hostname of the jump server host that allows inbound ssh tunnel.",
"type": "string",
"order": 1
},
"tunnel_port": {
"title": "SSH Connection Port",
"description": "Port on the proxy/jump server that accepts inbound ssh connections.",
"type": "integer",
"minimum": 0,
"maximum": 65536,
"default": 22,
"examples": ["22"],
"order": 2
},
"tunnel_user": {
"title": "SSH Login Username",
"description": "OS-level username for logging into the jump server host",
"type": "string",
"order": 3
},
"tunnel_user_password": {
"title": "Password",
"description": "OS-level password for logging into the jump server host",
"type": "string",
"airbyte_secret": true,
"order": 4
}
}
}
]
}
}
},
"supportsNormalization": false,
"supportsDBT": false,
"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-cockroachdb: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):dev

# 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,6 @@
{
"host": "default",
"port": 8123,
"database": "default",
"username": "default"
}
Loading