diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-01-18 12:42:13 -0500 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-01-18 14:36:26 -0500 |
commit | c536ab6a859f551078c0ea07a3a20fdd9851276a (patch) | |
tree | 2c8b92234acd2ae5568c936dd206e64f5d952825 /tests/artifactcache | |
parent | c9ce89d2afcf0b6f4efa6d0cf773ac11041c84ef (diff) | |
download | buildstream-c536ab6a859f551078c0ea07a3a20fdd9851276a.tar.gz |
tests/artifactcache/expiry.py: Test refs directory cleanup
Enhance the test which checks removal of the extract directories
with an additional check that the ref directories are cleaned up
when removing artifacts.
Diffstat (limited to 'tests/artifactcache')
-rw-r--r-- | tests/artifactcache/expiry.py | 14 |
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) |