summaryrefslogtreecommitdiff
path: root/tests/test-summary-update.sh
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2017-09-11 14:42:52 +0100
committerAtomic Bot <atomic-devel@projectatomic.io>2017-10-02 13:39:41 +0000
commitfeeb3548f4e00fb60481f9105c68e4f2322ab92a (patch)
treefdad02a96b8d205c45cb7fb1cf60bcada828ef53 /tests/test-summary-update.sh
parent16aa4d728a5c92fc44d35d29c631708d1cc31eec (diff)
downloadostree-feeb3548f4e00fb60481f9105c68e4f2322ab92a.tar.gz
ostree/summary: Generate an ostree-metadata ref when updating summary
This is the new way of publishing repository metadata, rather than as additional-metadata in the summary file. The use of an ostree-metadata ref means that the metadata from multiple upstream collections is not conflated when doing P2P mirroring of many repositories. The new ref is only generated if the repository has a collection ID set. The old summary file continues to be generated for backwards compatibility (and because it continues to be the canonical ref → checksum map for the repository). The new code is only used if configured with --enable-experimental-api. Includes unit tests. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1158 Approved by: cgwalters
Diffstat (limited to 'tests/test-summary-update.sh')
-rwxr-xr-xtests/test-summary-update.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test-summary-update.sh b/tests/test-summary-update.sh
index 457debbe..60228114 100755
--- a/tests/test-summary-update.sh
+++ b/tests/test-summary-update.sh
@@ -91,4 +91,23 @@ ${CMD_PREFIX} ostree --repo=repo summary --update --add-metadata=map='@a{sv} {}'
${CMD_PREFIX} ostree --repo=repo summary --view > summary
assert_file_has_content summary "^map: {}$"
+# Check the ostree-metadata ref has also been created with the same content and appropriate bindings.
+${CMD_PREFIX} ostree --repo=repo refs --collections > refs
+assert_file_has_content refs "^(org.example.Collection1, ostree-metadata)$"
+
+${CMD_PREFIX} ostree --repo=repo show ostree-metadata --raw > metadata
+assert_file_has_content metadata "'map': <@a{sv} {}>"
+assert_file_has_content metadata "'ostree.ref-binding': <\['ostree-metadata'\]>"
+assert_file_has_content metadata "'ostree.collection-binding': <'org.example.Collection1'>"
+
+# There should be 5 commits in the ostree-metadata branch, since we’ve updated the summary 5 times.
+${CMD_PREFIX} ostree --repo=repo log ostree-metadata | grep 'commit ' | wc -l > commit-count
+assert_file_has_content commit-count "^5$"
+
+# The ostree-metadata commits should not contain any files
+${CMD_PREFIX} ostree --repo=repo ls ostree-metadata > files
+assert_file_has_content files " /$"
+cat files | wc -l > files-count
+assert_file_has_content files-count "^1$"
+
echo "ok 2 update summary with collections"