nixos/borgbackup: fix extraArgs shell expansion
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
@@ -3,6 +3,8 @@ import ./make-test-python.nix ({ pkgs, ... }:
|
||||
let
|
||||
passphrase = "supersecret";
|
||||
dataDir = "/ran:dom/data";
|
||||
subDir = "not_anything_here";
|
||||
excludedSubDirFile = "not_this_file_either";
|
||||
excludeFile = "not_this_file";
|
||||
keepFile = "important_file";
|
||||
keepFileData = "important_data";
|
||||
@@ -69,6 +71,7 @@ in {
|
||||
yearly = 5;
|
||||
};
|
||||
exclude = [ "*/${excludeFile}" ];
|
||||
extraCreateArgs = [ "--exclude-caches" "--exclude-if-present" ".dont backup" ];
|
||||
postHook = "echo post";
|
||||
startAt = [ ]; # Do not run automatically
|
||||
};
|
||||
@@ -166,8 +169,10 @@ in {
|
||||
)
|
||||
client.succeed("chmod 0600 /root/id_ed25519.appendOnly")
|
||||
|
||||
client.succeed("mkdir -p ${dataDir}")
|
||||
client.succeed("mkdir -p ${dataDir}/${subDir}")
|
||||
client.succeed("touch ${dataDir}/${excludeFile}")
|
||||
client.succeed("touch '${dataDir}/${subDir}/.dont backup'")
|
||||
client.succeed("touch ${dataDir}/${subDir}/${excludedSubDirFile}")
|
||||
client.succeed("echo '${keepFileData}' > ${dataDir}/${keepFile}")
|
||||
|
||||
with subtest("local"):
|
||||
@@ -180,6 +185,10 @@ in {
|
||||
client.fail(
|
||||
"{} list '${localRepo}::${archiveName}' | grep -qF '${excludeFile}'".format(borg)
|
||||
)
|
||||
# Make sure excludedSubDirFile has been excluded
|
||||
client.fail(
|
||||
"{} list '${localRepo}::${archiveName}' | grep -qF '${subDir}/${excludedSubDirFile}".format(borg)
|
||||
)
|
||||
# Make sure keepFile has the correct content
|
||||
client.succeed("{} extract '${localRepo}::${archiveName}'".format(borg))
|
||||
assert "${keepFileData}" in client.succeed("cat ${dataDir}/${keepFile}")
|
||||
|
||||
Reference in New Issue
Block a user