functest: add simple gc test

Fixes #274

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2017-11-27 00:41:02 +02:00
parent 3ed37fd0f8
commit f035926891
2 changed files with 40 additions and 0 deletions
+1
View File
@@ -10,6 +10,7 @@ TESTS+=" test-sync.sh"
TESTS+=" test-repro-code.sh"
TESTS+=" test-merge.sh"
TESTS+=" test-checkout.sh"
TESTS+=" test-gc.sh"
for t in $TESTS; do
rm -rf $TEST_REPO
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
set -e
source common.sh
dvc_create_repo
ORIG_CACHE=$(ls .dvc/cache)
DUMMY_CACHE+=" .dvc/cache/1"
DUMMY_CACHE+=" .dvc/cache/2"
DUMMY_CACHE+=" .dvc/cache/3"
dvc_info "Create dummy cache files"
touch $DUMMY_CACHE
if [ $? -ne 0 ]; then
dvc_error "Failed to create cache files"
dvc_fail
fi
dvc_info "Run 'dvc gc'"
dvc gc
dvc_info "Check that we didn't break good cache"
dvc_check_dirs ".dvc/cache"
pushd .dvc/cache
dvc_check_files $ORIG_CACHE
popd
dvc_info "Check that dummy cache files were removed"
for d in $DUMMY_CACHE; do
if [ -f $d ]; then
dvc_error "Dummy cache file $d was not removed by gc"
dvc_fail
fi
done
dvc_pass