Skip to content

Commit

Permalink
add meaningful acceptance test configs
Browse files Browse the repository at this point in the history
  • Loading branch information
postamar committed Aug 22, 2023
1 parent 19a3013 commit 58d0fb1
Show file tree
Hide file tree
Showing 10 changed files with 2,173 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,50 @@
# See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference)
# for more information about how to configure these tests
connector_image: airbyte/source-postgres-strict-encrypt:dev
tests:
custom_environment_variables:
USE_STREAM_CAPABLE_STATE: true
acceptance_tests:
spec:
- spec_path: "src/test/resources/expected_spec.json"
tests:
- spec_path: "src/test-integration/resources/expected_strict_encrypt_spec.json"
config_path: "secrets/config.json"
backward_compatibility_tests_config:
disable_for_version: "1.0.52"
- spec_path: "src/test-integration/resources/expected_strict_encrypt_spec.json"
config_path: "secrets/config_cdc.json"
backward_compatibility_tests_config:
disable_for_version: "1.0.52"
connection:
tests:
- config_path: "secrets/config.json"
status: "succeed"
- config_path: "secrets/config_cdc.json"
status: "succeed"
discovery:
tests:
- config_path: "secrets/config.json"
- config_path: "secrets/config_cdc.json"
backward_compatibility_tests_config:
disable_for_version: "2.1.1"
basic_read:
tests:
- config_path: "secrets/config.json"
expect_records:
path: "integration_tests/expected_records.txt"
- config_path: "secrets/config_cdc.json"
expect_records:
path: "integration_tests/expected_records.txt"
full_refresh:
tests:
- config_path: "secrets/config.json"
- config_path: "secrets/config_cdc.json"
# incremental:
# tests:
# - config_path: "secrets/config.json"
# configured_catalog_path: "integration_tests/incremental_configured_catalog.json"
# future_state:
# bypass_reason: "A java.lang.NullPointerException is thrown when a state with an invalid cursor value is passed"
# - config_path: "secrets/config_cdc.json"
# configured_catalog_path: "integration_tests/incremental_configured_catalog.json"
# future_state:
# bypass_reason: "A java.lang.NullPointerException is thrown when a state with an invalid cursor value is passed"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This directory contains files used to run Connector Acceptance Tests.
* `abnormal_state.json` describes a connector state with a non-existing cursor value.
* `expected_records.txt` lists all the records expected as the output of the basic read operation.
* `incremental_configured_catalog.json` is a configured catalog used as an input of the `incremental` test.
* `seed.sql` is the query we manually ran on a test postgres instance to seed it with test data and enable CDC.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"type": "STREAM",
"stream": {
"stream_state": {
"stream_name": "id_and_name",
"stream_namespace": "public",
"cursor_field": ["id"],
"cursor": "4",
"cursor_record_count": 1
},
"stream_descriptor": {
"name": "id_and_name",
"namespace": "public"
}
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#


import pytest

pytest_plugins = ("connector_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,3 @@
{"stream": "id_and_name", "data": {"id": 1, "name": "picard"}, "emitted_at": 999999}
{"stream": "id_and_name", "data": {"id": 2, "name": "crusher"}, "emitted_at": 999999}
{"stream": "id_and_name", "data": {"id": 3, "name": "vash"}, "emitted_at": 999999}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"streams": [
{
"stream": {
"name": "id_and_name",
"json_schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"id": {
"type": "number",
"airbyte_type": "integer"
}
}
},
"supported_sync_modes": ["full_refresh", "incremental"],
"default_cursor_field": [],
"source_defined_primary_key": [],
"namespace": "public"
},
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["id"],
"user_defined_primary_key": ["id"]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ALTER ROLE postgres WITH REPLICATION;

CREATE
TABLE
id_and_name(
id INTEGER,
name VARCHAR(200)
);

INSERT
INTO
id_and_name(
id,
name
)
VALUES(
1,
'picard'
),
(
2,
'crusher'
),
(
3,
'vash'
);

SELECT
pg_create_logical_replication_slot(
'debezium_slot',
'pgoutput'
);

CREATE
PUBLICATION publication FOR ALL TABLES;
Loading

0 comments on commit 58d0fb1

Please sign in to comment.