summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-01-18 12:42:13 -0500
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-01-18 12:43:25 -0500
commit008cdee5abb289d541996a33001f984fcdf845c7 (patch)
treea052a53bcda729994d63ea3728e6602668a51931
parent1f8e506daa2fbc57cd48abf4cc1913c0c0875cd1 (diff)
downloadbuildstream-tristan/cas-cleanup-improve.tar.gz
tests/artifactcache/expiry.py: Test refs directory cleanuptristan/cas-cleanup-improve
Enhance the test which checks removal of the extract directories with an additional check that the ref directories are cleaned up when removing artifacts.
-rw-r--r--tests/artifactcache/expiry.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/artifactcache/expiry.py b/tests/artifactcache/expiry.py
index e73928363..d40f432c9 100644
--- a/tests/artifactcache/expiry.py
+++ b/tests/artifactcache/expiry.py
@@ -382,6 +382,7 @@ def test_extract_expiry(cli, datafiles, tmpdir):
res = cli.run(project=project, args=['checkout', 'target.bst', os.path.join(str(tmpdir), 'checkout')])
res.assert_success()
+ # Get a snapshot of the extracts in advance
extractdir = os.path.join(project, 'cache', 'artifacts', 'extract', 'test', 'target')
extracts = os.listdir(extractdir)
assert(len(extracts) == 1)
@@ -395,3 +396,16 @@ def test_extract_expiry(cli, datafiles, tmpdir):
# Now the extract should be removed.
assert not os.path.exists(extract)
+
+ # As an added bonus, let's ensure that no directories have been left behind
+ #
+ # Now we should have a directory for the cached target2.bst, which
+ # replaced target.bst in the cache, we should not have a directory
+ # for the target.bst
+ refsdir = os.path.join(project, 'cache', 'artifacts', 'cas', 'refs', 'heads')
+ refsdirtest = os.path.join(refsdir, 'test')
+ refsdirtarget = os.path.join(refsdirtest, 'target')
+ refsdirtarget2 = os.path.join(refsdirtest, 'target2')
+
+ assert os.path.isdir(refsdirtarget2)
+ assert not os.path.exists(refsdirtarget)