|
20 | 20 | DEFAULT_MAXIMUM_NUMBER_OF_PAGES_PER_SLICE, |
21 | 21 | DEFAULT_MAXIMUM_NUMBER_OF_SLICES, |
22 | 22 | DEFAULT_MAXIMUM_RECORDS, |
23 | | - TestReadLimits, |
| 23 | + TestLimits, |
24 | 24 | create_source, |
25 | 25 | get_limits, |
26 | 26 | resolve_manifest, |
|
384 | 384 | RESOLVE_DYNAMIC_STREAM_MANIFEST_CONFIG = { |
385 | 385 | "__injected_declarative_manifest": DYNAMIC_STREAM_MANIFEST, |
386 | 386 | "__command": "full_resolve_manifest", |
| 387 | + "__test_read_config": {"max_streams": 2}, |
387 | 388 | } |
388 | 389 |
|
389 | 390 | TEST_READ_CONFIG = { |
@@ -524,7 +525,7 @@ def test_resolve_manifest(valid_resolve_manifest_config_file): |
524 | 525 | command = "resolve_manifest" |
525 | 526 | config["__command"] = command |
526 | 527 | source = ManifestDeclarativeSource(source_config=MANIFEST) |
527 | | - limits = TestReadLimits() |
| 528 | + limits = TestLimits() |
528 | 529 | resolved_manifest = handle_connector_builder_request( |
529 | 530 | source, command, config, create_configured_catalog("dummy_stream"), _A_STATE, limits |
530 | 531 | ) |
@@ -728,7 +729,7 @@ def test_read(): |
728 | 729 | emitted_at=1, |
729 | 730 | ), |
730 | 731 | ) |
731 | | - limits = TestReadLimits() |
| 732 | + limits = TestLimits() |
732 | 733 | with patch( |
733 | 734 | "airbyte_cdk.connector_builder.test_reader.TestReader.run_test_read", |
734 | 735 | return_value=stream_read, |
@@ -789,7 +790,7 @@ def test_config_update() -> None: |
789 | 790 | config, |
790 | 791 | ConfiguredAirbyteCatalogSerializer.load(CONFIGURED_CATALOG), |
791 | 792 | _A_PER_PARTITION_STATE, |
792 | | - TestReadLimits(), |
| 793 | + TestLimits(), |
793 | 794 | ) |
794 | 795 | assert output.record.data["latest_config_update"] |
795 | 796 |
|
@@ -825,7 +826,7 @@ def check_config_against_spec(self) -> Literal[False]: |
825 | 826 | mock_from_exception.return_value = stack_trace |
826 | 827 |
|
827 | 828 | source = MockManifestDeclarativeSource() |
828 | | - limits = TestReadLimits() |
| 829 | + limits = TestLimits() |
829 | 830 | response = read_stream( |
830 | 831 | source, |
831 | 832 | TEST_READ_CONFIG, |
@@ -865,7 +866,7 @@ def test_handle_429_response(): |
865 | 866 | ] = {"backoff_strategies": [{"type": "ConstantBackoffStrategy", "backoff_time_in_seconds": 5}]} |
866 | 867 |
|
867 | 868 | config = TEST_READ_CONFIG |
868 | | - limits = TestReadLimits() |
| 869 | + limits = TestLimits() |
869 | 870 | source = create_source(config, limits) |
870 | 871 |
|
871 | 872 | with patch("requests.Session.send", return_value=response) as mock_send: |
@@ -982,7 +983,7 @@ def test_create_source(): |
982 | 983 | max_records = 3 |
983 | 984 | max_pages_per_slice = 2 |
984 | 985 | max_slices = 1 |
985 | | - limits = TestReadLimits(max_records, max_pages_per_slice, max_slices) |
| 986 | + limits = TestLimits(max_records, max_pages_per_slice, max_slices) |
986 | 987 |
|
987 | 988 | config = {"__injected_declarative_manifest": MANIFEST} |
988 | 989 |
|
@@ -1064,7 +1065,7 @@ def test_read_source(mock_http_stream): |
1064 | 1065 | max_records = 100 |
1065 | 1066 | max_pages_per_slice = 2 |
1066 | 1067 | max_slices = 3 |
1067 | | - limits = TestReadLimits(max_records, max_pages_per_slice, max_slices) |
| 1068 | + limits = TestLimits(max_records, max_pages_per_slice, max_slices) |
1068 | 1069 |
|
1069 | 1070 | catalog = ConfiguredAirbyteCatalog( |
1070 | 1071 | streams=[ |
@@ -1111,7 +1112,7 @@ def test_read_source_single_page_single_slice(mock_http_stream): |
1111 | 1112 | max_records = 100 |
1112 | 1113 | max_pages_per_slice = 1 |
1113 | 1114 | max_slices = 1 |
1114 | | - limits = TestReadLimits(max_records, max_pages_per_slice, max_slices) |
| 1115 | + limits = TestLimits(max_records, max_pages_per_slice, max_slices) |
1115 | 1116 |
|
1116 | 1117 | catalog = ConfiguredAirbyteCatalog( |
1117 | 1118 | streams=[ |
@@ -1195,7 +1196,7 @@ def test_handle_read_external_requests(deployment_mode, url_base, expected_error |
1195 | 1196 | endpoints when running on Cloud or OSS deployments |
1196 | 1197 | """ |
1197 | 1198 |
|
1198 | | - limits = TestReadLimits(max_records=100, max_pages_per_slice=1, max_slices=1) |
| 1199 | + limits = TestLimits(max_records=100, max_pages_per_slice=1, max_slices=1) |
1199 | 1200 |
|
1200 | 1201 | catalog = ConfiguredAirbyteCatalog( |
1201 | 1202 | streams=[ |
@@ -1281,7 +1282,7 @@ def test_handle_read_external_oauth_request(deployment_mode, token_url, expected |
1281 | 1282 | endpoints when running on Cloud or OSS deployments |
1282 | 1283 | """ |
1283 | 1284 |
|
1284 | | - limits = TestReadLimits(max_records=100, max_pages_per_slice=1, max_slices=1) |
| 1285 | + limits = TestLimits(max_records=100, max_pages_per_slice=1, max_slices=1) |
1285 | 1286 |
|
1286 | 1287 | catalog = ConfiguredAirbyteCatalog( |
1287 | 1288 | streams=[ |
@@ -1339,7 +1340,7 @@ def test_read_stream_exception_with_secrets(): |
1339 | 1340 | ] |
1340 | 1341 | ) |
1341 | 1342 | state = [] |
1342 | | - limits = TestReadLimits() |
| 1343 | + limits = TestLimits() |
1343 | 1344 |
|
1344 | 1345 | # Add the secret to be filtered |
1345 | 1346 | update_secrets([config["api_key"]]) |
@@ -1367,7 +1368,7 @@ def test_full_resolve_manifest(valid_resolve_manifest_config_file): |
1367 | 1368 | config = copy.deepcopy(RESOLVE_DYNAMIC_STREAM_MANIFEST_CONFIG) |
1368 | 1369 | command = config["__command"] |
1369 | 1370 | source = ManifestDeclarativeSource(source_config=DYNAMIC_STREAM_MANIFEST) |
1370 | | - limits = TestReadLimits() |
| 1371 | + limits = TestLimits(max_streams=2) |
1371 | 1372 | with HttpMocker() as http_mocker: |
1372 | 1373 | http_mocker.get( |
1373 | 1374 | HttpRequest(url="https://api.test.com/parents"), |
@@ -1625,72 +1626,6 @@ def test_full_resolve_manifest(valid_resolve_manifest_config_file): |
1625 | 1626 | }, |
1626 | 1627 | "dynamic_stream_name": "TestDynamicStream", |
1627 | 1628 | }, |
1628 | | - { |
1629 | | - "type": "DeclarativeStream", |
1630 | | - "name": "parent_2_item_1", |
1631 | | - "primary_key": [], |
1632 | | - "schema_loader": { |
1633 | | - "type": "InlineSchemaLoader", |
1634 | | - "schema": { |
1635 | | - "$schema": "http://json-schema.org/schema#", |
1636 | | - "properties": {"ABC": {"type": "number"}, "AED": {"type": "number"}}, |
1637 | | - "type": "object", |
1638 | | - }, |
1639 | | - }, |
1640 | | - "retriever": { |
1641 | | - "type": "SimpleRetriever", |
1642 | | - "requester": { |
1643 | | - "type": "HttpRequester", |
1644 | | - "url_base": "https://api.test.com", |
1645 | | - "path": "2/1", |
1646 | | - "http_method": "GET", |
1647 | | - "authenticator": { |
1648 | | - "type": "ApiKeyAuthenticator", |
1649 | | - "header": "apikey", |
1650 | | - "api_token": "{{ config['api_key'] }}", |
1651 | | - }, |
1652 | | - }, |
1653 | | - "record_selector": { |
1654 | | - "type": "RecordSelector", |
1655 | | - "extractor": {"type": "DpathExtractor", "field_path": []}, |
1656 | | - }, |
1657 | | - "paginator": {"type": "NoPagination"}, |
1658 | | - }, |
1659 | | - "dynamic_stream_name": "TestDynamicStream", |
1660 | | - }, |
1661 | | - { |
1662 | | - "type": "DeclarativeStream", |
1663 | | - "name": "parent_2_item_2", |
1664 | | - "primary_key": [], |
1665 | | - "schema_loader": { |
1666 | | - "type": "InlineSchemaLoader", |
1667 | | - "schema": { |
1668 | | - "$schema": "http://json-schema.org/schema#", |
1669 | | - "properties": {"ABC": {"type": "number"}, "AED": {"type": "number"}}, |
1670 | | - "type": "object", |
1671 | | - }, |
1672 | | - }, |
1673 | | - "retriever": { |
1674 | | - "type": "SimpleRetriever", |
1675 | | - "requester": { |
1676 | | - "type": "HttpRequester", |
1677 | | - "url_base": "https://api.test.com", |
1678 | | - "path": "2/2", |
1679 | | - "http_method": "GET", |
1680 | | - "authenticator": { |
1681 | | - "type": "ApiKeyAuthenticator", |
1682 | | - "header": "apikey", |
1683 | | - "api_token": "{{ config['api_key'] }}", |
1684 | | - }, |
1685 | | - }, |
1686 | | - "record_selector": { |
1687 | | - "type": "RecordSelector", |
1688 | | - "extractor": {"type": "DpathExtractor", "field_path": []}, |
1689 | | - }, |
1690 | | - "paginator": {"type": "NoPagination"}, |
1691 | | - }, |
1692 | | - "dynamic_stream_name": "TestDynamicStream", |
1693 | | - }, |
1694 | 1629 | ], |
1695 | 1630 | "check": {"type": "CheckStream", "stream_names": ["lists"]}, |
1696 | 1631 | "spec": { |
|
0 commit comments