Skip to content

Commit

Permalink
save changes required for work; TODO locate all places that need to b…
Browse files Browse the repository at this point in the history
…e updated to make test working
  • Loading branch information
vovavovavovavova committed Jul 1, 2021
1 parent 53b02e0 commit 69aa7a6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .test_core import TestBasicRead, TestConnection, TestDiscovery, TestSpec
from .test_core import TestBasicRead, TestConnection, TestDiscovery, TestSpec, TestEnvVarExists
from .test_full_refresh import TestFullRefresh
from .test_incremental import TestIncremental

__all__ = ["TestSpec", "TestBasicRead", "TestConnection", "TestDiscovery", "TestFullRefresh", "TestIncremental"]
__all__ = ["TestSpec", "TestBasicRead", "TestConnection", "TestDiscovery", "TestFullRefresh", "TestIncremental", "TestEnvVarExists"]
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
from source_acceptance_test.utils import ConnectorRunner, serialize


class TestEnvVarExists(BaseTest):
def test_env_var_exists(self, connector_config, docker_runner: ConnectorRunner):
result = docker_runner.has_env_var()
assert result

@pytest.mark.default_timeout(10)
class TestSpec(BaseTest):
def test_spec(self, connector_spec: ConnectorSpecification, docker_runner: ConnectorRunner):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,9 @@ def run(self, cmd, config=None, state=None, catalog=None, **kwargs) -> Iterable[
yield AirbyteMessage.parse_raw(line)
except ValidationError as exc:
logging.warning("Unable to parse connector's output %s", exc)

def has_env_var(self, lookup_env_var: str = "AIRBYTE_ENTRYPOINT"):

This comment has been minimized.

Copy link
@keu

keu Jul 2, 2021

Contributor

this method should return dict env_name -> env_value
Test should check specific key existence and value

self._env_vars = self._image.attrs['Config']['Env']

This comment has been minimized.

Copy link
@keu

keu Jul 1, 2021

Contributor

why do we use self here?

self._env_airbyte_entrypoint = [i for i in self._env_vars if i.startswith(lookup_env_var)]

This comment has been minimized.

Copy link
@keu

keu Jul 1, 2021

Contributor

same

ret = self._env_airbyte_entrypoint and self._env_airbyte_entrypoint[0].split(f"{lookup_env_var}=", 1)[1]
return bool(ret)

0 comments on commit 69aa7a6

Please sign in to comment.