Skip to content

Commit 5ca54c9

Browse files
committed
add docs
1 parent 136c087 commit 5ca54c9

File tree

1 file changed

+103
-4
lines changed

1 file changed

+103
-4
lines changed

airbyte_cdk/test/models/scenario.py

Lines changed: 103 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,107 @@
11
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
2-
"""Run acceptance tests in PyTest.
3-
4-
These tests leverage the same `acceptance-test-config.yml` configuration files as the
5-
acceptance tests in CAT, but they run in PyTest instead of CAT. This allows us to run
2+
"""Models to define test scenarios (smoke tests) which leverage the Standard Tests framework.
3+
4+
NOTE: The `acceptance-test-config.yml` file has been deprecated in favor of the new format.
5+
6+
Connector smoke tests should be defined in the connector's `metadata.yaml` file, under the
7+
`connectorTestSuitesOptions` section, as shown in the example below:
8+
9+
## Basic Configuration of Scenarios
10+
11+
```yaml
12+
data:
13+
# ...
14+
connectorTestSuitesOptions:
15+
# ...
16+
- suite: smokeTests
17+
scenarios:
18+
- name: default
19+
config_file: secrets/config_oauth.json
20+
- name: invalid_config
21+
config_file: integration_tests/invalid_config.json
22+
expect_failure: true
23+
```
24+
25+
You can also specify config settings inline, instead of using a config file:
26+
27+
```yaml
28+
data:
29+
# ...
30+
connectorTestSuitesOptions:
31+
# ...
32+
- suite: smokeTests
33+
scenarios:
34+
- name: default
35+
config_file: secrets/config_oauth.json
36+
config_settings:
37+
# This will override any matching settings in `config_file`:
38+
start_date: "2025-01-01T00:00:00Z"
39+
- name: invalid_config
40+
# No config file needed if using fully hard-coded settings:
41+
config_settings:
42+
client_id: invalid
43+
client_secret: invalid
44+
```
45+
46+
## Streams Filtering
47+
48+
There are several ways to filter which streams are read during a test scenario:
49+
50+
- `only_streams`: A list of stream names to include in the scenario.
51+
- `exclude_streams`: A list of stream names to exclude from the scenario.
52+
- `suggested_streams_only`: A boolean indicating whether to limit to the connector's suggested
53+
streams list, if present. (Looks for `data.suggestedStreams` field in `metadata.yaml`.)
54+
55+
### Stream Filtering Examples
56+
57+
Filter for just one stream:
58+
59+
```yaml
60+
data:
61+
# ...
62+
connectorTestSuitesOptions:
63+
# ...
64+
- suite: smokeTests
65+
scenarios:
66+
- name: default
67+
config_file: secrets/config_oauth.json
68+
only_streams:
69+
- users
70+
```
71+
72+
Exclude a set of premium or restricted streams:
73+
74+
```yaml
75+
data:
76+
# ...
77+
connectorTestSuitesOptions:
78+
# ...
79+
- suite: smokeTests
80+
scenarios:
81+
- name: default # exclude premium streams
82+
exclude_streams:
83+
- premium_users
84+
- restricted_users
85+
```
86+
87+
Filter to just the suggested streams, minus a specific excluded streams:
88+
89+
```yaml
90+
data:
91+
# ...
92+
connectorTestSuitesOptions:
93+
# ...
94+
- suite: smokeTests
95+
scenarios:
96+
- name: default # suggested streams, except restricted_users
97+
suggested_streams_only: true
98+
exclude_streams:
99+
- restricted_users
100+
101+
## Legacy Configuration
102+
103+
For legacy purposes, these tests can leverage the same `acceptance-test-config.yml` configuration
104+
files as the acceptance tests in CAT, but they run in PyTest instead of CAT. This allows us to run
6105
the acceptance tests in the same local environment as we are developing in, speeding
7106
up iteration cycles.
8107
"""

0 commit comments

Comments
 (0)