airbyte-internal-ops 0.4.2__py3-none-any.whl → 0.5.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. {airbyte_internal_ops-0.4.2.dist-info → airbyte_internal_ops-0.5.1.dist-info}/METADATA +2 -1
  2. {airbyte_internal_ops-0.4.2.dist-info → airbyte_internal_ops-0.5.1.dist-info}/RECORD +21 -129
  3. airbyte_ops_mcp/cli/cloud.py +31 -2
  4. airbyte_ops_mcp/cloud_admin/api_client.py +506 -33
  5. airbyte_ops_mcp/cloud_admin/models.py +56 -0
  6. airbyte_ops_mcp/constants.py +58 -0
  7. airbyte_ops_mcp/{_legacy/airbyte_ci/metadata_service/docker_hub.py → docker_hub.py} +16 -10
  8. airbyte_ops_mcp/mcp/cloud_connector_versions.py +491 -10
  9. airbyte_ops_mcp/mcp/prerelease.py +5 -44
  10. airbyte_ops_mcp/mcp/prod_db_queries.py +128 -4
  11. airbyte_ops_mcp/mcp/regression_tests.py +10 -5
  12. airbyte_ops_mcp/{_legacy/airbyte_ci/metadata_service/validators/metadata_validator.py → metadata_validator.py} +18 -12
  13. airbyte_ops_mcp/prod_db_access/queries.py +51 -0
  14. airbyte_ops_mcp/prod_db_access/sql.py +76 -0
  15. airbyte_ops_mcp/regression_tests/ci_output.py +8 -4
  16. airbyte_ops_mcp/regression_tests/connection_fetcher.py +16 -5
  17. airbyte_ops_mcp/regression_tests/http_metrics.py +21 -2
  18. airbyte_ops_mcp/regression_tests/models.py +7 -1
  19. airbyte_ops_mcp/telemetry.py +162 -0
  20. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/.gitignore +0 -1
  21. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/README.md +0 -420
  22. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/__init__.py +0 -2
  23. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/__init__.py +0 -1
  24. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/backends/__init__.py +0 -8
  25. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/backends/base_backend.py +0 -16
  26. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/backends/duckdb_backend.py +0 -87
  27. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/backends/file_backend.py +0 -165
  28. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/connection_objects_retrieval.py +0 -377
  29. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/connector_runner.py +0 -247
  30. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/errors.py +0 -7
  31. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/evaluation_modes.py +0 -25
  32. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/hacks.py +0 -23
  33. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/json_schema_helper.py +0 -384
  34. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/mitm_addons.py +0 -37
  35. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/models.py +0 -595
  36. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/proxy.py +0 -207
  37. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/secret_access.py +0 -47
  38. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/segment_tracking.py +0 -45
  39. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/commons/utils.py +0 -214
  40. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/conftest.py.disabled +0 -751
  41. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/consts.py +0 -4
  42. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/poetry.lock +0 -4480
  43. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/pytest.ini +0 -9
  44. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/regression_tests/__init__.py +0 -1
  45. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/regression_tests/test_check.py +0 -61
  46. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/regression_tests/test_discover.py +0 -117
  47. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/regression_tests/test_read.py +0 -627
  48. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/regression_tests/test_spec.py +0 -43
  49. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/report.py +0 -542
  50. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/stash_keys.py +0 -38
  51. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/templates/__init__.py +0 -0
  52. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/templates/private_details.html.j2 +0 -305
  53. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/templates/report.html.j2 +0 -515
  54. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/utils.py +0 -187
  55. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/validation_tests/__init__.py +0 -0
  56. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/validation_tests/test_check.py +0 -61
  57. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/validation_tests/test_discover.py +0 -217
  58. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/validation_tests/test_read.py +0 -177
  59. airbyte_ops_mcp/_legacy/airbyte_ci/connector_live_tests/validation_tests/test_spec.py +0 -631
  60. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/README.md +0 -91
  61. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/bin/bundle-schemas.js +0 -48
  62. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/bin/generate-metadata-models.sh +0 -36
  63. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/ActorDefinitionResourceRequirements.py +0 -54
  64. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/AirbyteInternal.py +0 -22
  65. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/AllowedHosts.py +0 -18
  66. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/ConnectorBreakingChanges.py +0 -65
  67. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/ConnectorBuildOptions.py +0 -15
  68. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/ConnectorIPCOptions.py +0 -25
  69. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/ConnectorMetadataDefinitionV0.json +0 -897
  70. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/ConnectorMetadataDefinitionV0.py +0 -478
  71. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/ConnectorMetrics.py +0 -24
  72. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/ConnectorPackageInfo.py +0 -12
  73. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/ConnectorRegistryDestinationDefinition.py +0 -407
  74. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/ConnectorRegistryReleases.py +0 -406
  75. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/ConnectorRegistrySourceDefinition.py +0 -407
  76. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/ConnectorRegistryV0.py +0 -413
  77. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/ConnectorReleases.py +0 -98
  78. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/ConnectorTestSuiteOptions.py +0 -58
  79. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/GeneratedFields.py +0 -62
  80. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/GitInfo.py +0 -31
  81. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/JobType.py +0 -23
  82. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/NormalizationDestinationDefinitionConfig.py +0 -24
  83. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/RegistryOverrides.py +0 -111
  84. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/ReleaseStage.py +0 -15
  85. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/RemoteRegistries.py +0 -23
  86. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/ResourceRequirements.py +0 -18
  87. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/RolloutConfiguration.py +0 -29
  88. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/Secret.py +0 -34
  89. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/SecretStore.py +0 -22
  90. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/SourceFileInfo.py +0 -16
  91. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/SuggestedStreams.py +0 -18
  92. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/SupportLevel.py +0 -15
  93. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/TestConnections.py +0 -14
  94. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/__init__.py +0 -31
  95. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/generated/airbyte-connector-metadata-schema.json +0 -0
  96. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/ActorDefinitionResourceRequirements.yaml +0 -30
  97. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/AirbyteInternal.yaml +0 -32
  98. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/AllowedHosts.yaml +0 -13
  99. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/ConnectorBreakingChanges.yaml +0 -65
  100. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/ConnectorBuildOptions.yaml +0 -10
  101. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/ConnectorIPCOptions.yaml +0 -29
  102. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/ConnectorMetadataDefinitionV0.yaml +0 -172
  103. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/ConnectorMetrics.yaml +0 -30
  104. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/ConnectorPackageInfo.yaml +0 -9
  105. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/ConnectorRegistryDestinationDefinition.yaml +0 -90
  106. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/ConnectorRegistryReleases.yaml +0 -35
  107. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/ConnectorRegistrySourceDefinition.yaml +0 -92
  108. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/ConnectorRegistryV0.yaml +0 -18
  109. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/ConnectorReleases.yaml +0 -16
  110. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/ConnectorTestSuiteOptions.yaml +0 -28
  111. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/GeneratedFields.yaml +0 -16
  112. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/GitInfo.yaml +0 -21
  113. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/JobType.yaml +0 -14
  114. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/NormalizationDestinationDefinitionConfig.yaml +0 -21
  115. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/RegistryOverrides.yaml +0 -38
  116. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/ReleaseStage.yaml +0 -11
  117. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/RemoteRegistries.yaml +0 -25
  118. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/ResourceRequirements.yaml +0 -16
  119. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/RolloutConfiguration.yaml +0 -29
  120. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/Secret.yaml +0 -19
  121. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/SecretStore.yaml +0 -16
  122. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/SourceFileInfo.yaml +0 -17
  123. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/SuggestedStreams.yaml +0 -13
  124. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/SupportLevel.yaml +0 -10
  125. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/models/TestConnections.yaml +0 -17
  126. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/package-lock.json +0 -62
  127. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/package.json +0 -12
  128. airbyte_ops_mcp/_legacy/airbyte_ci/metadata_models/transform.py +0 -71
  129. {airbyte_internal_ops-0.4.2.dist-info → airbyte_internal_ops-0.5.1.dist-info}/WHEEL +0 -0
  130. {airbyte_internal_ops-0.4.2.dist-info → airbyte_internal_ops-0.5.1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,162 @@
1
+ # Copyright (c) 2025 Airbyte, Inc., all rights reserved.
2
+ """Telemetry module for tracking usage analytics.
3
+
4
+ This module provides utilities for tracking usage of various Airbyte operations
5
+ using Segment analytics. The tracking is optional and can be disabled via
6
+ environment variables.
7
+
8
+ Based on the legacy connector_live_tests/commons/segment_tracking.py implementation.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import logging
14
+ import os
15
+ from typing import Any
16
+
17
+ try:
18
+ from segment import analytics # type: ignore[import-untyped]
19
+
20
+ SEGMENT_AVAILABLE = True
21
+ except ImportError:
22
+ analytics = None # type: ignore[assignment]
23
+ SEGMENT_AVAILABLE = False
24
+
25
+ logger = logging.getLogger(__name__)
26
+
27
+ # Environment variable to disable tracking
28
+ DISABLE_TRACKING_ENV_VAR = "AIRBYTE_DISABLE_TELEMETRY"
29
+ # Legacy env var for backward compatibility
30
+ LEGACY_DISABLE_TRACKING_ENV_VAR = "REGRESSION_TEST_DISABLE_TRACKING"
31
+ # Environment variable to enable debug mode
32
+ DEBUG_SEGMENT_ENV_VAR = "DEBUG_SEGMENT"
33
+
34
+ # Segment write key environment variable name
35
+ # The write key can be provided via environment variable or uses the default
36
+ # public key for the Airbyte analytics project. Segment write keys are designed
37
+ # to be embedded in client-side code for analytics tracking.
38
+ SEGMENT_WRITE_KEY_ENV_VAR = "SEGMENT_WRITE_KEY"
39
+ _DEFAULT_SEGMENT_WRITE_KEY = "hnWfMdEtXNKBjvmJ258F72wShsLmcsZ8"
40
+
41
+
42
+ def _is_tracking_enabled() -> bool:
43
+ """Check if tracking is enabled based on environment variables."""
44
+ if os.getenv(DISABLE_TRACKING_ENV_VAR) is not None:
45
+ return False
46
+ return os.getenv(LEGACY_DISABLE_TRACKING_ENV_VAR) is None
47
+
48
+
49
+ def _on_error(error: Exception, items: Any) -> None:
50
+ """Handle Segment tracking errors."""
51
+ logger.warning("An error occurred in Segment Tracking", exc_info=error)
52
+
53
+
54
+ def _initialize_analytics() -> bool:
55
+ """Initialize Segment analytics if available and enabled.
56
+
57
+ Returns:
58
+ True if analytics was initialized successfully, False otherwise.
59
+ """
60
+ if not SEGMENT_AVAILABLE:
61
+ logger.debug("Segment analytics not available (package not installed)")
62
+ return False
63
+
64
+ if not _is_tracking_enabled():
65
+ logger.debug("Telemetry tracking is disabled via environment variable")
66
+ return False
67
+
68
+ # Use environment variable if set, otherwise use default public key
69
+ write_key = os.getenv(SEGMENT_WRITE_KEY_ENV_VAR, _DEFAULT_SEGMENT_WRITE_KEY)
70
+ analytics.write_key = write_key
71
+ analytics.send = True
72
+ analytics.debug = os.getenv(DEBUG_SEGMENT_ENV_VAR) is not None
73
+ analytics.on_error = _on_error
74
+ return True
75
+
76
+
77
+ def track_regression_test(
78
+ user_id: str | None,
79
+ connector_image: str,
80
+ command: str,
81
+ target_version: str,
82
+ control_version: str | None = None,
83
+ additional_properties: dict[str, Any] | None = None,
84
+ ) -> None:
85
+ """Track a regression test execution.
86
+
87
+ Args:
88
+ user_id: The user ID to associate with the event. If None, uses "airbyte-ci".
89
+ connector_image: The connector image being tested.
90
+ command: The Airbyte command being run (spec, check, discover, read).
91
+ target_version: The target connector version being tested.
92
+ control_version: The control connector version (for comparison mode).
93
+ additional_properties: Additional properties to include in the event.
94
+ """
95
+ if not _initialize_analytics():
96
+ return
97
+
98
+ if not user_id:
99
+ user_id = "airbyte-ci"
100
+
101
+ analytics.identify(user_id)
102
+
103
+ properties: dict[str, Any] = {
104
+ "connector_image": connector_image,
105
+ "command": command,
106
+ "target_version": target_version,
107
+ }
108
+
109
+ if control_version:
110
+ properties["control_version"] = control_version
111
+ properties["test_mode"] = "comparison"
112
+ else:
113
+ properties["test_mode"] = "single_version"
114
+
115
+ if additional_properties:
116
+ properties.update(additional_properties)
117
+
118
+ try:
119
+ from importlib.metadata import version
120
+
121
+ properties["package_version"] = version("airbyte-ops-mcp")
122
+ except Exception:
123
+ properties["package_version"] = "unknown"
124
+
125
+ analytics.track(user_id, "regression_test_start", properties)
126
+ logger.debug(f"Tracked regression_test_start event for user {user_id}")
127
+
128
+
129
+ def track_event(
130
+ user_id: str | None,
131
+ event_name: str,
132
+ properties: dict[str, Any] | None = None,
133
+ ) -> None:
134
+ """Track a generic event.
135
+
136
+ This is a general-purpose tracking function for events that don't fit
137
+ into the more specific tracking functions.
138
+
139
+ Args:
140
+ user_id: The user ID to associate with the event. If None, uses "airbyte-ci".
141
+ event_name: The name of the event to track.
142
+ properties: Properties to include in the event.
143
+ """
144
+ if not _initialize_analytics():
145
+ return
146
+
147
+ if not user_id:
148
+ user_id = "airbyte-ci"
149
+
150
+ analytics.identify(user_id)
151
+
152
+ event_properties = properties or {}
153
+
154
+ try:
155
+ from importlib.metadata import version
156
+
157
+ event_properties["package_version"] = version("airbyte-ops-mcp")
158
+ except Exception:
159
+ event_properties["package_version"] = "unknown"
160
+
161
+ analytics.track(user_id, event_name, event_properties)
162
+ logger.debug(f"Tracked {event_name} event for user {user_id}")
@@ -1 +0,0 @@
1
- regression_tests_artifacts
@@ -1,420 +0,0 @@
1
- # Connector Live Testing
2
-
3
- This project contains utilities for running connector tests against live data.
4
-
5
- ## Requirements
6
-
7
- - `docker`
8
- - `Python ^3.11`
9
- - `pipx`
10
- - `poetry`
11
-
12
- ## Install
13
-
14
- ```bash
15
- # From airbyte-ci/connectors/live-tests
16
- poetry install
17
- ```
18
-
19
- Note that `poetry lock` + `poetry install` didn't seem to have impact on the version of connection_retriever. In order to update this dependency to the latest, I had to `poetry add git+https://github.com/airbytehq/airbyte-platform-internal.git@master#subdirectory=tools/connection-retriever`.
20
-
21
- ## Regression tests
22
-
23
- We created a regression test suite to run tests to compare the outputs of connector commands on different versions of the same connector.
24
-
25
- ## Validation tests
26
-
27
- The validation test suite makes assertions about the output of airbyte commands for the target version of the connector only.
28
-
29
- ## Tutorial(s)
30
-
31
- - [Loom Walkthrough (Airbyte Only)](https://www.loom.com/share/97c49d7818664b119cff6911a8a211a2?sid=4570a5b6-9c81-4db3-ba33-c74dc5845c3c)
32
- - [Internal Docs (Airbyte Only)](https://docs.google.com/document/d/1pzTxJTsooc9iQDlALjvOWtnq6yRTvzVtbkJxY4R36_I/edit)
33
-
34
- ### How to Use
35
-
36
- > ⚠️ **Note:** While you can use this tool without building a dev image, to achieve your goals you will likely need to have installed [airbyte-ci](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md) and know how to build a dev image.
37
-
38
- You can run the existing test suites with the following command:
39
-
40
- #### With local connection objects (`config.json`, `catalog.json`, `state.json`)
41
-
42
- ```bash
43
- poetry run pytest src/live_tests \
44
- --connector-image=airbyte/source-faker \
45
- --config-path=<path-to-config-path> \
46
- --catalog-path=<path-to-catalog-path> \
47
- --target-version=dev \
48
- --pr-url=<PR-URL> # The URL of the PR you are testing
49
- ```
50
-
51
- #### Using a live connection
52
-
53
- The live connection objects will be fetched.
54
-
55
- ```bash
56
- poetry run pytest src/live_tests \
57
- --connector-image=airbyte/source-faker \
58
- --target-version=dev \
59
- --pr-url=<PR-URL> # The URL of the PR you are testing
60
- ```
61
-
62
- You can also pass local connection objects path to override the live connection objects with `--config-path`, `--state-path` or `--catalog-path`.
63
-
64
- #### Test artifacts
65
-
66
- The test suite run will produce test artifacts in the `/tmp/regression_tests_artifacts/` folder.
67
- **They will get cleared after each test run on prompt exit. Please do not copy them elsewhere in your filesystem as they contain sensitive data that are not meant to be stored outside of your debugging session!**
68
-
69
- ##### Artifacts types
70
-
71
- - `report.html`: A report of the test run.
72
- - `stdout.log`: The collected standard output following the command execution
73
- - `stderr.log`: The collected standard error following the command execution
74
- - `http_dump.mitm`: An `mitmproxy` http stream log. Can be consumed with `mitmweb` (version `>=10`) for debugging.
75
- - `http_dump.har`: An `mitmproxy` http stream log in HAR format (a JSON encoded version of the mitm dump).
76
- - `airbyte_messages`: A directory containing `.jsonl` files for each message type (logs, records, traces, controls, states etc.) produced by the connector.
77
- - `duck.db`: A DuckDB database containing the messages produced by the connector.
78
- - `dagger.log`: The log of the Dagger session, useful for debugging errors unrelated to the tests.
79
-
80
- **Tests can also write specific artifacts like diffs under a directory named after the test function.**
81
-
82
- ```
83
- /tmp/regression_tests_artifacts
84
- └── session_1710754231
85
- ├── duck.db
86
- |── report.html
87
- ├── command_execution_artifacts
88
- │   └── source-orb
89
- │   ├── check
90
- │   │   ├── dev
91
- │   │   │   ├── airbyte_messages
92
- │   │   │   │   ├── connection_status.jsonl
93
- │   │   │   │   └── logs.jsonl
94
- │   │   │   ├── http_dump.har
95
- │   │   │   ├── http_dump.mitm
96
- │   │   │   ├── stderr.log
97
- │   │   │   └── stdout.log
98
- │   │   └── latest
99
- │   │   ├── airbyte_messages
100
- │   │   │   ├── connection_status.jsonl
101
- │   │   │   └── logs.jsonl
102
- │   │   ├── http_dump.har
103
- │   │   ├── http_dump.mitm
104
- │   │   ├── stderr.log
105
- │   │   └── stdout.log
106
- │   ├── discover
107
- │   │   ├── dev
108
- │   │   │   ├── airbyte_messages
109
- │   │   │   │   └── catalog.jsonl
110
- │   │   │   ├── http_dump.har
111
- │   │   │   ├── http_dump.mitm
112
- │   │   │   ├── stderr.log
113
- │   │   │   └── stdout.log
114
- │   │   └── latest
115
- │   │   ├── airbyte_messages
116
- │   │   │   └── catalog.jsonl
117
- │   │   ├── http_dump.har
118
- │   │   ├── http_dump.mitm
119
- │   │   ├── stderr.log
120
- │   │   └── stdout.log
121
- │   ├── read-with-state
122
- │   │   ├── dev
123
- │   │   │   ├── airbyte_messages
124
- │   │   │   │   ├── logs.jsonl
125
- │   │   │   │   ├── records.jsonl
126
- │   │   │   │   ├── states.jsonl
127
- │   │   │   │   └── traces.jsonl
128
- │   │   │   ├── http_dump.har
129
- │   │   │   ├── http_dump.mitm
130
- │   │   │   ├── stderr.log
131
- │   │   │   └── stdout.log
132
- │   │   └── latest
133
- │   │   ├── airbyte_messages
134
- │   │   │   ├── logs.jsonl
135
- │   │   │   ├── records.jsonl
136
- │   │   │   ├── states.jsonl
137
- │   │   │   └── traces.jsonl
138
- │   │   ├── http_dump.har
139
- │   │   ├── http_dump.mitm
140
- │   │   ├── stderr.log
141
- │   │   └── stdout.log
142
- │   └── spec
143
- │   ├── dev
144
- │   │   ├── airbyte_messages
145
- │   │   │   └── spec.jsonl
146
- │   │   ├── stderr.log
147
- │   │   └── stdout.log
148
- │   └── latest
149
- │   ├── airbyte_messages
150
- │   │   └── spec.jsonl
151
- │   ├── stderr.log
152
- │   └── stdout.log
153
- └── dagger.log
154
- ```
155
-
156
- #### HTTP Proxy and caching
157
-
158
- We use a containerized `mitmproxy` to capture the HTTP traffic between the connector and the source. Connector command runs produce `http_dump.mitm` (can be consumed with `mitmproxy` (version `>=10`) for debugging) and `http_dump.har` (a JSON encoded version of the mitm dump) artifacts.
159
- The traffic recorded on the control connector is passed to the target connector proxy to cache the responses for requests with the same URL. This is useful to avoid hitting the source API multiple times when running the same command on different versions of the connector.
160
-
161
- ### Custom CLI Arguments
162
-
163
- | Argument | Description | Required/Optional |
164
- |----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------| ----------------- |
165
- | `--connector-image` | Docker image name of the connector to debug (e.g., `airbyte/source-faker`, `airbyte/source-faker`). | Required |
166
- | `--control-version` | Version of the control connector for regression testing. Must be an unambiguous connector version (e.g. 1.2.3 rather than `latest`) | Required |
167
- | `--target-version` | Version of the connector being tested. (Defaults to dev) | Optional |
168
- | `--pr-url` | URL of the pull request being tested. | Required |
169
- | `--connection-id` | ID of the connection for live testing. If not provided, a prompt will appear to choose. | Optional |
170
- | `--config-path` | Path to the custom source configuration file. | Optional |
171
- | `--catalog-path` | Path to the custom configured catalog file. | Optional |
172
- | `--state-path` | Path to the custom state file. | Optional |
173
- | `--http-cache` | Use the HTTP cache for the connector. | Optional |
174
- | `--run-id` | Unique identifier for the test run. If not provided, a timestamp will be used. | Optional |
175
- | `--auto-select-connection` | Automatically select a connection for testing. | Optional |
176
- | `--stream` | Name of the stream to test. Can be specified multiple times to test multiple streams. | Optional |
177
- | `--should-read-with-state` | Specify whether to read with state. If not provided, a prompt will appear to choose. | Optional |
178
- | `--disable-proxy` | Specify whether to disable proxy. If not provided, a proxy will be enabled. | Optional |
179
- | `--test-evaluation-mode` | Whether to run tests in "diagnostic" mode or "strict" mode. In diagnostic mode, eligible tests will always pass unless there's an exception. | Optional |
180
- | `--connection-subset` | The subset of connections to select from. Possible values are "sandboxes" or "all" (defaults to sandboxes). | Optional |
181
-
182
- ## Changelog
183
-
184
-
185
- ### 0.21.4
186
- Update connection id to use first 8 chars in the report
187
-
188
- ### 0.21.3
189
- Update dependencies to avoid genson issue
190
-
191
- ### 0.21.2
192
- Fix selected streams filter in regression tests
193
-
194
- ### 0.21.1
195
- Update Python version requirement from 3.10 to 3.11.
196
-
197
- ### 0.21.0
198
- Add `disable_proxy` flag
199
-
200
-
201
- ### 0.20.0
202
- Support multiple connection objects in the regression tests suite.
203
-
204
-
205
- ### 0.19.10
206
- Pin the connection retriever until we make required changes to support the new version.
207
-
208
-
209
- ### 0.19.8
210
-
211
- Give ownership of copied connection object files to the image user to make sure it has permission to write them (config migration).
212
-
213
- ### 0.19.7
214
-
215
- Mount connection objects to readable paths in the container for rootless images.
216
-
217
- ### 0.19.6
218
-
219
- Write connector output to a different in container path to avoid permission issues now that connector images are rootless.
220
-
221
- ### 0.19.5
222
-
223
- Fix `ZeroDivisionError` in Regression test tool
224
-
225
- ### 0.19.4
226
-
227
- Update `connection_retriever` to 0.7.4
228
-
229
- ### 0.19.3
230
-
231
- Update `get_container_from_id` with the correct new Dagger API.
232
-
233
- ### 0.19.2
234
-
235
- Update Dagger to 0.13.3
236
-
237
- ### 0.19.1
238
-
239
- Fixed the `UserDict` type annotation not found bug.
240
-
241
- ### 0.19.0
242
-
243
- Delete the `debug`command.
244
-
245
- ### 0.18.8
246
-
247
- Improve error message when failing to retrieve connection.
248
- Ask to double-check that a sync ran with the control version on the selected connection.
249
-
250
- ### 0.18.7
251
-
252
- Improve error message when failing to retrieve connection.
253
-
254
- ### 0.18.6
255
-
256
- Disable the `SortQueryParams` MITM proxy addon to avoid double URL encoding.
257
-
258
- ### 0.18.5
259
-
260
- Relax test_oneof_usage criteria for constant value definitions in connector SPEC output.
261
-
262
- ### 0.18.4
263
-
264
- Bugfix: Use connection-retriever 0.7.2
265
-
266
- ### 0.18.3
267
-
268
- Updated dependencies.
269
-
270
- ### 0.18.2
271
-
272
- Allow live tests with or without state in CI.
273
-
274
- ### 0.18.1
275
-
276
- Fix extra argument.
277
-
278
- ### 0.18.0
279
-
280
- Add support for selecting from a subset of connections.
281
-
282
- ### 0.17.8
283
-
284
- Fix the self-signed certificate path we bind to Python connectors.
285
-
286
- ### 0.17.7
287
-
288
- Explicitly pass the control version to the connection retriever. Defaults to the latest released version of the connector under test.
289
-
290
- ### 0.17.6
291
-
292
- Display diagnostic test with warning.
293
-
294
- ### 0.17.5
295
-
296
- Performance improvements using caching.
297
-
298
- ### 0.17.4
299
-
300
- Fix control image when running tests in CI.
301
-
302
- ### 0.17.3
303
-
304
- Pin requests dependency.
305
-
306
- ### 0.17.2
307
-
308
- Fix duckdb dependency.
309
-
310
- ### 0.17.1
311
-
312
- Bump the connection-retriever version to fix deprecated query.
313
-
314
- ### 0.17.0
315
-
316
- Enable running in GitHub actions.
317
-
318
- ### 0.16.0
319
-
320
- Enable running with airbyte-ci.
321
-
322
- ### 0.15.0
323
-
324
- Automatic retrieval of connection objects for regression tests. The connection id is not required anymore.
325
-
326
- ### 0.14.2
327
-
328
- Fix KeyError when target & control streams differ.
329
-
330
- ### 0.14.1
331
-
332
- Improve performance when reading records per stream.
333
-
334
- ### 0.14.0
335
-
336
- Track usage via Segment.
337
-
338
- ### 0.13.0
339
-
340
- Show test docstring in the test report.
341
-
342
- ### 0.12.0
343
-
344
- Implement a test to compare schema inferred on both control and target version.
345
-
346
- ### 0.11.0
347
-
348
- Create a global duckdb instance to store messages produced by the connector in target and control version.
349
-
350
- ### 0.10.0
351
-
352
- Show record count per stream in report and list untested streams.
353
-
354
- ### 0.9.0
355
-
356
- Make the regressions tests suite better at handling large connector outputs.
357
-
358
- ### 0.8.1
359
-
360
- Improve diff output.
361
-
362
- ### 0.8.0
363
-
364
- Regression tests: add an HTML report.
365
-
366
- ### 0.7.0
367
-
368
- Improve the proxy workflow and caching logic + generate HAR files.
369
-
370
- ### 0.6.6
371
-
372
- Exit pytest if connection can't be retrieved.
373
-
374
- ### 0.6.6
375
-
376
- Cleanup debug files when prompt is closed.
377
-
378
- ### 0.6.5
379
-
380
- Improve ConnectorRunner logging.
381
-
382
- ### 0.6.4
383
-
384
- Add more data integrity checks to the regression tests suite.
385
-
386
- ### 0.6.3
387
-
388
- Make catalog diffs more readable.
389
-
390
- ### 0.6.2
391
-
392
- Clean up regression test artifacts on any exception.
393
-
394
- ### 0.6.1
395
-
396
- Modify diff output for `discover` and `read` tests.
397
-
398
- ### 0.5.1
399
-
400
- Handle connector command execution errors.
401
-
402
- ### 0.5.0
403
-
404
- Add new tests and confirmation prompts.
405
-
406
- ### 0.4.0
407
-
408
- Introduce DuckDB to store the messages produced by the connector.
409
-
410
- ### 0.3.0
411
-
412
- Pass connection id to the regression tests suite.
413
-
414
- ### 0.2.0
415
-
416
- Declare the regression tests suite.
417
-
418
- ### 0.1.0
419
-
420
- Implement initial primitives and a `debug` command to run connector commands and persist the outputs to local storage.
@@ -1,2 +0,0 @@
1
- # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
2
-
@@ -1 +0,0 @@
1
- # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
@@ -1,8 +0,0 @@
1
- # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
2
- from __future__ import annotations
3
-
4
- from .base_backend import BaseBackend
5
- from .duckdb_backend import DuckDbBackend
6
- from .file_backend import FileBackend
7
-
8
- __all__ = ["BaseBackend", "DuckDbBackend", "FileBackend"]
@@ -1,16 +0,0 @@
1
- # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
2
- from __future__ import annotations
3
-
4
- from abc import ABC, abstractmethod
5
- from collections.abc import Iterable
6
-
7
- from airbyte_protocol.models import AirbyteMessage # type: ignore
8
-
9
-
10
- class BaseBackend(ABC):
11
- """
12
- Interface to be shared between the file backend and the database backend(s)
13
- """
14
-
15
- @abstractmethod
16
- def write(self, airbyte_messages: Iterable[AirbyteMessage]) -> None: ...