Skip to content

metadata-service: add connectorTestSuitesOptions #38116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ class Config:
baseImage: Optional[str] = None


class SecretStore(BaseModel):
class Config:
extra = Extra.forbid

alias: Optional[str] = Field(None, description="The alias of the secret store which can map to its actual secret address")
type: Optional[Literal["GSM"]] = Field(None, description="The type of the secret store")


class ReleaseStage(BaseModel):
__root__: Literal["alpha", "beta", "generally_available", "custom"] = Field(
..., description="enum that describes a connector's release stage", title="ReleaseStage"
Expand Down Expand Up @@ -122,6 +130,15 @@ class SourceFileInfo(BaseModel):
registry_entry_generated_at: Optional[str] = None


class Secret(BaseModel):
class Config:
extra = Extra.forbid

name: str = Field(..., description="The secret name in the secret store")
fileName: Optional[str] = Field(None, description="The name of the file to which the secret value would be persisted")
secretStore: SecretStore


class JobTypeResourceLimit(BaseModel):
class Config:
extra = Extra.forbid
Expand All @@ -146,6 +163,14 @@ class GeneratedFields(BaseModel):
source_file_info: Optional[SourceFileInfo] = None


class ConnectorTestSuiteOptions(BaseModel):
class Config:
extra = Extra.forbid

suite: Literal["unitTests", "integrationTests", "acceptanceTests"] = Field(..., description="Name of the configured test suite")
testSecrets: Optional[List[Secret]] = Field(None, description="List of secrets required to run the test suite")


class ActorDefinitionResourceRequirements(BaseModel):
class Config:
extra = Extra.forbid
Expand Down Expand Up @@ -228,6 +253,7 @@ class Config:
icon: Optional[str] = None
definitionId: UUID
connectorBuildOptions: Optional[ConnectorBuildOptions] = None
connectorTestSuitesOptions: Optional[List[ConnectorTestSuiteOptions]] = None
connectorType: Literal["destination", "source"]
dockerRepository: str
dockerImageTag: str
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# generated by datamodel-codegen:
# filename: ConnectorTestSuiteOptions.yaml

from __future__ import annotations

from typing import List, Optional

from pydantic import BaseModel, Extra, Field
from typing_extensions import Literal


class SecretStore(BaseModel):
class Config:
extra = Extra.forbid

alias: Optional[str] = Field(None, description="The alias of the secret store which can map to its actual secret address")
type: Optional[Literal["GSM"]] = Field(None, description="The type of the secret store")


class Secret(BaseModel):
class Config:
extra = Extra.forbid

name: str = Field(..., description="The secret name in the secret store")
fileName: Optional[str] = Field(None, description="The name of the file to which the secret value would be persisted")
secretStore: SecretStore


class ConnectorTestSuiteOptions(BaseModel):
class Config:
extra = Extra.forbid

suite: Literal["unitTests", "integrationTests", "acceptanceTests"] = Field(..., description="Name of the configured test suite")
testSecrets: Optional[List[Secret]] = Field(None, description="List of secrets required to run the test suite")
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# generated by datamodel-codegen:
# filename: Secret.yaml

from __future__ import annotations

from typing import Optional

from pydantic import BaseModel, Extra, Field
from typing_extensions import Literal


class SecretStore(BaseModel):
class Config:
extra = Extra.forbid

alias: Optional[str] = Field(None, description="The alias of the secret store which can map to its actual secret address")
type: Optional[Literal["GSM"]] = Field(None, description="The type of the secret store")


class Secret(BaseModel):
class Config:
extra = Extra.forbid

name: str = Field(..., description="The secret name in the secret store")
fileName: Optional[str] = Field(None, description="The name of the file to which the secret value would be persisted")
secretStore: SecretStore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# generated by datamodel-codegen:
# filename: SecretStore.yaml

from __future__ import annotations

from typing import Optional

from pydantic import BaseModel, Extra, Field
from typing_extensions import Literal


class SecretStore(BaseModel):
class Config:
extra = Extra.forbid

alias: Optional[str] = Field(None, description="The alias of the secret store which can map to its actual secret address")
type: Optional[Literal["GSM"]] = Field(None, description="The type of the secret store")
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from .ConnectorRegistrySourceDefinition import *
from .ConnectorRegistryV0 import *
from .ConnectorReleases import *
from .ConnectorTestSuiteOptions import *
from .GeneratedFields import *
from .GitInfo import *
from .JobType import *
Expand All @@ -17,6 +18,8 @@
from .ReleaseStage import *
from .RemoteRegistries import *
from .ResourceRequirements import *
from .Secret import *
from .SecretStore import *
from .SourceFileInfo import *
from .SuggestedStreams import *
from .SupportLevel import *
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ properties:
format: uuid
connectorBuildOptions:
"$ref": ConnectorBuildOptions.yaml
connectorTestSuitesOptions:
type: array
items:
"$ref": ConnectorTestSuiteOptions.yaml
connectorType:
type: string
enum:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
"$schema": http://json-schema.org/draft-07/schema#
"$id": https://github.com/airbytehq/airbyte/airbyte-ci/connectors/metadata_service/lib/metadata_service/models/src/ConnectorTestOptions.yaml
title: ConnectorTestSuiteOptions
description: Options for a specific connector test suite.
type: object
required:
- suite
additionalProperties: false
properties:
suite:
description: "Name of the configured test suite"
type: string
enum:
- "unitTests"
- "integrationTests"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Given that

  1. We will likely have different configuration options for each test
  2. We may have different configuration values for the same option between tests
  3. We want these test suites to be discoverable

What do you think of a format that

  1. encourages connector devs to use connectorTestSuitesOptions.suite. integrationTests.enabled = false to disable a test suite
  2. provides settings globally and per suite?

example:

connectorTestSuitesOptions:
  suite:
    unitTests:
      enabled: true
    integrationTests:
      enabled: false
    acceptanceTests:
      enabled: true
      override:
        secrets:
          fileName: config_this.yaml
  settings:
    secrets:
      - name: SECRET_FOR_MY_AWESOME_SOURCE
        fileName: config.yaml
        secretStore:
          type: GSM
          alias: airbyte-internal-secret-store

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bnchrch I think I like the enabled field. But I think I prefer keeping per test suites secrets as it explicitly declares test suite secrets requirements.
If we'd go with your suggestion airbyte-ci would have to eagerly mount the secrets declared in settings to each test suites even if they're not required. I'd prefer to keep things as explicit as possible and have a way to assess which test suite needs which secret... Does it sound reasonable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds very reasonable! Approved!

- "acceptanceTests"
testSecrets:
description: "List of secrets required to run the test suite"
type: array
items:
"$ref": "Secret.yaml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
"$schema": http://json-schema.org/draft-07/schema#
"$id": https://github.com/airbytehq/airbyte/airbyte-ci/connectors/metadata_service/lib/metadata_service/models/src/TestSecret.yaml
title: Secret
description: An object describing a secret's metadata
type: object
required:
- name
- secretStore
additionalProperties: false
properties:
name:
type: string
description: "The secret name in the secret store"
fileName:
type: string
description: "The name of the file to which the secret value would be persisted"
secretStore:
"$ref": SecretStore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
"$schema": http://json-schema.org/draft-07/schema#
"$id": https://github.com/airbytehq/airbyte/airbyte-ci/connectors/metadata_service/lib/metadata_service/models/src/TestSecret.yaml
title: SecretStore
description: An object describing a secret store metadata
type: object
required:
- name
- secretStore
additionalProperties: false
properties:
alias:
type: string
description: "The alias of the secret store which can map to its actual secret address"
type:
type: string
description: "The type of the secret store"
enum:
- "GSM"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "metadata-service"
version = "0.6.0"
version = "0.7.0"
description = ""
authors = ["Ben Church <[email protected]>"]
readme = "README.md"
Expand Down
Loading