From 1f9582df510ae84861b8968b4c8d8c35b8c68253 Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Wed, 29 Dec 2021 10:10:12 +0100 Subject: [PATCH] Fix handling of empty directories (#44) * Add test checking whether empty directories are included in backups * Update targz library to include fix --- go.mod | 2 +- go.sum | 4 ++-- test/cli/run.sh | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 383e68d..370eaae 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/gofrs/flock v0.8.1 github.com/kelseyhightower/envconfig v1.4.0 github.com/leekchan/timeutil v0.0.0-20150802142658-28917288c48d - github.com/m90/targz v0.0.0-20210904082215-2e9a4529a615 + github.com/m90/targz v0.0.0-20211229090208-2f22c2d9278e github.com/minio/minio-go/v7 v7.0.16 github.com/otiai10/copy v1.7.0 github.com/sirupsen/logrus v1.8.1 diff --git a/go.sum b/go.sum index 720ec50..fec4db0 100644 --- a/go.sum +++ b/go.sum @@ -450,8 +450,8 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/leekchan/timeutil v0.0.0-20150802142658-28917288c48d h1:2puqoOQwi3Ai1oznMOsFIbifm6kIfJaLLyYzWD4IzTs= github.com/leekchan/timeutil v0.0.0-20150802142658-28917288c48d/go.mod h1:hO90vCP2x3exaSH58BIAowSKvV+0OsY21TtzuFGHON4= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/m90/targz v0.0.0-20210904082215-2e9a4529a615 h1:rn0LO2tQEgCDOct8qnbcslTUpAIWdVlWcGkjoumhf2U= -github.com/m90/targz v0.0.0-20210904082215-2e9a4529a615/go.mod h1:YZK3bSO/oVlk9G+v00BxgzxW2Us4p/R4ysHOBjk0fJI= +github.com/m90/targz v0.0.0-20211229090208-2f22c2d9278e h1:Kzm2zfxS40RUGD5UVtVtOo9RT5TtGoNJnmWORtCEaxM= +github.com/m90/targz v0.0.0-20211229090208-2f22c2d9278e/go.mod h1:YZK3bSO/oVlk9G+v00BxgzxW2Us4p/R4ysHOBjk0fJI= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20190403194419-1ea4449da983/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= diff --git a/test/cli/run.sh b/test/cli/run.sh index bcf2a5d..74c0696 100755 --- a/test/cli/run.sh +++ b/test/cli/run.sh @@ -7,6 +7,7 @@ cd $(dirname $0) docker network create test_network docker volume create backup_data docker volume create app_data +docker volume create empty_data docker run -d \ --name minio \ @@ -31,6 +32,7 @@ sleep 10 docker run --rm \ --network test_network \ -v app_data:/backup/app_data \ + -v empty_data:/backup/empty_data \ -v /var/run/docker.sock:/var/run/docker.sock \ --env AWS_ACCESS_KEY_ID=test \ --env AWS_SECRET_ACCESS_KEY=GMusLtUmILge2by+z890kQ \ @@ -44,7 +46,7 @@ docker run --rm \ docker run --rm -it \ -v backup_data:/data alpine \ - ash -c 'tar -xvf /data/backup/test.tar.gz && test -f /backup/app_data/offen.db' + ash -c 'tar -xvf /data/backup/test.tar.gz && test -f /backup/app_data/offen.db && test -d /backup/empty_data' echo "[TEST:PASS] Found relevant files in untared backup."