tests: add test for ostree prune --delete-commit
authorGiuseppe Scrivano <gscrivan@redhat.com>
Thu, 5 Nov 2015 12:34:00 +0000 (13:34 +0100)
committerGiuseppe Scrivano <gscrivan@redhat.com>
Mon, 16 Nov 2015 09:57:33 +0000 (10:57 +0100)
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
tests/test-prune.sh

index fa9e0e8990b11a9c4881496433076284c2ef4ffa..c73a5cae13776332a098f62dd843bf8b87456ef8 100644 (file)
@@ -42,15 +42,15 @@ done
 
 ${CMD_PREFIX} ostree --repo=repo pull --depth=-1 origin test
 
-${CMD_PREFIX} ostree prune --repo=repo --refs-only --depth=1 -v
+${CMD_PREFIX} ostree prune --repo=repo --refs-only --depth=2 -v
 find repo | grep \.commit$ | wc -l > commitcount
-assert_file_has_content commitcount "^2$"
+assert_file_has_content commitcount "^3$"
 find repo/objects -name '*.tombstone-commit' | wc -l > tombstonecommitcount
 assert_file_has_content tombstonecommitcount "^0$"
 
-${CMD_PREFIX} ostree prune --repo=repo --refs-only --depth=0 -v
+${CMD_PREFIX} ostree prune --repo=repo --refs-only --depth=1 -v
 find repo | grep \.commit$ | wc -l > commitcount
-assert_file_has_content commitcount "^1$"
+assert_file_has_content commitcount "^2$"
 find repo/objects -name '*.tombstone-commit' | wc -l > tombstonecommitcount
 assert_file_has_content tombstonecommitcount "^0$"
 
@@ -77,4 +77,9 @@ ${CMD_PREFIX} ostree --repo=repo pull --depth=-1 origin test
 find repo/objects -name '*.tombstone-commit' | wc -l > tombstonecommitcount
 assert_file_has_content tombstonecommitcount "^0$"
 
+COMMIT_TO_DELETE=$(${CMD_PREFIX} ostree --repo=repo log test | grep ^commit | cut -f 2 -d' ' | tail -n 1)
+${CMD_PREFIX} ostree --repo=repo prune --delete-commit=$COMMIT_TO_DELETE
+find repo/objects -name '*.tombstone-commit' | wc -l > tombstonecommitcount
+assert_file_has_content tombstonecommitcount "^1$"
+
 echo "ok prune"