|
1 |
| -# Connector Live Testing Suite |
2 |
| -This system contains utilities for running connector tests against live data, including regression tests. |
| 1 | +# Connector Live Testing |
3 | 2 |
|
4 |
| -## Running the regression tests Locally |
| 3 | +This project contains utilities for running connector tests against live data. |
| 4 | + |
| 5 | +## Requirements |
| 6 | +* `docker` |
| 7 | +* `Python ^3.10` |
| 8 | +* `pipx` |
| 9 | +* `poetry` |
| 10 | + |
| 11 | +## Install |
5 | 12 | ```bash
|
6 |
| -poetry install |
7 |
| -poetry run run-regression-tests |
| 13 | +# From airbyte-ci/connectors/live-tests |
| 14 | +pipx install . |
| 15 | +# To install in editable mode for development |
| 16 | +pipx install . --force --editable |
| 17 | +``` |
| 18 | + |
| 19 | +## Commands |
| 20 | + |
| 21 | +### `debug` |
| 22 | + |
8 | 23 | ```
|
| 24 | +Usage: live-tests debug [OPTIONS] COMMAND |
| 25 | +
|
| 26 | + Run a specific command on one or multiple connectors and persists the |
| 27 | + outputs to local storage. |
| 28 | +
|
| 29 | +Options: |
| 30 | + -c, --connector-image TEXT Docker image name of the connector to debug |
| 31 | + (e.g. `source-faker:latest`, `source- |
| 32 | + faker:dev`) [required] |
| 33 | + -o, --output-directory DIRECTORY |
| 34 | + Directory in which connector output and test |
| 35 | + results should be stored. |
| 36 | + Defaults to the current directory. |
| 37 | + --config-path FILE Path to the connector config. |
| 38 | + --catalog-path FILE Path to the connector catalog. |
| 39 | + --state-path FILE Path to the connector state. |
| 40 | + -hc, --http-cache Use the HTTP cache for the connector. |
| 41 | + --help Show this message and exit. |
| 42 | +``` |
| 43 | + |
| 44 | +This command is made to run any of the following connector commands against one or multiple connector images. |
| 45 | + |
| 46 | +**Available connector commands:** |
| 47 | +* `spec` |
| 48 | +* `check` |
| 49 | +* `discover` |
| 50 | +* `read` or `read_with_state` (requires a `--state-path` to be passed) |
| 51 | + |
| 52 | +It will write artifacts to an output directory: |
| 53 | +* `stdout.log`: The collected standard output following the command execution |
| 54 | +* `stderr.log`: The collected standard error following the c |
| 55 | +* `http_dump.txt`: An `mitmproxy` http stream log. Can be consumed with `mitmweb` (version `9.0.1`) for debugging. |
| 56 | + |
| 57 | +#### Example |
| 58 | +Let's run `debug` to check the output of `read` on two different versions of the same connector: |
| 59 | + |
| 60 | +```bash |
| 61 | +live-tests debug read \ |
| 62 | +--connector-image=airbyte/source-pokeapi:dev \ |
| 63 | +--connector-image=airbyte/source-pokeapi:latest \ |
| 64 | +--config-path=poke_config.json \ |
| 65 | +--catalog-path=configured_catalog.json |
| 66 | +``` |
| 67 | + |
| 68 | +It will store the results in a `live_test_debug_reports` directory under the current working directory: |
| 69 | + |
| 70 | +``` |
| 71 | +live_tests_debug_reports |
| 72 | +└── 1709547771 |
| 73 | + └── source-pokeapi |
| 74 | + └── read |
| 75 | + ├── dev |
| 76 | + │ ├── airbyte_messages |
| 77 | + │ │ ├── logs.jsonl |
| 78 | + │ │ ├── pokemon_records.jsonl |
| 79 | + │ │ └── traces.jsonl |
| 80 | + │ ├── http_dump.mitm |
| 81 | + │ ├── stderr.log |
| 82 | + │ └── stdout.log |
| 83 | + └── latest |
| 84 | + ├── airbyte_messages |
| 85 | + │ ├── logs.jsonl |
| 86 | + │ ├── pokemon_records.jsonl |
| 87 | + │ └── traces.jsonl |
| 88 | + ├── http_dump.mitm |
| 89 | + ├── stderr.log |
| 90 | + └── stdout.log |
| 91 | +
|
| 92 | +``` |
| 93 | + |
| 94 | +##### Consuming `http_dump.mitm` |
| 95 | +You can install [`mitmproxy`](https://mitmproxy.org/): |
| 96 | +```bash |
| 97 | +pipx install mitmproxy |
| 98 | +``` |
| 99 | + |
| 100 | +And run: |
| 101 | +```bash |
| 102 | +mitmweb --rfile=http_dump.mitm |
| 103 | +``` |
| 104 | + |
| 105 | +## Changelog |
| 106 | + |
| 107 | +### 0.1.0 |
| 108 | +Implement initial primitives and a `debug` command to run connector commands and persist the outputs to local storage. |
0 commit comments