Skip to content

Commit 449c3d8

Browse files
authored
Connector acceptance test: Fix discovered catalog caching for different configs (#22301)
Signed-off-by: Sergey Chvalyuk <[email protected]>
1 parent e39b90f commit 449c3d8

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

airbyte-integrations/bases/connector-acceptance-test/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 0.5.1
4+
Fix discovered catalog caching for different configs. [#22301](https://github.com/airbytehq/airbyte/pull/22301)
5+
36
## 0.5.0
47
Re-release of 0.3.0 [#21451](https://github.com/airbytehq/airbyte/pull/21451)
58

airbyte-integrations/bases/connector-acceptance-test/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ COPY pytest.ini setup.py ./
3333
COPY connector_acceptance_test ./connector_acceptance_test
3434
RUN pip install .
3535

36-
LABEL io.airbyte.version=0.5.0
36+
LABEL io.airbyte.version=0.5.1
3737
LABEL io.airbyte.name=airbyte/connector-acceptance-test
3838

3939
ENTRYPOINT ["python", "-m", "pytest", "-p", "connector_acceptance_test.plugin", "-r", "fEsx"]

airbyte-integrations/bases/connector-acceptance-test/connector_acceptance_test/conftest.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
filter_output,
2727
load_config,
2828
load_yaml_or_json_path,
29+
make_hashable,
2930
)
3031
from docker import errors
3132

@@ -259,7 +260,10 @@ def discovered_catalog_fixture(
259260
connector_config, docker_runner: ConnectorRunner, cached_schemas, cache_discovered_catalog: bool
260261
) -> MutableMapping[str, AirbyteStream]:
261262
"""JSON schemas for each stream"""
262-
if not cached_schemas or not cache_discovered_catalog:
263+
cached_schemas = cached_schemas.setdefault(make_hashable(connector_config), {})
264+
if not cache_discovered_catalog:
265+
cached_schemas.clear()
266+
if not cached_schemas:
263267
output = docker_runner.call_discover(config=connector_config)
264268
catalogs = [message.catalog for message in output if message.type == Type.CATALOG]
265269
for stream in catalogs[-1].streams:
@@ -269,14 +273,17 @@ def discovered_catalog_fixture(
269273

270274
@pytest.fixture(name="previous_discovered_catalog")
271275
def previous_discovered_catalog_fixture(
272-
connector_config, previous_connector_docker_runner: ConnectorRunner, previous_cached_schemas
276+
connector_config, previous_connector_docker_runner: ConnectorRunner, previous_cached_schemas, cache_discovered_catalog: bool
273277
) -> MutableMapping[str, AirbyteStream]:
274278
"""JSON schemas for each stream"""
275279
if previous_connector_docker_runner is None:
276280
logging.warning(
277281
"\n We could not retrieve the previous discovered catalog as a connector runner for the previous connector version could not be instantiated."
278282
)
279283
return None
284+
previous_cached_schemas = previous_cached_schemas.setdefault(make_hashable(connector_config), {})
285+
if not cache_discovered_catalog:
286+
previous_cached_schemas.clear()
280287
if not previous_cached_schemas:
281288
output = previous_connector_docker_runner.call_discover(config=connector_config)
282289
catalogs = [message.catalog for message in output if message.type == Type.CATALOG]

0 commit comments

Comments
 (0)