summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2018-08-24 08:21:50 +0000
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-08-24 08:21:50 +0000
commite04178dadc2e2304bb54afc411d985d4fe3c27d6 (patch)
treece3d90ee05f3af072b9546b7bcd1a74cd2ffff78
parent301a393cb6499b3f869d74827a9e8dc61b97d00e (diff)
parentd824489b6e0148078f8475c82e12116fda240923 (diff)
downloadbuildstream-e04178dadc2e2304bb54afc411d985d4fe3c27d6.tar.gz
Merge branch 'tristan/integration-cli-source-determinism' into 'bst-1.2'
tests/integration/source-determinism.py: Use cli_integration. See merge request BuildStream/buildstream!721
-rw-r--r--tests/integration/source-determinism.py15
-rw-r--r--tests/testutils/runcli.py6
2 files changed, 14 insertions, 7 deletions
diff --git a/tests/integration/source-determinism.py b/tests/integration/source-determinism.py
index b60bc25f7..d1760c267 100644
--- a/tests/integration/source-determinism.py
+++ b/tests/integration/source-determinism.py
@@ -2,7 +2,8 @@ import os
import pytest
from buildstream import _yaml, utils
-from tests.testutils import cli, create_repo, ALL_REPO_KINDS
+from tests.testutils import create_repo, ALL_REPO_KINDS
+from tests.testutils import cli_integration as cli
DATA_DIR = os.path.join(
@@ -28,7 +29,7 @@ def create_test_directory(*path, mode=0o644):
@pytest.mark.integration
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS] + ['local'])
-def test_deterministic_source_umask(cli, tmpdir, datafiles, kind):
+def test_deterministic_source_umask(cli, tmpdir, datafiles, kind, integration_cache):
project = str(datafiles)
element_name = 'list'
element_path = os.path.join(project, 'elements', element_name)
@@ -91,14 +92,16 @@ def test_deterministic_source_umask(cli, tmpdir, datafiles, kind):
return f.read()
finally:
os.umask(old_umask)
- cli.remove_artifact_from_cache(project, element_name)
+ cache_dir = os.path.join(integration_cache, 'artifacts')
+ cli.remove_artifact_from_cache(project, element_name,
+ cache_dir=cache_dir)
assert get_value_for_umask(0o022) == get_value_for_umask(0o077)
@pytest.mark.integration
@pytest.mark.datafiles(DATA_DIR)
-def test_deterministic_source_local(cli, tmpdir, datafiles):
+def test_deterministic_source_local(cli, tmpdir, datafiles, integration_cache):
"""Only user rights should be considered for local source.
"""
project = str(datafiles)
@@ -150,6 +153,8 @@ def test_deterministic_source_local(cli, tmpdir, datafiles):
with open(os.path.join(checkoutdir, 'ls-l'), 'r') as f:
return f.read()
finally:
- cli.remove_artifact_from_cache(project, element_name)
+ cache_dir = os.path.join(integration_cache, 'artifacts')
+ cli.remove_artifact_from_cache(project, element_name,
+ cache_dir=cache_dir)
assert get_value_for_mask(0o7777) == get_value_for_mask(0o0700)
diff --git a/tests/testutils/runcli.py b/tests/testutils/runcli.py
index 96d4ea457..ee4eb957e 100644
--- a/tests/testutils/runcli.py
+++ b/tests/testutils/runcli.py
@@ -198,8 +198,10 @@ class Cli():
for key, val in config.items():
self.config[key] = val
- def remove_artifact_from_cache(self, project, element_name):
- cache_dir = os.path.join(project, 'cache', 'artifacts')
+ def remove_artifact_from_cache(self, project, element_name,
+ *, cache_dir=None):
+ if not cache_dir:
+ cache_dir = os.path.join(project, 'cache', 'artifacts')
cache_dir = os.path.join(cache_dir, 'cas', 'refs', 'heads')