Skip to content

feat(cli): add docker mode when running FAST tests via CLI #524

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

Draft
wants to merge 171 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
3de3edf
add skeleton implementation, imported from airbyte-pytest
aaronsteers Feb 10, 2025
3b88490
tidy imports
aaronsteers Feb 11, 2025
1250472
fix some imports
aaronsteers Feb 15, 2025
9dec6e3
Merge branch 'main' into aj/feat/mini-cat-test-suites
aaronsteers Feb 19, 2025
11d89f6
working test of tests
aaronsteers Feb 20, 2025
42d8a4e
remove old file
aaronsteers Feb 24, 2025
c8e7722
misc fixes
aaronsteers Feb 24, 2025
6248994
allow subclasses of abstractsource
aaronsteers Feb 24, 2025
a0f8ed5
Merge remote-tracking branch 'origin/main' into aj/feat/mini-cat-test…
aaronsteers Apr 7, 2025
fcfe697
fix test handling for expected errors
aaronsteers Apr 7, 2025
03f3360
Auto-fix lint and format issues
Apr 7, 2025
460c40a
remove unused code
aaronsteers Apr 7, 2025
8918bfe
fix tests
aaronsteers Apr 8, 2025
83344f3
use pep440 style dynamic versioning
aaronsteers Apr 9, 2025
76a92a9
update ci job (temporarily run on all pushes)
aaronsteers Apr 9, 2025
e6911e5
Merge remote-tracking branch 'origin/main' into aj/feat/mini-cat-test…
aaronsteers Apr 10, 2025
039eef0
Merge remote-tracking branch 'origin/main' into aj/feat/mini-cat-test…
aaronsteers Apr 10, 2025
5658441
Update .github/workflows/pypi_publish.yml
aaronsteers Apr 10, 2025
310ea68
fix fixture resource paths
aaronsteers Apr 10, 2025
1e74eef
lint fixes
aaronsteers Apr 10, 2025
c9ad3bd
fix imports
aaronsteers Apr 10, 2025
f8b581e
fix lint issues
aaronsteers Apr 12, 2025
4a05f46
fix lint and typing
aaronsteers Apr 12, 2025
e58dfad
[cherry-pick-me][chore]: resolve pytest warnings undeclared marks, an…
aaronsteers Apr 12, 2025
418dcb9
fix relative path logic
aaronsteers Apr 12, 2025
8d75d0d
ruff fix
aaronsteers Apr 12, 2025
c3a32ae
[cherry-pick-me][fix]: dataclasses constructor break with __test__ me…
aaronsteers Apr 12, 2025
0897b83
fix paths
aaronsteers Apr 12, 2025
b282e5d
[cherry-pick-me]: use kw args
aaronsteers Apr 12, 2025
9a8b5eb
Merge branch 'main' into aj/feat/mini-cat-test-suites
aaronsteers Apr 12, 2025
d5aaf3c
[cherry-pick-me]: kw args
aaronsteers Apr 12, 2025
7a00ff4
[cherry-pick-me]: use kw args for Test* dataclasses
aaronsteers Apr 12, 2025
5dff39e
Merge remote-tracking branch 'origin/main' into aj/feat/mini-cat-test…
aaronsteers Apr 12, 2025
3160691
fix relative resource paths
aaronsteers Apr 12, 2025
015ced9
fix imports
aaronsteers Apr 12, 2025
e2a9fb9
fix more tests
aaronsteers Apr 12, 2025
bfc1943
format fix
aaronsteers Apr 12, 2025
f82b76a
[cherry-pick-me][chore]: resolve pytest warnings undeclared marks, an…
aaronsteers Apr 12, 2025
f091b53
[cherry-pick-me][fix]: dataclasses constructor break with __test__ me…
aaronsteers Apr 12, 2025
12afc3d
[cherry-pick-me]: use kw args
aaronsteers Apr 12, 2025
cca55f7
[cherry-pick-me]: kw args
aaronsteers Apr 12, 2025
4f7a84e
[cherry-pick-me]: use kw args for Test* dataclasses
aaronsteers Apr 12, 2025
e24594b
Merge branch 'devin/1744436819-cherry-pick-test-fixes' into aj/feat/m…
aaronsteers Apr 12, 2025
9389cc5
reduce code needed for inheritance
aaronsteers Apr 12, 2025
e4cae20
fix type hint
aaronsteers Apr 12, 2025
18ff2e8
Use ClassVar[bool] for __test__ instead of kw_only=True
devin-ai-integration[bot] Apr 12, 2025
40fddcc
Use ClassVar[bool] for __test__ attributes instead of kw_only=True
devin-ai-integration[bot] Apr 12, 2025
e2c69df
Update more classes to use ClassVar[bool] for __test__ attributes
devin-ai-integration[bot] Apr 12, 2025
e79e901
Apply ruff formatting
devin-ai-integration[bot] Apr 12, 2025
c26345e
Fix remaining files with ruff formatting
devin-ai-integration[bot] Apr 12, 2025
eb0f643
addl cleanup
aaronsteers Apr 12, 2025
7a750d6
Merge branch 'devin/1744436819-cherry-pick-test-fixes' into aj/feat/m…
aaronsteers Apr 13, 2025
b8407e5
Merge branch 'main' into devin/1744436819-cherry-pick-test-fixes
aaronsteers Apr 14, 2025
88acba3
Merge branch 'main' into aj/feat/mini-cat-test-suites
aaronsteers Apr 14, 2025
4b6c53e
poe lock
aaronsteers Apr 14, 2025
f0bea0c
remove unrelated changes
aaronsteers Apr 14, 2025
8c91964
Merge branch 'devin/1744436819-cherry-pick-test-fixes' into aj/feat/m…
aaronsteers Apr 14, 2025
4f84c14
revert unnecessary changes
aaronsteers Apr 14, 2025
d0aba9f
Merge branch 'devin/1744436819-cherry-pick-test-fixes' into aj/feat/m…
aaronsteers Apr 14, 2025
1468a48
clean up naming, remove unused
aaronsteers Apr 14, 2025
2812e7d
tidy up pr
aaronsteers Apr 14, 2025
c4e6655
clean up IConnector interface
aaronsteers Apr 14, 2025
f6d6ccd
ruff fix
aaronsteers Apr 14, 2025
d20d91f
poe lock
aaronsteers Apr 14, 2025
b363b52
Merge branch 'main' into aj/feat/mini-cat-test-suites
aaronsteers Apr 15, 2025
b045532
clean up test module structure and pytest hooks
aaronsteers Apr 15, 2025
dc95a71
remove extra pytest files
aaronsteers Apr 15, 2025
a36d6a9
add usage docs
aaronsteers Apr 15, 2025
da442a9
clean up
aaronsteers Apr 15, 2025
623df9c
new cli
aaronsteers Apr 16, 2025
c65d832
feat: Add build command to CDK CLI
devin-ai-integration[bot] Apr 16, 2025
bd7a765
fix: Update formatting for build command files
devin-ai-integration[bot] Apr 16, 2025
dd1f040
add airbyte-cdk cli scaffold
aaronsteers Apr 17, 2025
0209c1e
add comment
aaronsteers Apr 17, 2025
2a32e27
feat: Add Click-based CLI interface
devin-ai-integration[bot] Apr 17, 2025
653bda1
chore: Update poetry.lock
devin-ai-integration[bot] Apr 17, 2025
9510f2d
fix: Add type annotations to CLI functions
devin-ai-integration[bot] Apr 17, 2025
84d649b
feat: Always build for both AMD64 and ARM64 architectures
devin-ai-integration[bot] Apr 17, 2025
f3e1743
fix: Format code with ruff
devin-ai-integration[bot] Apr 17, 2025
2bc8848
fix: Address PR comments - remove infer_connector_language, use build…
devin-ai-integration[bot] Apr 17, 2025
ca1bbbe
fix: Update Dockerignore to use * pattern and fix formatting
devin-ai-integration[bot] Apr 17, 2025
373f263
fix: Format all files with ruff
devin-ai-integration[bot] Apr 17, 2025
430dd8d
docs: Move build.md content to __init__.py docstring
devin-ai-integration[bot] Apr 17, 2025
fe946ac
docs: Update __init__.py docstring with build command documentation
devin-ai-integration[bot] Apr 17, 2025
af3e56e
Delete airbyte_cdk/cli/entrypoint/run.py
aaronsteers Apr 17, 2025
7b6dc5d
fix: Clean up duplicate code in _run.py and update imports
devin-ai-integration[bot] Apr 17, 2025
2b1db11
refactor: Move build functionality to utils/docker and metadata model…
devin-ai-integration[bot] Apr 17, 2025
4d45bab
fix: Remove unsupported --ignorefile flag and implement proper cleanu…
devin-ai-integration[bot] Apr 17, 2025
7e68925
fix: Add fallback to single platform build when multi-platform not av…
devin-ai-integration[bot] Apr 17, 2025
df4b315
fix: Update dockerignore to include source_* directories
devin-ai-integration[bot] Apr 17, 2025
38c7166
add helper functions: find_connector_root(), find_connector_root_from…
aaronsteers Apr 17, 2025
83eaca9
enhancement: Improve build process to match airbyte-ci's approach wit…
devin-ai-integration[bot] Apr 18, 2025
789f109
fix: Apply ruff formatting to fix CI checks
devin-ai-integration[bot] Apr 18, 2025
c371030
misc fixes (working now)
aaronsteers Apr 18, 2025
8892914
delete unused devtools.py file
aaronsteers Apr 18, 2025
ba09434
fix: Add run_command function to build.py and update imports
devin-ai-integration[bot] Apr 18, 2025
b25671b
fix: Add run_command function to build.py
devin-ai-integration[bot] Apr 18, 2025
de07f9d
clean up cli module structure
aaronsteers Apr 18, 2025
a330cb7
update cli entrypoint
aaronsteers Apr 18, 2025
14b1385
add image command stub
aaronsteers Apr 18, 2025
1b45851
add --version support
aaronsteers Apr 18, 2025
67e4aca
Merge remote-tracking branch 'origin/main' into aj/feat/add-standard-…
aaronsteers Apr 18, 2025
79b11dc
ruff format
aaronsteers Apr 18, 2025
aec8602
chore: `poetry add rich` (transitive dependency)
aaronsteers Apr 18, 2025
ea848b0
remove click declaration (replaced by rich-click)
aaronsteers Apr 18, 2025
4fc4932
typing fixes
aaronsteers Apr 18, 2025
0cc217e
fix deptry issues
aaronsteers Apr 18, 2025
d7ee4f1
Merge branch 'aj/feat/add-standard-tests-cli' into devin/1744841809-a…
aaronsteers Apr 18, 2025
e1c7c13
delete unnecessay
aaronsteers Apr 18, 2025
ba0ab6b
move docstring
aaronsteers Apr 18, 2025
61fdced
fully move model to models.connector_metadata
aaronsteers Apr 18, 2025
f293e7e
clean up
aaronsteers Apr 18, 2025
7daa7f0
fix docstring
aaronsteers Apr 18, 2025
4ba7e5c
clean up cli module
aaronsteers Apr 18, 2025
49c9045
revert format update
aaronsteers Apr 18, 2025
d9c1ced
lean into pydantic model
aaronsteers Apr 18, 2025
3103d0c
clean up
aaronsteers Apr 18, 2025
52546be
clean up
aaronsteers Apr 18, 2025
63cbc9b
fix: Address PR feedback - fix typo in __all__, update docstring, and…
devin-ai-integration[bot] Apr 18, 2025
c8f91cf
fix: Correct CLI entry point in pyproject.toml
devin-ai-integration[bot] Apr 18, 2025
71652ef
Apply suggestions from code review
aaronsteers Apr 18, 2025
78b173c
add-back the help text
aaronsteers Apr 18, 2025
598d454
refactor, tidy up
aaronsteers Apr 18, 2025
c4f9eee
pull in refactoring from downstream pr
aaronsteers Apr 18, 2025
5f025ba
add manifest help text
aaronsteers Apr 18, 2025
6fdf2c6
feat: add secrets fetch command to CDK CLI (#494)
devin-ai-integration[bot] Apr 18, 2025
db52db6
apply suggestion (owner-only read/write)
aaronsteers Apr 18, 2025
4d524b6
ensure we print the absolute path so secrets don't get lost
aaronsteers Apr 18, 2025
72514ac
allow imports outside of cwd
aaronsteers Apr 19, 2025
8cdf876
remove stale files from other PR
aaronsteers Apr 19, 2025
032d5e7
remove stale declarative module
aaronsteers Apr 19, 2025
7de9ab7
fix imports and such
aaronsteers Apr 19, 2025
a28e63b
tidy up cli help text declarations
aaronsteers Apr 19, 2025
1b47886
Merge branch 'main' into aj/feat/add-standard-tests-cli
aaronsteers Apr 19, 2025
bcf5d9f
Merge branch 'aj/feat/add-standard-tests-cli' into devin/1744841809-a…
aaronsteers Apr 19, 2025
871cb71
refactor docker implementation
aaronsteers Apr 21, 2025
42af39d
toggle default arch, fix return value for verify step
aaronsteers Apr 21, 2025
964a215
better err handling
aaronsteers Apr 21, 2025
d7f9c7b
clean up
aaronsteers Apr 21, 2025
3e9183b
tidy docstring
aaronsteers Apr 21, 2025
6ea0623
ruff fix
aaronsteers Apr 21, 2025
ea5fd85
poe lock
aaronsteers Apr 21, 2025
0229421
fix mypy
aaronsteers Apr 21, 2025
297a98c
fix base image
aaronsteers Apr 21, 2025
f7b19e1
use uv instead of pip for installs
aaronsteers Apr 21, 2025
7a87b62
use rich click
aaronsteers Apr 21, 2025
f7e4ddf
refactor, use build args
aaronsteers Apr 21, 2025
e45e19b
Merge branch 'main' into aj/feat/add-standard-tests-cli
aaronsteers Apr 24, 2025
bf7ce53
Auto-commit Resolving dependencies... changes
Apr 24, 2025
f323849
improve language detection
aaronsteers Apr 24, 2025
51301d4
remove java image option
aaronsteers Apr 24, 2025
e40f3a1
Merge branch 'main' into aj/feat/add-standard-tests-cli
aaronsteers Apr 24, 2025
c12242d
mypy fix
aaronsteers Apr 24, 2025
86e0a60
clean up arch implementation
aaronsteers Apr 24, 2025
b0ba703
Auto-fix lint and format issues
Apr 24, 2025
4f383fc
chore: add optional 'dev' dependency
aaronsteers Apr 24, 2025
b012495
Auto-commit Resolving dependencies... changes
Apr 25, 2025
9ea97fa
Merge branch 'main' into aj/feat/add-standard-tests-cli
aaronsteers Apr 25, 2025
fb51377
Merge branch 'aj/feat/add-standard-tests-cli' into aj/feat/add-cli-bu…
aaronsteers Apr 25, 2025
7d93966
Merge branch 'main' into aj/feat/add-cli-build-command
aaronsteers Apr 25, 2025
02e7ce1
fix multi-docker tag
aaronsteers Apr 25, 2025
3981729
remove unused import
aaronsteers Apr 25, 2025
eb8cea9
reorder docker build args
aaronsteers Apr 25, 2025
53dbe55
add error handling for missing metadata.yml file
aaronsteers Apr 25, 2025
dcbc7cc
improve err handling for connector image build
aaronsteers Apr 25, 2025
8341969
add exception handling for tag errors
aaronsteers Apr 25, 2025
3d73ded
ruff format fix
aaronsteers Apr 25, 2025
bfe7d91
add docker container ops
aaronsteers Apr 30, 2025
91700ed
Merge remote-tracking branch 'origin/main' into aj/feat/cli/add-docke…
aaronsteers May 7, 2025
d631c34
tidy up
aaronsteers May 7, 2025
90d4f1b
Merge remote-tracking branch 'origin/main' into aj/feat/cli/add-docke…
aaronsteers May 9, 2025
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
33 changes: 31 additions & 2 deletions airbyte_cdk/cli/airbyte_cdk/_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@

@click.group(
name="connector",
help=__doc__.replace("\n", "\n\n"), # Render docstring as help text (markdown)
help=__doc__.replace("\n", "\n\n"), # Render docstring as help text (markdown) # type: ignore
)
def connector_cli_group() -> None:
"""Connector related commands."""
Expand All @@ -113,10 +113,21 @@ def connector_cli_group() -> None:
default=False,
help="Only collect tests, do not run them.",
)
@click.option(
"--use-docker-image",
# is_flag=True,
default=False,
type=str,
help="Run tests via docker.",
callback=lambda ctx, param, value: (
"true" if value is True else (value if isinstance(value, str) else False)
),
)
def test(
connector: str | Path | None = None,
*,
collect_only: bool = False,
use_docker_image: str | bool = False,
) -> None:
"""Run connector tests.

Expand All @@ -127,12 +138,20 @@ def test(

If no connector name or directory is provided, we will look within the current working
directory. If the current working directory is not a connector directory (e.g. starting
with 'source-') and no connector name or path is provided, the process will fail.
with 'source-' or 'destination-') and no connector name or path is provided, the process
will fail.
"""
if isinstance(
use_docker_image,
str,
) and use_docker_image.lower() in {"true", "false"}:
use_docker_image = bool(use_docker_image)

