Skip to content

Commit af7ab8f

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 16d7a39 commit af7ab8f

File tree

7 files changed

+233
-8
lines changed

7 files changed

+233
-8
lines changed

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

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
"unitTests",
7373
"integrationTests",
7474
"acceptanceTests",
75-
"liveTests"
75+
"liveTests",
76+
"smokeTests"
7677
]
7778
},
7879
"testSecrets": {
@@ -147,6 +148,64 @@
147148
}
148149
}
149150
}
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+
}
150209
}
151210
}
152211
}

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

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

4040

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

281-
suite: Literal["unitTests", "integrationTests", "acceptanceTests", "liveTests"] = (
282-
Field(..., description="Name of the configured test suite")
283-
)
315+
suite: Literal[
316+
"unitTests", "integrationTests", "acceptanceTests", "liveTests", "smokeTests"
317+
] = Field(..., description="Name of the configured test suite")
284318
testSecrets: Optional[List[Secret]] = Field(
285319
None, description="List of secrets required to run the test suite"
286320
)
287321
testConnections: Optional[List[TestConnections]] = Field(
288322
None,
289323
description="List of sandbox cloud connections that tests can be run against",
290324
)
325+
scenarios: Optional[List[SmokeTestScenario]] = Field(
326+
None,
327+
description="List of smoke test scenarios (only applicable when suite is 'smokeTests')",
328+
)
291329

292330

293331
class ActorDefinitionResourceRequirements(BaseModel):

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

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from __future__ import annotations
55

6-
from typing import List, Literal, Optional
6+
from typing import Any, Dict, List, Literal, Optional
77

88
from pydantic import BaseModel, Extra, Field
99

@@ -29,6 +29,40 @@ class Config:
2929
id: str = Field(..., description="The connection ID")
3030

3131

32+
class SmokeTestScenario(BaseModel):
33+
class Config:
34+
extra = Extra.forbid
35+
36+
name: str = Field(
37+
...,
38+
description="Name of the test scenario (e.g., 'default', 'invalid_config', 'oauth_config')",
39+
)
40+
config_file: Optional[str] = Field(
41+
None, description="Relative path to the config file to use for this scenario"
42+
)
43+
config_settings: Optional[Dict[str, Any]] = Field(
44+
None,
45+
description="Optional dictionary of config settings to override or supplement config_file settings",
46+
)
47+
expect_failure: Optional[bool] = Field(
48+
False, description="Whether the scenario is expected to fail"
49+
)
50+
only_streams: Optional[List[str]] = Field(
51+
None,
52+
description="List of stream names to include in the scenario (if specified, only these streams will be tested)",
53+
)
54+
exclude_streams: Optional[List[str]] = Field(
55+
None, description="List of stream names to exclude from the scenario"
56+
)
57+
suggested_streams_only: Optional[bool] = Field(
58+
False,
59+
description="Whether to limit testing to the connector's suggested streams list (from data.suggestedStreams)",
60+
)
61+
configured_catalog_path: Optional[str] = Field(
62+
None, description="Path to a pre-configured catalog file for the scenario"
63+
)
64+
65+
3266
class Secret(BaseModel):
3367
class Config:
3468
extra = Extra.forbid
@@ -45,13 +79,17 @@ class ConnectorTestSuiteOptions(BaseModel):
4579
class Config:
4680
extra = Extra.forbid
4781

