tests: Add a testcase to ensure we're not using the summary if we don't need it
authorAlexander Larsson <alexl@redhat.com>
Fri, 9 Oct 2020 14:30:29 +0000 (16:30 +0200)
committerAlexander Larsson <alexl@redhat.com>
Fri, 23 Oct 2020 11:55:33 +0000 (13:55 +0200)
With deltas outside the summary, if a commit is specified when pulling
we don't download the summary. Verify this.

tests/pull-test.sh

index 082ed315122f582a370866906a0aef474ba8e5c1..0892183859d25720ecdc6ecd74d929845f8a60df 100644 (file)
@@ -55,10 +55,10 @@ function verify_initial_contents() {
 }
 
 if has_gpgme; then
-    echo "1..35"
+    echo "1..36"
 else
     # 3 tests needs GPG support
-    echo "1..32"
+    echo "1..33"
 fi
 
 # Try both syntaxes
@@ -381,6 +381,25 @@ assert_file_has_content err.txt "Upgrade.*is chronologically older"
 ${CMD_PREFIX} ostree --repo=repo pull --timestamp-check-from-rev=${oldrev} origin main@${middlerev}
 echo "ok pull timestamp checking"
 
+# test pull without override commit use summary, but with doesn't use summary
+# We temporarily replace summary with broken one to detect if it is used
+mv ostree-srv/gnomerepo/summary ostree-srv/gnomerepo/summary.backup
+echo "broken" > ostree-srv/gnomerepo/summary
+
+repo_init --no-sign-verify
+rev=$(ostree --repo=ostree-srv/gnomerepo rev-parse main)
+# This will need summary, so will fail
+if ${CMD_PREFIX} ostree --repo=repo -v pull origin main; then
+  assert_not_reached "Should have failed with broken summary"
+fi
+# This won't need summary so will not fail
+${CMD_PREFIX} ostree --repo=repo pull origin main@${rev}
+
+# Restore summary
+mv ostree-srv/gnomerepo/summary.backup ostree-srv/gnomerepo/summary
+
+echo "ok pull with override id doesn't use summary"
+
 cd ${test_tmpdir}
 repo_init --no-sign-verify
 ${CMD_PREFIX} ostree --repo=repo pull origin main