|
29 | 29 | ACCEPTANCE_TEST_CONFIG = "acceptance-test-config.yml" |
30 | 30 |
|
31 | 31 |
|
| 32 | +class JavaClass(str): |
| 33 | + """A string that represents a Java class.""" |
| 34 | + |
| 35 | + |
| 36 | +class DockerImage(str): |
| 37 | + """A string that represents a Docker image.""" |
| 38 | + |
| 39 | + |
| 40 | +class RunnableConnector(abc.ABC): |
| 41 | + """A connector that can be run in a test scenario.""" |
| 42 | + |
| 43 | + @abc.abstractmethod |
| 44 | + def launch(cls, args: list[str] | None): ... |
| 45 | + |
| 46 | + |
32 | 47 | def generate_tests(metafunc): |
33 | 48 | """ |
34 | 49 | A helper for pytest_generate_tests hook. |
@@ -83,22 +98,19 @@ class ConnectorTestSuiteBase(abc.ABC): |
83 | 98 | the root of the connector source directory. |
84 | 99 | """ |
85 | 100 |
|
86 | | - connector_class: type[Connector] |
87 | | - """The connector class to test.""" |
| 101 | + connector: type[Connector] | Path | JavaClass | DockerImage | None = None |
| 102 | + """The connector class or path to the connector to test.""" |
88 | 103 |
|
89 | 104 | working_dir: Path | None = None |
90 | 105 | """The root directory of the connector source code.""" |
91 | 106 |
|
92 | 107 | @override |
93 | 108 | @classmethod |
94 | | - def create_connector(cls, scenario: ConnectorTestScenario) -> ConcurrentDeclarativeSource: |
| 109 | + def create_connector( |
| 110 | + cls, scenario: ConnectorTestScenario |
| 111 | + ) -> Source | ConcurrentDeclarativeSource | RunnableConnector: |
95 | 112 | """Instantiate the connector class.""" |
96 | | - return ConcurrentDeclarativeSource( |
97 | | - config=scenario.get_config_dict(), |
98 | | - catalog={}, |
99 | | - state=None, |
100 | | - source_config={}, |
101 | | - ) |
| 113 | + raise NotImplementedError("Subclasses must implement this method.") |
102 | 114 |
|
103 | 115 | def run_test_scenario( |
104 | 116 | self, |
|
0 commit comments