Skip to content

Commit c6c225b

Browse files
feat(metadata-service): Add schema support for smoke test scenarios
Add JSON schema definitions to support the new smoke tests configuration format introduced in airbytehq/airbyte-python-cdk#775. Changes: - Created SmokeTestScenario.yaml schema defining the structure for individual smoke test scenarios with properties: name, config_file, config_settings, expect_failure, only_streams, exclude_streams, suggested_streams_only, and configured_catalog_path - Updated ConnectorTestSuiteOptions.yaml to add 'smokeTests' to the suite enum and added 'scenarios' property to support the new smoke test format - Regenerated Python models and bundled JSON schema This enables connectors to define smoke tests in their metadata.yaml file under data.connectorTestSuitesOptions with the following structure: connectorTestSuitesOptions: - suite: smokeTests scenarios: - name: default config_file: secrets/config_oauth.json config_settings: start_date: "2025-01-01T00:00:00Z" only_streams: - users Related: airbytehq/airbyte-python-cdk#775 Co-Authored-By: AJ Steers <aj@airbyte.io>
1 parent a9afe95 commit c6c225b

14 files changed

+289
-95
lines changed

airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ConnectorBreakingChanges.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from __future__ import annotations
55

66
from datetime import date
7-
from typing import Any, Dict, List, Optional
7+
from typing import Dict, List, Optional
88

99
from pydantic import AnyUrl, BaseModel, Extra, Field, constr
1010
from typing_extensions import Literal
@@ -14,7 +14,7 @@ class StreamBreakingChangeScope(BaseModel):
1414
class Config:
1515
extra = Extra.forbid
1616

