Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions airbyte_cdk/test/models/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ def __hash__(self) -> int:
expect_records: AcceptanceTestExpectRecords | None = None
file_types: AcceptanceTestFileTypes | None = None
status: Literal["succeed", "failed", "exception"] | None = None
# CAT's `basic_read` opt-out from validating records against the stream schemas.
validate_schema: bool = True
# The connector's top-level `test_strictness_level` in `acceptance-test-config.yml`. Populated
# by `get_scenarios()`; at `high`, `validate_schema: false` is rejected, as in CAT.
test_strictness_level: Literal["low", "high"] | None = None
# The sections of `acceptance-test-config.yml` that list this config. Populated by
# `get_scenarios()`; empty for scenarios built by hand, which run every command.
sections: tuple[str, ...] = ()
Expand Down Expand Up @@ -179,6 +184,18 @@ def runs(self, *commands: ScenarioCommand) -> bool:
"""Whether any of `commands` runs for this scenario. See `commands`."""
return bool(self.commands & frozenset(commands))

@property
def is_basic_read_config(self) -> bool:
"""Whether this config is listed under `basic_read` (or the scenario was built by hand).

Only the records of these configs are checked as in CAT's basic read test: every stream
not declared in `empty_streams` returns records, and every record matches its stream's
schema unless `validate_schema: false` is set. A config read only because it is listed
under `full_refresh` never had CAT's basic read checks, and has no `basic_read` entry to
declare those exceptions in, so its `read` only has to return some records.
"""
return not self.sections or "basic_read" in self.sections

@property
def id(self) -> str:
"""Return a unique identifier for the test scenario.
Expand Down
Loading
Loading