summaryrefslogtreecommitdiff
path: root/tests/cachekey/cachekey.py
diff options
context:
space:
mode:
authorPhil Dawson <phil.dawson@codethink.co.uk>2019-01-31 17:03:04 +0000
committerPhil Dawson <phildawson.0807@gmail.com>2019-02-01 14:25:44 +0000
commit51cec3da9779730e24cb0e9131ec023f162f3866 (patch)
tree7e1849b716833157dc58f5e2cd8b7b35be0354ae /tests/cachekey/cachekey.py
parent583bd97d1d3a38529ce003faff434fc83d7cbe90 (diff)
downloadbuildstream-51cec3da9779730e24cb0e9131ec023f162f3866.tar.gz
tests/cachekey: Test cache keys are independent of target elementsphil/cache-key-stability-test
Diffstat (limited to 'tests/cachekey/cachekey.py')
-rw-r--r--tests/cachekey/cachekey.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/cachekey/cachekey.py b/tests/cachekey/cachekey.py
index c278b9ca9..761ff0c76 100644
--- a/tests/cachekey/cachekey.py
+++ b/tests/cachekey/cachekey.py
@@ -214,3 +214,41 @@ def test_cache_key_fatal_warnings(cli, tmpdir, first_warnings, second_warnings,
second_keys = run_get_cache_key("second", second_warnings)
assert compare_cache_keys(first_keys, second_keys) == identical_keys
+
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_keys_stable_over_targets(cli, datafiles):
+ root_element = 'elements/key-stability/top-level.bst'
+ target1 = 'elements/key-stability/t1.bst'
+ target2 = 'elements/key-stability/t2.bst'
+
+ project = os.path.join(datafiles.dirname, datafiles.basename)
+ full_graph_result = cli.run(project=project, args=[
+ 'show',
+ '--format', '%{name}::%{full-key}',
+ root_element
+ ])
+ full_graph_result.assert_success()
+ all_cache_keys = parse_output_keys(full_graph_result.output)
+
+ ordering1_result = cli.run(project=project, args=[
+ 'show',
+ '--format', '%{name}::%{full-key}',
+ target1,
+ target2
+ ])
+ ordering1_result.assert_success()
+ ordering1_cache_keys = parse_output_keys(ordering1_result.output)
+
+ ordering2_result = cli.run(project=project, args=[
+ 'show',
+ '--format', '%{name}::%{full-key}',
+ target2,
+ target1
+ ])
+ ordering2_result.assert_success()
+ ordering2_cache_keys = parse_output_keys(ordering2_result.output)
+
+ for element in ordering1_cache_keys:
+ assert ordering1_cache_keys[element] == ordering2_cache_keys[element]
+ assert ordering1_cache_keys[element] == all_cache_keys[element]