-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(ci): 👷 add small smoketest to build pipeline which veryfies …
…that borg is working.
- Loading branch information
1 parent
fd85f58
commit 758257a
Showing
3 changed files
with
43 additions
and
11 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
set -euxo pipefail | ||
|
||
# This file povides a simple smoketest for the build borg binary within the container image | ||
# In this file, we first try to print the borg version, then we try to create a repo and verify its existence. | ||
# In the last step we try to backup a single file. | ||
|
||
# Error handling function | ||
error_handler() { | ||
echo "There was an error while performing the self test." | ||
exit 1 | ||
} | ||
trap 'error_handler' ERR | ||
|
||
|
||
export BORG_REPO=/home/borg/backups/test-repo | ||
export BORG_PASSPHRASE="test" | ||
|
||
# Print version | ||
borg version | ||
|
||
# Initialize a BorgBackup repository | ||
borg init --encryption repokey | ||
|
||
# Check that the repository was created successfully | ||
borg list | ||
|
||
# backup single file and try to restore it. | ||
echo "Hello, World!" > testfile.txt | ||
borg create ::test ./testfile.txt | ||
|
||
# restore backup | ||
mkdir restored | ||
cd restored | ||
borg extract ::test | ||
|
||
# Compare file with original | ||
cmp -s ../testfile.txt ./testfile.txt || exit 1 | ||
|
||
echo "Selftest finished without errors." |