Tristan Van Berkom pushed to branch tristan/test-cache-existence at BuildStream / buildstream
Commits:
-
d88568ef
by Valentin David at 2018-08-24T06:48:08Z
-
f7ef151b
by Tristan Van Berkom at 2018-08-24T07:36:19Z
-
ca4facbe
by Tristan Van Berkom at 2018-08-24T07:38:43Z
3 changed files:
Changes:
... | ... | @@ -76,6 +76,10 @@ source_dist: |
76 | 76 |
|
77 | 77 |
- export INTEGRATION_CACHE="$(pwd)/cache/integration-cache"
|
78 | 78 |
|
79 |
+ - ls cache || true
|
|
80 |
+ - ls cache/integration-cache || true
|
|
81 |
+ - du -hs cache || true
|
|
82 |
+ |
|
79 | 83 |
# Unpack and get into dist/buildstream
|
80 | 84 |
- cd dist && ./unpack.sh
|
81 | 85 |
- chown -R buildstream:buildstream buildstream
|
... | ... | @@ -85,6 +89,9 @@ source_dist: |
85 | 89 |
# user to test for permission issues
|
86 | 90 |
- su buildstream -c 'python3 setup.py test --index-url invalid://uri --addopts --integration'
|
87 | 91 |
|
92 |
+ - ls integration-cache || true
|
|
93 |
+ - du -hs integration-cache || true
|
|
94 |
+ |
|
88 | 95 |
# Go back to the toplevel and collect our reports
|
89 | 96 |
- cd ../..
|
90 | 97 |
- mkdir -p coverage-linux/
|
... | ... | @@ -2,7 +2,8 @@ import os |
2 | 2 |
import pytest
|
3 | 3 |
|
4 | 4 |
from buildstream import _yaml, utils
|
5 |
-from tests.testutils import cli, create_repo, ALL_REPO_KINDS
|
|
5 |
+from tests.testutils import create_repo, ALL_REPO_KINDS
|
|
6 |
+from tests.testutils import cli_integration as cli
|
|
6 | 7 |
|
7 | 8 |
|
8 | 9 |
DATA_DIR = os.path.join(
|
... | ... | @@ -28,7 +29,7 @@ def create_test_directory(*path, mode=0o644): |
28 | 29 |
@pytest.mark.integration
|
29 | 30 |
@pytest.mark.datafiles(DATA_DIR)
|
30 | 31 |
@pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS] + ['local'])
|
31 |
-def test_deterministic_source_umask(cli, tmpdir, datafiles, kind):
|
|
32 |
+def test_deterministic_source_umask(cli, tmpdir, datafiles, kind, integration_cache):
|
|
32 | 33 |
project = str(datafiles)
|
33 | 34 |
element_name = 'list'
|
34 | 35 |
element_path = os.path.join(project, 'elements', element_name)
|
... | ... | @@ -91,14 +92,16 @@ def test_deterministic_source_umask(cli, tmpdir, datafiles, kind): |
91 | 92 |
return f.read()
|
92 | 93 |
finally:
|
93 | 94 |
os.umask(old_umask)
|
94 |
- cli.remove_artifact_from_cache(project, element_name)
|
|
95 |
+ cache_dir = os.path.join(integration_cache, 'artifacts')
|
|
96 |
+ cli.remove_artifact_from_cache(project, element_name,
|
|
97 |
+ cache_dir=cache_dir)
|
|
95 | 98 |
|
96 | 99 |
assert get_value_for_umask(0o022) == get_value_for_umask(0o077)
|
97 | 100 |
|
98 | 101 |
|
99 | 102 |
@pytest.mark.integration
|
100 | 103 |
@pytest.mark.datafiles(DATA_DIR)
|
101 |
-def test_deterministic_source_local(cli, tmpdir, datafiles):
|
|
104 |
+def test_deterministic_source_local(cli, tmpdir, datafiles, integration_cache):
|
|
102 | 105 |
"""Only user rights should be considered for local source.
|
103 | 106 |
"""
|
104 | 107 |
project = str(datafiles)
|
... | ... | @@ -150,6 +153,8 @@ def test_deterministic_source_local(cli, tmpdir, datafiles): |
150 | 153 |
with open(os.path.join(checkoutdir, 'ls-l'), 'r') as f:
|
151 | 154 |
return f.read()
|
152 | 155 |
finally:
|
153 |
- cli.remove_artifact_from_cache(project, element_name)
|
|
156 |
+ cache_dir = os.path.join(integration_cache, 'artifacts')
|
|
157 |
+ cli.remove_artifact_from_cache(project, element_name,
|
|
158 |
+ cache_dir=cache_dir)
|
|
154 | 159 |
|
155 | 160 |
assert get_value_for_mask(0o7777) == get_value_for_mask(0o0700)
|
... | ... | @@ -198,8 +198,10 @@ class Cli(): |
198 | 198 |
for key, val in config.items():
|
199 | 199 |
self.config[key] = val
|
200 | 200 |
|
201 |
- def remove_artifact_from_cache(self, project, element_name):
|
|
202 |
- cache_dir = os.path.join(project, 'cache', 'artifacts')
|
|
201 |
+ def remove_artifact_from_cache(self, project, element_name,
|
|
202 |
+ *, cache_dir=None):
|
|
203 |
+ if not cache_dir:
|
|
204 |
+ cache_dir = os.path.join(project, 'cache', 'artifacts')
|
|
203 | 205 |
|
204 | 206 |
cache_dir = os.path.join(cache_dir, 'cas', 'refs', 'heads')
|
205 | 207 |
|