コード例 #1
0
ファイル: test_core.py プロジェクト: zestyping/airbyte
    def test_spec(self, connector_spec: ConnectorSpecification, docker_runner: ConnectorRunner):
        output = docker_runner.call_spec()
        spec_messages = [message for message in output if message.type == Type.SPEC]

        assert len(spec_messages) == 1, "Spec message should be emitted exactly once"
        if connector_spec:
            assert spec_messages[0].spec == connector_spec, "Spec should be equal to the one in spec.json file"
コード例 #2
0
    def test_match_expected(self, connector_spec: ConnectorSpecification,
                            connector_config: SecretDict,
                            docker_runner: ConnectorRunner):
        output = docker_runner.call_spec()
        spec_messages = [
            message for message in output if message.type == Type.SPEC
        ]

        assert len(
            spec_messages) == 1, "Spec message should be emitted exactly once"
        if connector_spec:
            assert spec_messages[
                0].spec == connector_spec, "Spec should be equal to the one in spec.json file"

        assert docker_runner.env_variables.get(
            "AIRBYTE_ENTRYPOINT"
        ), "AIRBYTE_ENTRYPOINT must be set in dockerfile"
        assert docker_runner.env_variables.get(
            "AIRBYTE_ENTRYPOINT") == " ".join(
                docker_runner.entry_point
            ), "env should be equal to space-joined entrypoint"

        # Getting rid of technical variables that start with an underscore
        config = {
            key: value
            for key, value in connector_config.data.items()
            if not key.startswith("_")
        }

        validate(instance=config,
                 schema=spec_messages[0].spec.connectionSpecification)