summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Nicholson <nicholson@endlessm.com>2019-10-23 09:10:06 -0600
committerDan Nicholson <nicholson@endlessm.com>2020-01-20 20:42:27 -0700
commit4f1b991246dbc67ab7176842a61f3022bed5aad5 (patch)
tree1d14fd683a8c6b5dd4cec9012054c8f0e3d28128
parent1ea719b76bfa94181eb5d228c5c6be10e14b64f1 (diff)
downloadostree-4f1b991246dbc67ab7176842a61f3022bed5aad5.tar.gz
tests/sizes: Test that sizes metadata is not reused
Ensure that the object sizes hash table is cleared after a commit and not only when the repo is closed.
-rwxr-xr-xtests/test-sizes.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/test-sizes.js b/tests/test-sizes.js
index a3928fe8..46848905 100755
--- a/tests/test-sizes.js
+++ b/tests/test-sizes.js
@@ -118,7 +118,7 @@ function validateSizes(repo, commit, expectedFiles) {
}
}
-print('1..2')
+print('1..3')
let testDataDir = Gio.File.new_for_path('test-data');
testDataDir.make_directory(null);
@@ -157,6 +157,23 @@ validateSizes(repo, commit, expectedFiles);
print("ok test-sizes");
+// Remove a file to make sure that metadata is not reused from the
+// previous commit
+testDataDir.get_child('another-file').delete(null);
+delete expectedFiles['f5ee222a21e2c96edbd6f2543c4bc8a039f827be3823d04777c9ee187778f1ad'];
+
+repo.prepare_transaction(null);
+mtree = OSTree.MutableTree.new();
+repo.write_directory_to_mtree(testDataDir, mtree, commitModifier, null);
+[,dirTree] = repo.write_mtree(mtree, null);
+[,commit] = repo.write_commit(null, 'Some subject', 'Some body', null, dirTree, null);
+print("commit => " + commit);
+repo.commit_transaction(null);
+
+validateSizes(repo, commit, expectedFiles);
+
+print("ok test-sizes file deleted");
+
// Repeat the commit now that all the objects are cached and ensure the
// metadata is still correct
repo.prepare_transaction(null);