diff options
author | Martin Blanchard <martin.blanchard@codethink.co.uk> | 2019-03-21 16:59:50 +0000 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-03-25 12:42:57 +0000 |
commit | b0205501bdc99af1470baf7caad9e8f09f619aeb (patch) | |
tree | 8702b26069f9894cd7db041447fafa241cb03ccf /tests/conftest.py | |
parent | 21b1dea923d01e3d2d4179e2189595aa9ae678e8 (diff) | |
download | buildstream-b0205501bdc99af1470baf7caad9e8f09f619aeb.tar.gz |
runcli.py: Add a CLI test fixture for remote-execution
https://gitlab.com/BuildStream/buildstream/issues/629
Diffstat (limited to 'tests/conftest.py')
-rwxr-xr-x | tests/conftest.py | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 32af72df9..30577870f 100755 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -84,7 +84,6 @@ class IntegrationCache(): @pytest.fixture(scope='session') def integration_cache(request): - # Set the cache dir to the INTEGRATION_CACHE variable, or the # default if that is not set. if 'INTEGRATION_CACHE' in os.environ: @@ -109,6 +108,40 @@ def integration_cache(request): ################################################# +# remote_services fixture # +################################################# +# +# This is returned by the `remote_services` fixture +# +class RemoteServices(): + + def __init__(self, **kwargs): + self.action_service = kwargs.get('action_service') + self.artifact_service = kwargs.get('artifact_service') + self.exec_service = kwargs.get('exec_service') + self.source_service = kwargs.get('source_service') + self.storage_service = kwargs.get('storage_service') + + +@pytest.fixture(scope='session') +def remote_services(request): + kwargs = {} + # Look for remote services configuration in environment. + if 'ARTIFACT_CACHE_SERVICE' in os.environ: + kwargs['artifact_service'] = os.environ.get('ARTIFACT_CACHE_SERVICE') + + if 'REMOTE_EXECUTION_SERVICE' in os.environ: + kwargs['action_service'] = os.environ.get('REMOTE_EXECUTION_SERVICE') + kwargs['exec_service'] = os.environ.get('REMOTE_EXECUTION_SERVICE') + kwargs['storage_service'] = os.environ.get('REMOTE_EXECUTION_SERVICE') + + if 'SOURCE_CACHE_SERVICE' in os.environ: + kwargs['source_service'] = os.environ.get('SOURCE_CACHE_SERVICE') + + return RemoteServices(**kwargs) + + +################################################# # Automatically reset the platform # ################################################# # |