Skip to content

Commit

Permalink
add another test of init
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Kundert authored and Ken Kundert committed Sep 2, 2021
1 parent 69b60fb commit 8d43ed7
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/INITIAL_CONFIGS/home
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Settings for home configuration
# use of absolute paths is recommended
src_dirs = '~' # absolute path to directory to be backed up
excludes = '''
~/.cache
**/*~
**/__pycache__
**/*.pyc
**/.*.swp
**/.*.swo
''' # list of files or directories to skip
18 changes: 18 additions & 0 deletions tests/INITIAL_CONFIGS/root
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Settings for root configuration
# use of absolute paths is recommended
src_dirs = '/' # paths to directories to be backed up
excludes = '''
/dev
/home/*/.cache
/mnt
/proc
/root/.cache
/run
/sys
/tmp
/var/cache
/var/lib/dnf
/var/lock
/var/run
/var/tmp
''' # list of files or directories to skip
48 changes: 48 additions & 0 deletions tests/INITIAL_CONFIGS/settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# These settings are common to all configurations

# configurations
configurations = '<<list your configurations here>>'
default_configuration = '<<default-config>>'

# encryption
encryption = '<<encryption>>' # borg encryption method
# Common choices are 'repokey' and 'keyfile'.
# With 'repokey' the encryption key is copied into repository, use this
# only if the remote repository is owned by you and is secure.
# With 'keyfile' the encryption key is only stored locally. Be sure to
# export it and save a copy in a safe place, otherwise you may not be
# able to access your backups if you lose your disk.
# specify either passphrase or avendesora_account
passphrase = '<<passcode>>' # passphrase for encryption key
avendesora_account = '<<account-name>>' # avendesora account holding passphrase

# basic settings
# specify notify if batch and notifier if interactive
notify = '<<your-email-address>>' # who to notify when things go wrong
notifier = 'notify-send -u normal {prog_name} "{msg}"'
# interactive notifier program
remote_ratelimit = 2000 # bandwidth limit in kbps
prune_after_create = True # automatically run prune after a backup
check_after_create = 'latest' # automatically run check after a backup

# repository settings
repository = '<<host>>:<<path>>/{host_name}-{user_name}-{config_name}'
prefix = '{host_name}-'
# These may contain {<name>} where <name> is any of host_name, user_name,
# prog_name config_name, or any of the user specified settings.
# Double up the braces to specify parameters that should be interpreted
# directly by borg, such as {{now}}.
compression = 'lz4'

# filter settings
exclude_if_present = '.nobackup'
one_file_system = True
exclude_caches = True

# prune settings
keep_within = '1d' # keep all archives created in interval
keep_hourly = 48 # number of hourly archives to keep
keep_daily = 14 # number of daily archives to keep
keep_weekly = 8 # number of weekly archives to keep
keep_monthly = 24 # number of monthly archives to keep
keep_yearly = 2 # number of yearly archives to keep
14 changes: 14 additions & 0 deletions tests/test-cases.nt
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,20 @@ emborg without configs:
> umask: set umask to M (local and remote, default:
> 0077)

-
args: init
expected:
> Configuration directory created: /«TESTS»/.config/emborg.
> Includes example settings files. Edit them to suit your needs.
> Search for and replace any fields delimited with << and >>.
> Delete any configurations you do not need.
> Generally you will use either home or root, but not both.
cmp_dirs: /«TESTS»/INITIAL_CONFIGS .config/emborg

-
remove: .config


emborg with configs:

-
Expand Down
2 changes: 2 additions & 0 deletions tests/test_emborg.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def run(self):
# remove requested files and directories
if self.remove:
rm(self.remove.split())
if not self.args:
return True

# run command
emborg = Run(self.cmd, "sOMW*")
Expand Down

0 comments on commit 8d43ed7

Please sign in to comment.