if pytest is None:
raise ImportError(
"pytest is not installed. Please install pytest to run the connector tests."
)

click.echo("Connector test command executed.")
connector_name, connector_directory = resolve_connector_name_and_directory(connector)

Expand All @@ -157,9 +176,19 @@ def test(
test_file_path.parent.mkdir(parents=True, exist_ok=True)
test_file_path.write_text(file_text)

pytest_args.append("-p airbyte_cdk.test.standard_tests.pytest_hooks")

if collect_only:
pytest_args.append("--collect-only")

if use_docker_image:
click.echo(f"Using Docker-based test runner...")
pytest_args.append("--use-docker-image")
if isinstance(use_docker_image, str):
pytest_args.append(
use_docker_image,
)

pytest_args.append(str(test_file_path))
click.echo(f"Running tests from connector directory: {connector_directory}...")
click.echo(f"Test file: {test_file_path}")
Expand Down
4 changes: 4 additions & 0 deletions airbyte_cdk/cli/airbyte_cdk/_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ def build(
) -> None:
"""Build a connector Docker image.

This command builds a Docker image for a connector, using either
the connector's Dockerfile or a base image specified in the metadata.
The image is built for both AMD64 and ARM64 architectures.

[CONNECTOR] can be a connector name (e.g. 'source-pokeapi'), a path to a connector directory, or omitted to use the current working directory.
If a string containing '/' is provided, it is treated as a path. Otherwise, it is treated as a connector name.
"""
Expand Down
9 changes: 7 additions & 2 deletions airbyte_cdk/test/standard_tests/_job_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
import logging
import tempfile
import uuid
from abc import abstractmethod
from collections.abc import Callable
from dataclasses import asdict
from pathlib import Path
from typing import Any, Callable, Literal
from typing import Any, Literal

import orjson
from typing_extensions import Protocol, runtime_checkable

from airbyte_cdk.models import (
ConfiguredAirbyteCatalog,
ConnectorSpecification,
Status,
)
from airbyte_cdk.test import entrypoint_wrapper
Expand Down Expand Up @@ -50,8 +53,10 @@ class IConnector(Protocol):
directly on the connector (which doesn't yet exist).
"""

def spec(self, logger: logging.Logger) -> Any:
@abstractmethod
def spec(self, logger: logging.Logger) -> ConnectorSpecification:
"""Connectors should have a `spec` method."""
...


def run_test_job(
Expand Down
95 changes: 66 additions & 29 deletions airbyte_cdk/test/standard_tests/connector_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import inspect
import os
import sys
from collections.abc import Callable
from pathlib import Path
from typing import cast
from typing import Literal, cast

import pytest
import yaml
from boltons.typeutils import classproperty

Expand All @@ -21,6 +21,7 @@
)
from airbyte_cdk.test import entrypoint_wrapper
from airbyte_cdk.test.standard_tests._job_runner import IConnector, run_test_job
from airbyte_cdk.test.standard_tests.docker_connectors import DockerConnector
from airbyte_cdk.test.standard_tests.models import (
ConnectorTestScenario,
)
Expand All @@ -30,19 +31,43 @@
)


@pytest.fixture
def use_docker_image(request: pytest.FixtureRequest) -> str | bool:
"""Fixture to determine if a Docker image should be used for the test."""
return request.config.getoption("use_docker_image")


class ConnectorTestSuiteBase(abc.ABC):
"""Base class for connector test suites."""

connector: type[IConnector] | Callable[[], IConnector] | None # type: ignore [reportRedeclaration]
connector_class: type[IConnector] | None = None
"""The connector class or a factory function that returns an scenario of IConnector."""

@classproperty # type: ignore [no-redef]
def connector(cls) -> type[IConnector] | Callable[[], IConnector] | None:
@classmethod
def get_test_class_dir(cls) -> Path:
"""Get the file path that contains the class."""
module = sys.modules[cls.__module__]
# Get the directory containing the test file
return Path(inspect.getfile(module)).parent

@classmethod
def create_connector(
cls,
scenario: ConnectorTestScenario,
*,
use_docker_image: str | bool,
) -> IConnector:
"""Instantiate the connector class."""
"""Get the connector class for the test suite.

This assumes a python connector and should be overridden by subclasses to provide the
specific connector class to be tested.
"""
if use_docker_image:
return cls.create_docker_connector(
docker_image=use_docker_image,
)

connector_root = cls.get_connector_root_dir()
connector_name = connector_root.absolute().name

Expand All @@ -65,7 +90,10 @@ def connector(cls) -> type[IConnector] | Callable[[], IConnector] | None:

# Dynamically get the class from the module
try:
return cast(type[IConnector], getattr(module, expected_class_name))
return cast(
type[IConnector],
getattr(module, expected_class_name),
)()
except AttributeError as e:
# We did not find it based on our expectations, so let's check if we can find it
# with a case-insensitive match.
Expand All @@ -77,43 +105,52 @@ def connector(cls) -> type[IConnector] | Callable[[], IConnector] | None:
raise ImportError(
f"Module '{expected_module_name}' does not have a class named '{expected_class_name}'."
) from e
return cast(type[IConnector], getattr(module, matching_class_name))

@classmethod
def get_test_class_dir(cls) -> Path:
"""Get the file path that contains the class."""
module = sys.modules[cls.__module__]
# Get the directory containing the test file
return Path(inspect.getfile(module)).parent
return cast(
type[IConnector],
getattr(module, matching_class_name),
)()

@classmethod
def create_connector(
def create_docker_connector(
cls,
scenario: ConnectorTestScenario | None,
docker_image: str | Literal[True],
) -> IConnector:
"""Instantiate the connector class."""
connector = cls.connector # type: ignore
if connector:
if callable(connector) or isinstance(connector, type):
# If the connector is a class or factory function, instantiate it:
return cast(IConnector, connector()) # type: ignore [redundant-cast]

# Otherwise, we can't instantiate the connector. Fail with a clear error message.
raise NotImplementedError(
"No connector class or connector factory function provided. "
"Please provide a class or factory function in `cls.connector`, or "
"override `cls.create_connector()` to define a custom initialization process."
"""Create a connector instance using Docker."""
if not docker_image:
raise ValueError("Docker image is required to create a Docker connector.")

# Create the connector object by building the connector
if docker_image is True:
return DockerConnector.from_connector_directory(
connector_directory=cls.get_connector_root_dir(),
)

if not isinstance(docker_image, str):
raise ValueError(
"Expected `docker_image` to be 'True' or of type `str`. "
f"Type found: {type(docker_image).__name__}"
)

# Create the connector object using the provided Docker image
return DockerConnector(
connector_name=cls.get_connector_root_dir().name,
docker_image=docker_image,
)

# Test Definitions

def test_check(
self,
scenario: ConnectorTestScenario,
*,
use_docker_image: str | bool,
) -> None:
"""Run `connection` acceptance tests."""
result: entrypoint_wrapper.EntrypointOutput = run_test_job(
self.create_connector(scenario),
self.create_connector(
scenario,
use_docker_image=use_docker_image,
),
"check",
test_scenario=scenario,
)
Expand Down
11 changes: 10 additions & 1 deletion airbyte_cdk/test/standard_tests/declarative_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def components_py_path(cls) -> Path | None:
@classmethod
def create_connector(
cls,
scenario: ConnectorTestScenario | None,
scenario: ConnectorTestScenario,
*,
use_docker_image: str | bool,
) -> IConnector:
"""Create a connector scenario for the test suite.

Expand All @@ -74,6 +76,13 @@ def create_connector(
Subclasses should not need to override this method.
"""
scenario = scenario or ConnectorTestScenario() # Use default (empty) scenario if None
if use_docker_image:
return cls.create_docker_connector(
docker_image=use_docker_image,
)

config: dict[str, Any] = scenario.get_config_dict(empty_if_missing=True)

manifest_dict = yaml.safe_load(cls.manifest_yaml_path.read_text())
config = {
"__injected_manifest": manifest_dict,
Expand Down
Loading
Loading