17-
scopeType: Any = Field("stream", const=True)
17+
scopeType: str = Field("stream", const=True)
1818
impactedScopes: List[str] = Field(
1919
...,
2020
description="List of streams that are impacted by the breaking change.",
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# generated by datamodel-codegen:
2+
# filename: ConnectorIPCOptions.yaml
3+
4+
from __future__ import annotations
5+
6+
from typing import List
7+
8+
from pydantic import BaseModel, Extra
9+
from typing_extensions import Literal
10+
11+
12+
class DataChannel(BaseModel):
13+
class Config:
14+
extra = Extra.forbid
15+
16+
version: str
17+
supportedSerialization: List[Literal["JSONL", "PROTOBUF", "FLATBUFFERS"]]
18+
supportedTransport: List[Literal["STDIO", "SOCKET"]]
19+
20+
21+
class ConnectorIPCOptions(BaseModel):
22+
class Config:
23+
extra = Extra.forbid
24+
25+
dataChannel: DataChannel

airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ConnectorMetadataDefinitionV0.json

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,16 @@
7272
"unitTests",
7373
"integrationTests",
7474
"acceptanceTests",
75-
"liveTests"
75+
"liveTests",
76+
"smokeTests"
7677
]
7778
},
7879
"testSecrets": {
7980
"description": "List of secrets required to run the test suite",
8081
"type": "array",
8182
"items": {
8283
"$schema": "http://json-schema.org/draft-07/schema#",
83-
"$id": "https://github.com/airbytehq/airbyte/airbyte-ci/connectors/metadata_service/lib/metadata_service/models/src/TestSecret.yaml",
84+
"$id": "https://github.com/airbytehq/airbyte/airbyte-ci/connectors/metadata_service/lib/metadata_service/models/src/Secret.yaml",
8485
"title": "Secret",
8586
"description": "An object describing a secret's metadata",
8687
"type": "object",
@@ -100,14 +101,10 @@
100101
},
101102
"secretStore": {
102103
"$schema": "http://json-schema.org/draft-07/schema#",
103-
"$id": "https://github.com/airbytehq/airbyte/airbyte-ci/connectors/metadata_service/lib/metadata_service/models/src/TestSecret.yaml",
104+
"$id": "https://github.com/airbytehq/airbyte/airbyte-ci/connectors/metadata_service/lib/metadata_service/models/src/SecretStore.yaml",
104105
"title": "SecretStore",
105106
"description": "An object describing a secret store metadata",
106107
"type": "object",
107-
"required": [
108-
"name",
109-
"secretStore"
110-
],
111108
"additionalProperties": false,
112109
"properties": {
113110
"alias": {
@@ -151,6 +148,64 @@
151148
}
152149
}
153150
}
151+
},
152+
"scenarios": {
153+
"description": "List of smoke test scenarios (only applicable when suite is 'smokeTests')",
154+
"type": "array",
155+
"items": {
156+
"$schema": "http://json-schema.org/draft-07/schema#",
157+
"$id": "https://github.com/airbytehq/airbyte/airbyte-ci/connectors/metadata_service/lib/metadata_service/models/src/SmokeTestScenario.yaml",
158+
"title": "SmokeTestScenario",
159+
"description": "A single smoke test scenario configuration for a connector.",
160+
"type": "object",
161+
"required": [
162+
"name"
163+
],
164+
"additionalProperties": false,
165+
"properties": {
166+
"name": {
167+
"description": "Name of the test scenario (e.g., 'default', 'invalid_config', 'oauth_config')",
168+
"type": "string"
169+
},
170+
"config_file": {
171+
"description": "Relative path to the config file to use for this scenario",
172+
"type": "string"
173+
},
174+
"config_settings": {
175+
"description": "Optional dictionary of config settings to override or supplement config_file settings",
176+
"type": "object",
177+
"additionalProperties": true
178+
},
179+
"expect_failure": {
180+
"description": "Whether the scenario is expected to fail",
181+
"type": "boolean",
182+
"default": false
183+
},
184+
"only_streams": {
185+
"description": "List of stream names to include in the scenario (if specified, only these streams will be tested)",
186+
"type": "array",
187+
"items": {
188+
"type": "string"
189+
}
190+
},
191+
"exclude_streams": {
192+
"description": "List of stream names to exclude from the scenario",
193+
"type": "array",
194+
"items": {
195+
"type": "string"
196+
}
197+
},
198+
"suggested_streams_only": {
199+
"description": "Whether to limit testing to the connector's suggested streams list (from data.suggestedStreams)",
200+
"type": "boolean",
201+
"default": false
202+
},
203+
"configured_catalog_path": {
204+
"description": "Path to a pre-configured catalog file for the scenario",
205+
"type": "string"
206+
}
207+
}
208+
}
154209
}
155210
}
156211
}
@@ -456,7 +511,7 @@
456511
],
457512
"properties": {
458513
"scopeType": {
459-
"type": "const",
514+
"type": "string",
460515
"const": "stream"
461516
},
462517
"impactedScopes": {

airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ConnectorMetadataDefinitionV0.py

Lines changed: 59 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,40 @@ class Config:
3939
id: str = Field(..., description="The connection ID")
4040

4141

42+
class SmokeTestScenario(BaseModel):
43+
class Config:
44+
extra = Extra.forbid
45+
46+
name: str = Field(
47+
...,
48+
description="Name of the test scenario (e.g., 'default', 'invalid_config', 'oauth_config')",
49+
)
50+
config_file: Optional[str] = Field(
51+
None, description="Relative path to the config file to use for this scenario"
52+
)
53+
config_settings: Optional[Dict[str, Any]] = Field(
54+
None,
55+
description="Optional dictionary of config settings to override or supplement config_file settings",
56+
)
57+
expect_failure: Optional[bool] = Field(
58+
False, description="Whether the scenario is expected to fail"
59+
)
60+
only_streams: Optional[List[str]] = Field(
61+
None,
62+
description="List of stream names to include in the scenario (if specified, only these streams will be tested)",
63+
)
64+
exclude_streams: Optional[List[str]] = Field(
65+
None, description="List of stream names to exclude from the scenario"
66+
)
67+
suggested_streams_only: Optional[bool] = Field(
68+
False,
69+
description="Whether to limit testing to the connector's suggested streams list (from data.suggestedStreams)",
70+
)
71+
configured_catalog_path: Optional[str] = Field(
72+
None, description="Path to a pre-configured catalog file for the scenario"
73+
)
74+
75+
4276
class ReleaseStage(BaseModel):
4377
__root__: Literal["alpha", "beta", "generally_available", "custom"] = Field(
4478
...,
@@ -144,7 +178,7 @@ class StreamBreakingChangeScope(BaseModel):
144178
class Config:
145179
extra = Extra.forbid
146180

147-
scopeType: Any = Field("stream", const=True)
181+
scopeType: str = Field("stream", const=True)
148182
impactedScopes: List[str] = Field(
149183
...,
150184
description="List of streams that are impacted by the breaking change.",
@@ -165,16 +199,6 @@ class Config:
165199
)
166200

167201

168-
class ConnectorIPCDataChannel(BaseModel):
169-
version: str = Field(..., description="Version of the data channel specification")
170-
supportedSerialization: List[Literal["JSONL", "PROTOBUF", "FLATBUFFERS"]]
171-
supportedTransport: List[Literal["STDIO", "SOCKET"]]
172-
173-
174-
class ConnectorIPCOptions(BaseModel):
175-
dataChannel: ConnectorIPCDataChannel
176-
177-
178202
class PyPi(BaseModel):
179203
class Config:
180204
extra = Extra.forbid
@@ -228,6 +252,22 @@ class Config:
228252
connector_version: Optional[str] = None
229253

230254

255+
class DataChannel(BaseModel):
256+
class Config:
257+
extra = Extra.forbid
258+
259+
version: str
260+
supportedSerialization: List[Literal["JSONL", "PROTOBUF", "FLATBUFFERS"]]
261+
supportedTransport: List[Literal["STDIO", "SOCKET"]]
262+
263+
264+
class ConnectorIPCOptions(BaseModel):
265+
class Config:
266+
extra = Extra.forbid
267+
268+
dataChannel: DataChannel
269+
270+
231271
class Secret(BaseModel):
232272
class Config:
233273
extra = Extra.forbid
@@ -273,16 +313,20 @@ class ConnectorTestSuiteOptions(BaseModel):
273313
class Config:
274314
extra = Extra.forbid
275315

276-
suite: Literal["unitTests", "integrationTests", "acceptanceTests", "liveTests"] = (
277-
Field(..., description="Name of the configured test suite")
278-
)
316+
suite: Literal[
317+
"unitTests", "integrationTests", "acceptanceTests", "liveTests", "smokeTests"
318+
] = Field(..., description="Name of the configured test suite")
279319
testSecrets: Optional[List[Secret]] = Field(
280320
None, description="List of secrets required to run the test suite"
281321
)
282322
testConnections: Optional[List[TestConnections]] = Field(
283323
None,
284324
description="List of sandbox cloud connections that tests can be run against",
285325
)
326+
scenarios: Optional[List[SmokeTestScenario]] = Field(
327+
None,
328+
description="List of smoke test scenarios (only applicable when suite is 'smokeTests')",
329+
)
286330

287331

288332
class ActorDefinitionResourceRequirements(BaseModel):
@@ -430,10 +474,7 @@ class Config:
430474
generated: Optional[GeneratedFields] = None
431475
supportsFileTransfer: Optional[bool] = False
432476
supportsDataActivation: Optional[bool] = False
433-
connectorIPCOptions: Optional[ConnectorIPCOptions] = Field(
434-
None,
435-
description="Advanced options related to connector's inter-process communication"
436-
)
477+
connectorIPCOptions: Optional[ConnectorIPCOptions] = None
437478

438479

439480
class ConnectorMetadataDefinitionV0(BaseModel):

airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ConnectorRegistryDestinationDefinition.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class StreamBreakingChangeScope(BaseModel):
106106
class Config:
107107
extra = Extra.forbid
108108

109-
scopeType: Any = Field("stream", const=True)
109+
scopeType: str = Field("stream", const=True)
110110
impactedScopes: List[str] = Field(
111111
...,
112112
description="List of streams that are impacted by the breaking change.",
@@ -137,16 +137,6 @@ class Config:
137137
)
138138

139139

140-
class ConnectorIPCDataChannel(BaseModel):
141-
version: str = Field(..., description="Version of the data channel specification")
142-
supportedSerialization: List[Literal["JSONL", "PROTOBUF", "FLATBUFFERS"]]
143-
supportedTransport: List[Literal["STDIO", "SOCKET"]]
144-
145-
146-
class ConnectorIPCOptions(BaseModel):
147-
dataChannel: ConnectorIPCDataChannel
148-
149-
150140
class GitInfo(BaseModel):
151141
class Config:
152142
extra = Extra.forbid
@@ -313,10 +303,6 @@ class Config:
313303
supportsRefreshes: Optional[bool] = False
314304
supportsFileTransfer: Optional[bool] = False
315305
supportsDataActivation: Optional[bool] = False
316-
connectorIPCOptions: Optional[ConnectorIPCOptions] = Field(
317-
None,
318-
description="Advanced options related to connector's inter-process communication"
319-
)
320306
generated: Optional[GeneratedFields] = None
321307
packageInfo: Optional[ConnectorPackageInfo] = None
322308
language: Optional[str] = Field(

airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ConnectorRegistryReleases.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class StreamBreakingChangeScope(BaseModel):
3636
class Config:
3737
extra = Extra.forbid
3838

39-
scopeType: Any = Field("stream", const=True)
39+
scopeType: str = Field("stream", const=True)
4040
impactedScopes: List[str] = Field(
4141
...,
4242
description="List of streams that are impacted by the breaking change.",
@@ -60,16 +60,6 @@ class SupportLevel(BaseModel):
6060
)
6161

6262

63-
class ConnectorIPCDataChannel(BaseModel):
64-
version: str = Field(..., description="Version of the data channel specification")
65-
supportedSerialization: List[Literal["JSONL", "PROTOBUF", "FLATBUFFERS"]]
66-
supportedTransport: List[Literal["STDIO", "SOCKET"]]
67-
68-
69-
class ConnectorIPCOptions(BaseModel):
70-
dataChannel: ConnectorIPCDataChannel
71-
72-
7363
class ResourceRequirements(BaseModel):
7464
class Config:
7565
extra = Extra.forbid
@@ -404,10 +394,6 @@ class Config:
404394
supportsRefreshes: Optional[bool] = False
405395
supportsFileTransfer: Optional[bool] = False
406396
supportsDataActivation: Optional[bool] = False
407-
connectorIPCOptions: Optional[ConnectorIPCOptions] = Field(
408-
None,
409-
description="Advanced options related to connector's inter-process communication"
410-
)
411397
generated: Optional[GeneratedFields] = None
412398
packageInfo: Optional[ConnectorPackageInfo] = None
413399
language: Optional[str] = Field(

airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ConnectorRegistrySourceDefinition.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class StreamBreakingChangeScope(BaseModel):
9898
class Config:
9999
extra = Extra.forbid
100100

101-
scopeType: Any = Field("stream", const=True)
101+
scopeType: str = Field("stream", const=True)
102102
impactedScopes: List[str] = Field(
103103
...,
104104
description="List of streams that are impacted by the breaking change.",
@@ -137,16 +137,6 @@ class Config:
137137
)
138138

139139

140-
class ConnectorIPCDataChannel(BaseModel):
141-
version: str = Field(..., description="Version of the data channel specification")
142-
supportedSerialization: List[Literal["JSONL", "PROTOBUF", "FLATBUFFERS"]]
143-
supportedTransport: List[Literal["STDIO", "SOCKET"]]
144-
145-
146-
class ConnectorIPCOptions(BaseModel):
147-
dataChannel: ConnectorIPCDataChannel
148-
149-
150140
class GitInfo(BaseModel):
151141
class Config:
152142
extra = Extra.forbid
@@ -404,10 +394,6 @@ class Config:
404394
supportsRefreshes: Optional[bool] = False
405395
supportsFileTransfer: Optional[bool] = False
406396
supportsDataActivation: Optional[bool] = False
407-
connectorIPCOptions: Optional[ConnectorIPCOptions] = Field(
408-
None,
409-
description="Advanced options related to connector's inter-process communication"
410-
)
411397
generated: Optional[GeneratedFields] = None
412398
packageInfo: Optional[ConnectorPackageInfo] = None
413399
language: Optional[str] = Field(

0 commit comments

Comments
 (0)