48-
suite: Literal["unitTests", "integrationTests", "acceptanceTests", "liveTests"] = (
49-
Field(..., description="Name of the configured test suite")
50-
)
82+
suite: Literal[
83+
"unitTests", "integrationTests", "acceptanceTests", "liveTests", "smokeTests"
84+
] = Field(..., description="Name of the configured test suite")
5185
testSecrets: Optional[List[Secret]] = Field(
5286
None, description="List of secrets required to run the test suite"
5387
)
5488
testConnections: Optional[List[TestConnections]] = Field(
5589
None,
5690
description="List of sandbox cloud connections that tests can be run against",
5791
)
92+
scenarios: Optional[List[SmokeTestScenario]] = Field(
93+
None,
94+
description="List of smoke test scenarios (only applicable when suite is 'smokeTests')",
95+
)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# generated by datamodel-codegen:
2+
# filename: SmokeTestScenario.yaml
3+
4+
from __future__ import annotations
5+
6+
from typing import Any, Dict, List, Optional
7+
8+
from pydantic import BaseModel, Extra, Field
9+
10+
11+
class SmokeTestScenario(BaseModel):
12+
class Config:
13+
extra = Extra.forbid
14+
15+
name: str = Field(
16+
...,
17+
description="Name of the test scenario (e.g., 'default', 'invalid_config', 'oauth_config')",
18+
)
19+
config_file: Optional[str] = Field(
20+
None, description="Relative path to the config file to use for this scenario"
21+
)
22+
config_settings: Optional[Dict[str, Any]] = Field(
23+
None,
24+
description="Optional dictionary of config settings to override or supplement config_file settings",
25+
)
26+
expect_failure: Optional[bool] = Field(
27+
False, description="Whether the scenario is expected to fail"
28+
)
29+
only_streams: Optional[List[str]] = Field(
30+
None,
31+
description="List of stream names to include in the scenario (if specified, only these streams will be tested)",
32+
)
33+
exclude_streams: Optional[List[str]] = Field(
34+
None, description="List of stream names to exclude from the scenario"
35+
)
36+
suggested_streams_only: Optional[bool] = Field(
37+
False,
38+
description="Whether to limit testing to the connector's suggested streams list (from data.suggestedStreams)",
39+
)
40+
configured_catalog_path: Optional[str] = Field(
41+
None, description="Path to a pre-configured catalog file for the scenario"
42+
)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from .RolloutConfiguration import *
2626
from .Secret import *
2727
from .SecretStore import *
28+
from .SmokeTestScenario import *
2829
from .SourceFileInfo import *
2930
from .SuggestedStreams import *
3031
from .SupportLevel import *

airbyte-ci/connectors/metadata_service/lib/metadata_service/models/src/ConnectorTestSuiteOptions.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ properties:
1616
- "integrationTests"
1717
- "acceptanceTests"
1818
- "liveTests"
19+
- "smokeTests"
1920
testSecrets:
2021
description: "List of secrets required to run the test suite"
2122
type: array
@@ -26,3 +27,8 @@ properties:
2627
type: array
2728
items:
2829
"$ref": "TestConnections.yaml"
30+
scenarios:
31+
description: "List of smoke test scenarios (only applicable when suite is 'smokeTests')"
32+
type: array
33+
items:
34+
"$ref": "SmokeTestScenario.yaml"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
"$schema": http://json-schema.org/draft-07/schema#
3+
"$id": https://github.com/airbytehq/airbyte/airbyte-ci/connectors/metadata_service/lib/metadata_service/models/src/SmokeTestScenario.yaml
4+
title: SmokeTestScenario
5+
description: A single smoke test scenario configuration for a connector.
6+
type: object
7+
required:
8+
- name
9+
additionalProperties: false
10+
properties:
11+
name:
12+
description: "Name of the test scenario (e.g., 'default', 'invalid_config', 'oauth_config')"
13+
type: string
14+
config_file:
15+
description: "Relative path to the config file to use for this scenario"
16+
type: string
17+
config_settings:
18+
description: "Optional dictionary of config settings to override or supplement config_file settings"
19+
type: object
20+
additionalProperties: true
21+
expect_failure:
22+
description: "Whether the scenario is expected to fail"
23+
type: boolean
24+
default: false
25+
only_streams:
26+
description: "List of stream names to include in the scenario (if specified, only these streams will be tested)"
27+
type: array
28+
items:
29+
type: string
30+
exclude_streams:
31+
description: "List of stream names to exclude from the scenario"
32+
type: array
33+
items:
34+
type: string
35+
suggested_streams_only:
36+
description: "Whether to limit testing to the connector's suggested streams list (from data.suggestedStreams)"
37+
type: boolean
38+
default: false
39+
configured_catalog_path:
40+
description: "Path to a pre-configured catalog file for the scenario"
41+
type: string

0 commit comments

Comments
 (0)