From 50be970577131215e4827e2158c6f9fb43b0faa5 Mon Sep 17 00:00:00 2001 From: Ken Kundert Date: Sun, 29 Dec 2024 20:25:45 -0800 Subject: [PATCH] Fix exit status which docopt errors. Fix archive_filter_options Remove conflict between --all and --after (short for both was -A) Output config to logfile. Switch form of --exclude and --patterns command line options. Fix match_archives Improve tests --- assimilate/assimilate.py | 25 +- assimilate/command.py | 105 ++- assimilate/main.py | 6 +- assimilate/utilities.py | 11 +- tests/assimilate.nt | 1486 ++++++++++++++++++++++++++++++++++---- tests/run-only.nt | 2 +- tests/test_assimilate.py | 24 +- 7 files changed, 1425 insertions(+), 234 deletions(-) diff --git a/assimilate/assimilate.py b/assimilate/assimilate.py index 88d7b94..9795b0c 100644 --- a/assimilate/assimilate.py +++ b/assimilate/assimilate.py @@ -180,6 +180,12 @@ def initialize(self, name, settings): sub_configs = [name] self.configs = sub_configs + comment( + config = name, + sub_configs = ', '.join(sub_configs), + template = ("config: {config} => ({subconfigs})", "config: {config}") + ) + if self.composite_config_response == "first": self.remaining_configs = sub_configs[0:1] elif self.composite_config_response == "none": @@ -508,12 +514,12 @@ def resolve_patterns(self, borg_opts, skip_checks=False): patterns, roots, self.working_dir, "patterns", skip_checks=skip_checks ): - borg_opts.extend(["--pattern", pattern]) + borg_opts.append(f"--pattern={pattern}") excludes = self.values("excludes") if excludes: for exclude in check_excludes(excludes, roots, "excludes"): - borg_opts.extend(["--exclude", exclude]) + borg_opts.append(f"--exclude={exclude}") patterns_froms = self.as_paths("patterns_from", must_exist=True) if patterns_froms: @@ -521,13 +527,13 @@ def resolve_patterns(self, borg_opts, skip_checks=False): patterns_froms, roots, self.working_dir, skip_checks=skip_checks ) for patterns_from in patterns_froms: - borg_opts.extend(["--patterns-from", patterns_from]) + borg_opts.append(f"--patterns-from={patterns_from}") exclude_froms = self.as_paths("exclude_from", must_exist=True) if exclude_froms: check_excludes_files(exclude_froms, roots) for exclude_from in exclude_froms: - borg_opts.extend(["--exclude-from", exclude_from]) + borg_opts.append(f"--exclude-from={exclude_from}") if not skip_checks: check_roots(roots, self.working_dir) @@ -613,8 +619,7 @@ def borg_options(self, cmd, borg_opts, assimilate_opts, strip_archive_matcher): val = self.value(name) if val: if name == "match_archives": - if '--match-archives': - borg_opts.extend([f"{opt}={v.strip()!s}" for v in self.value(name)]) + borg_opts.extend([f"{opt}={v.strip()!s}" for v in val]) elif "arg" in attrs and attrs["arg"]: borg_opts.append(f"{opt}={val!s}") else: @@ -915,10 +920,10 @@ def __enter__(self): if "archive" not in self.settings: self.settings["archive"] = "{host_name}-{user_name}-{config_name}-{{now}}" archive = self.settings["archive"] - if "match_archives" not in self.settings: - match_archives = archive.replace('{{now}}', '*') - match_archives = match_archives.replace('{{utcnow}}', '*') - self.settings["match_archives"] = ['sh:' + match_archives] + match_archives = archive.replace('{{now}}', '*') + match_archives = match_archives.replace('{{utcnow}}', '*') + self.settings["match_archives"] = ['sh:' + match_archives] + self.match_local_archives = 'sh:' + match_archives match_archives = self.settings["match_archives"] for ma in match_archives: prefix, _, identifier = ma.partition(':') diff --git a/assimilate/command.py b/assimilate/command.py index 79102c0..53bf125 100644 --- a/assimilate/command.py +++ b/assimilate/command.py @@ -25,7 +25,6 @@ from textwrap import dedent, fill import arrow from contextlib import contextmanager -from docopt import docopt from inform import ( Color, Error, @@ -55,7 +54,7 @@ Cmd, Run, cwd, lsd, mkdir, rm, set_prefs as set_shlib_prefs, split_cmd, to_path ) from .utilities import ( - gethostname, output, pager, read_latest, table, two_columns, + gethostname, output, pager, process_cmdline, read_latest, table, two_columns, update_latest, when, ) @@ -193,7 +192,12 @@ def desc_and_id(archive): return desc_and_id(archive) # archive_filter_options() {{{2 -def archive_filter_options(given_options): +def archive_filter_options(settings, given_options, default): + archive = "--archive" in given_options and given_options["--archive"] + if archive: + archive, description = find_archive(settings, given_options) + return [f"--match-archives={archive}"] + processed_options = [] age_opts = ('--older', '--oldest', '--newer', '--newest') seen = [] @@ -218,6 +222,12 @@ def archive_filter_options(given_options): if given_options.get('--deleted'): processed_options.append('--deleted') + + if not processed_options: + if default == "latest": + processed_options = ['--last=1'] + elif default != 'all': + raise NotImplementedError return processed_options @@ -448,7 +458,7 @@ class BorgCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args, options_first=True) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args, options_first=True) borg_args = cmdline[""] # run borg @@ -481,7 +491,7 @@ class BreakLockCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - docopt(cls.USAGE, argv=[command] + args) + process_cmdline(cls.USAGE, argv=[command] + args) # run borg borg = settings.run_borg( @@ -516,7 +526,7 @@ class CheckCommand(Command): newest-range -O, --oldest only consider archives between oldest and oldest+range - -A, --all check all available archives + -*, --all check all available archives -e, --include-external check all archives in repository, not just those associated with this configuration -r, --repair attempt to repair any inconsistencies found @@ -539,7 +549,7 @@ class CheckCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) check_all = cmdline["--all"] include_external_archives = cmdline["--include-external"] verify = ["--verify-data"] if cmdline["--verify-data"] else [] @@ -550,14 +560,7 @@ def run(cls, command, args, settings, options): os.environ['BORG_CHECK_I_KNOW_WHAT_I_AM_DOING'] = 'YES' # identify archive or archives to check - borg_opts = archive_filter_options(cmdline) - if not borg_opts: - if check_all: - archive = None - else: - archive, description = find_archive(settings, cmdline) - if description: - display(f'archive: {description}') + borg_opts = archive_filter_options(settings, cmdline, default='latest') # run borg borg = settings.run_borg( @@ -611,7 +614,7 @@ class CompactCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) borg_opts = [] if cmdline["--progress"] or settings.show_progress: borg_opts.append("--progress") @@ -701,7 +704,7 @@ class CompareCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) mount_point = settings.as_path("default_mount_point") if not mount_point: raise Error("must specify default_mount_point setting to use this command.") @@ -823,7 +826,7 @@ class ConfigsCommand(Command): @classmethod def run(cls, command, args, settings, options): # check command line for errors - docopt(cls.USAGE, argv=[command] + args) + process_cmdline(cls.USAGE, argv=[command] + args) configs = list(settings.configs) if settings.composite_configs: @@ -875,7 +878,7 @@ def run(cls, command, args, settings, options): repo_size = None # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) borg_opts = [] show_stats = cmdline["--stats"] or settings.show_stats if cmdline["--list"]: @@ -1073,18 +1076,13 @@ class DeleteCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) - borg_opts = archive_filter_options(cmdline) - if not borg_opts: - archive, description = find_archive(settings, cmdline) - if description: - display(f'archive: {description}') + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) + borg_opts = archive_filter_options(settings, cmdline, default='latest') list_opt = ['--list'] if 'dry-run' in options else [] # run borg borg = settings.run_borg( cmd = "delete", - args = [archive], assimilate_opts = options, borg_opts = borg_opts + list_opt, strip_archive_matcher = True, @@ -1142,7 +1140,7 @@ class DiffCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) archive1 = cmdline[""] archive2 = cmdline[""] path = cmdline[''] @@ -1257,7 +1255,7 @@ class DueCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) email = cmdline["--email"] config = settings.config_name since_backup_thresh = cmdline.get("--since-backup") @@ -1395,7 +1393,7 @@ def save_message(cmd): @classmethod def run_late(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) email = cmdline["--email"] # determine whether to give message for oldest or all configs @@ -1529,7 +1527,7 @@ class ExtractCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) paths = cmdline[""] borg_opts = [] if cmdline["--list"]: @@ -1590,7 +1588,7 @@ class HelpCommand(Command): @classmethod def run_early(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) from .help import HelpMessage @@ -1631,7 +1629,7 @@ class InfoCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) fast = cmdline["--fast"] if cmdline["--archive"]: archive, description = find_archive(settings, cmdline) @@ -1770,7 +1768,7 @@ class ListCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) path = cmdline[""] recursive = cmdline["--recursive"] @@ -1968,7 +1966,7 @@ class LogCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - docopt(cls.USAGE, argv=[command] + args) + process_cmdline(cls.USAGE, argv=[command] + args) try: pager(settings.logfile.read_text()) @@ -2043,7 +2041,7 @@ class MountCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) mount_point = cmdline[""] if mount_point: mount_point = settings.to_path(mount_point, resolve=False) @@ -2052,14 +2050,7 @@ def run(cls, command, args, settings, options): if not mount_point: raise Error("must specify directory to use as mount point.") display("mount point is:", mount_point) - if cmdline["--archive"]: - borg_opts = [f"--match-archives={cmdline['--archive']}"] - else: - borg_opts = archive_filter_options(cmdline) - if not borg_opts: - archive, description = find_archive(settings, cmdline) - if description: - display(f'archive: {description}') + borg_opts = archive_filter_options(settings, cmdline, default='all') include_external_archives = cmdline["--include-external"] # create mount point if it does not exist @@ -2099,7 +2090,7 @@ class OverdueCommand(Command): @classmethod def run_early(cls, command, args, settings, options): - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) informer = get_informer() prev_stream_policy = informer.stream_policy if cmdline['--nt']: @@ -2140,7 +2131,7 @@ class PruneCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) include_external_archives = cmdline["--include-external"] borg_opts = [] #KSK if cmdline["--stats"] or settings.show_stats: @@ -2225,7 +2216,7 @@ class RepoCreateCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) borg_opts = [] if cmdline["--reserve"]: try: @@ -2281,14 +2272,15 @@ class RepoListCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) include_external_archives = cmdline["--include-external"] # run borg + borg_opts = archive_filter_options(settings, cmdline, default='all') borg = settings.run_borg( cmd = "repo-list", assimilate_opts = options, - borg_opts = archive_filter_options(cmdline) + ['--json'], + borg_opts = borg_opts + ['--json'], strip_archive_matcher = include_external_archives, ) if not borg.status: @@ -2337,7 +2329,7 @@ class RepoSpaceCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) borg_opts = [] if cmdline["--reserve"]: try: @@ -2421,7 +2413,7 @@ class RestoreCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) paths = cmdline[""] borg_opts = [] if cmdline["--list"]: @@ -2476,7 +2468,7 @@ class SettingsCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) show_available = cmdline["--available"] width = 26 leader = (width+2)*' ' @@ -2572,7 +2564,7 @@ class UmountCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) mount_point = cmdline[""] if mount_point: mount_point = settings.to_path(mount_point, resolve=False) @@ -2637,18 +2629,13 @@ class UndeleteCommand(Command): @classmethod def run(cls, command, args, settings, options): # read command line - cmdline = docopt(cls.USAGE, argv=[command] + args) - borg_opts = archive_filter_options(cmdline) - if not borg_opts: - archive, description = find_archive(settings, cmdline) - if description: - display(f'archive: {description}') + cmdline = process_cmdline(cls.USAGE, argv=[command] + args) + borg_opts = archive_filter_options(settings, cmdline, default='all') list_opt = ['--list'] if 'dry-run' in options else [] # run borg borg = settings.run_borg( cmd = "undelete", - args = [archive], assimilate_opts = options, borg_opts = borg_opts + list_opt, strip_archive_matcher = True, diff --git a/assimilate/main.py b/assimilate/main.py index ca25d72..a7538b2 100644 --- a/assimilate/main.py +++ b/assimilate/main.py @@ -40,15 +40,15 @@ # Imports {{{1 import os import sys -from docopt import docopt from inform import ( Error, Inform, LoggingCache, cull, display, error, os_error, terminate ) from . import __released__, __version__ +from .assimilate import ConfigQueue, Assimilate from .command import Command from .configs import read_settings from .hooks import Hooks -from .assimilate import ConfigQueue, Assimilate +from .utilities import process_cmdline # Globals {{{1 version = f"{__version__} ({__released__})" @@ -85,7 +85,7 @@ def main(): raise Error(os_error(e), codicil="Does the current working directory exist?") # interpret command line - cmdline = docopt(expanded_synopsis, options_first=True, version=version) + cmdline = process_cmdline(expanded_synopsis, options_first=True, version=version) command = cmdline[""] args = cmdline[""] if cmdline["--mute"]: diff --git a/assimilate/utilities.py b/assimilate/utilities.py index 170c87d..8ee38e7 100644 --- a/assimilate/utilities.py +++ b/assimilate/utilities.py @@ -23,9 +23,10 @@ import socket import sys import nestedtext as nt +from docopt import docopt, DocoptExit from inform import ( Error, conjoin, cull, error, full_stop, narrate, os_error, warn, - output as output_raw + output as output_raw, terminate ) from .shlib import Run, set_prefs as set_shlib_prefs set_shlib_prefs(use_inform=True, log_cmd=True) @@ -305,3 +306,11 @@ def table(rows): for row in rows: table.append(' '.join(f"{c:<{cols[i]}}" for i, c in enumerate(row))) return table + +# process_cmdline {{{1 +def process_cmdline(*args, **kwargs): + try: + return docopt(*args, **kwargs) + except DocoptExit as e: + sys.stderr.write(str(e) + '\n') + terminate(3) diff --git a/tests/assimilate.nt b/tests/assimilate.nt index 706e92c..87b3956 100644 --- a/tests/assimilate.nt +++ b/tests/assimilate.nt @@ -230,23 +230,53 @@ assimilate: contains text: Reserve some repository storage space now for emergencies ~/.local/share/assimilate/test.log: - contains regex: ^running command: repo-create$ + contains text: + > running: + > borg \ + > repo-create \ + > --repo=/{run_dir}/REPO/test \ + > --make-parent-dirs \ + > --encryption=none ~/.local/share/assimilate/test.log.nt: contains lines in order: - - > running command: repo-create - - + - > running: + - > borg \ + - > repo-create \ + - > --repo=/{run_dir}/REPO/test \ + - > --make-parent-dirs \ + - > --encryption=none putter — create {{{2: run: assimilate create checks: ~/.local/share/assimilate/test.log: - contains regex: ^running command: create$ + contains text: + > running: + > borg \ + > create \ + > --repo=/{run_dir}/REPO/test \ + > '--pattern=R /{run_dir}' \ + > '--pattern=- /{run_dir}/.cache' \ + > '--pattern=- /{run_dir}/.local' \ + > '--pattern=- /{run_dir}/bu' \ + > '--pattern=- /{run_dir}/REPO' \ + > --stats \ + > '{hostname}-{username}-test-{{now}}' ~/.local/share/assimilate/test.log.nt: contains lines in order: - - > running command: create - - + > > running: + > > borg \ + > > create \ + > > --repo=/{run_dir}/REPO/test \ + > > '--pattern=R /{run_dir}' \ + > > '--pattern=- /{run_dir}/.cache' \ + > > '--pattern=- /{run_dir}/.local' \ + > > '--pattern=- /{run_dir}/bu' \ + > > '--pattern=- /{run_dir}/REPO' \ + > > --stats \ + > > '{hostname}-{username}-test-{{now}}' ~/.local/share/assimilate/test.latest.nt: contains regex: ^create last run: \d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.*$ @@ -271,12 +301,32 @@ assimilate: run: assimilate checks: ~/.local/share/assimilate/test.log: - contains line: running command: create + contains text: + > running: + > borg \ + > create \ + > --repo=/{run_dir}/REPO/test \ + > '--pattern=R /{run_dir}' \ + > '--pattern=- /{run_dir}/.cache' \ + > '--pattern=- /{run_dir}/.local' \ + > '--pattern=- /{run_dir}/bu' \ + > '--pattern=- /{run_dir}/REPO' \ + > --stats \ + > '{hostname}-{username}-test-{{now}}' ~/.local/share/assimilate/test.log.nt: - contains lines in order: - - > running command: create - - + contains text: + > > running: + > > borg \ + > > create \ + > > --repo=/{run_dir}/REPO/test \ + > > '--pattern=R /{run_dir}' \ + > > '--pattern=- /{run_dir}/.cache' \ + > > '--pattern=- /{run_dir}/.local' \ + > > '--pattern=- /{run_dir}/bu' \ + > > '--pattern=- /{run_dir}/REPO' \ + > > --stats \ + > > '{hostname}-{username}-test-{{now}}' ~/.local/share/assimilate/test.latest.nt: contains regex: ^create last run: \d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.*$ @@ -290,15 +340,32 @@ assimilate: > 0 aid:(?P\w+) (?P[^ ]+) .* ~/.local/share/assimilate/test.log: - contains lines in order: - - running command: repo-list - - 'BORG_RELOCATED_REPO_ACCESS_IS_OK': 'YES', + contains text: + > Borg-related environment variables: {{ + > 'BORG_RELOCATED_REPO_ACCESS_IS_OK': 'YES', + > }} + + contains text: + > running: + > borg \ + > repo-list \ + > --json \ + > --repo=/{run_dir}/REPO/test \ + > '--match-archives=sh:{hostname}-{username}-test-*' ~/.local/share/assimilate/test.log.nt: - contains lines in order: - - > running command: repo-list - - > 'BORG_RELOCATED_REPO_ACCESS_IS_OK': 'YES', - - + contains text: + > > Borg-related environment variables: {{ + > > 'BORG_RELOCATED_REPO_ACCESS_IS_OK': 'YES', + > > }} + + contains text: + > > running: + > > borg \ + > > repo-list \ + > > --json \ + > > --repo=/{run_dir}/REPO/test \ + > > '--match-archives=sh:{hostname}-{username}-test-*' ampere — delete {{{2: run: assimilate delete -a {ar1} @@ -307,8 +374,14 @@ assimilate: matches regex: > Done. Run "borg compact" to free space. > + ~/.local/share/assimilate/test.log: - contains line: running command: delete + contains regex: + > running: + > borg \\ + > delete \\ + > --match-archives={hostname}-{username}-test-.* \\ + > --repo=/{run_dir}/REPO/test excludes line: running command: compact bristly — repo-list {{{2: @@ -358,8 +431,22 @@ assimilate: > archive: {aid0} {ar0} .* ~/.local/share/assimilate/test.log: - contains regex: ^running command: list$ - contains regex: ^ aid:{aid0}[a-f0-9]+$ + contains text: + > running: + > borg \ + > repo-list \ + > --repo=/{run_dir}/REPO/test \ + > '--match-archives=sh:{hostname}-{username}-test-*' \ + > --json \ + > --last=1 + contains regex: + > running: + > borg \\ + > list \\ + > --repo=/{run_dir}/REPO/test \\ + > --json-lines \\ + > '--format={{path}}{{type}}' \\ + > aid:{aid0}[a-f0-9]+$ ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -371,12 +458,18 @@ assimilate: run: assimilate break-lock checks: ~/.local/share/assimilate/test.log: - contains regex: ^running command: break-lock$ + contains text: + > running: + > borg \ + > break-lock \ + > --repo=/{run_dir}/REPO/test ~/.local/share/assimilate/test.log.nt: - contains lines in order: - - > running command: break-lock - - + contains text: + > > running: + > > borg \ + > > break-lock \ + > > --repo=/{run_dir}/REPO/test rafter — prune : run: assimilate prune @@ -393,12 +486,18 @@ assimilate: run: assimilate compact checks: ~/.local/share/assimilate/test.log: - contains regex: ^running command: compact$ + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test ~/.local/share/assimilate/test.log.nt: - contains lines in order: - - > running command: compact - - + contains text: + > > running: + > > borg \ + > > compact \ + > > --repo=/{run_dir}/REPO/test ~/.local/share/assimilate/test.latest.nt: contains regex: ^compact last run: \d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.*$ @@ -407,16 +506,23 @@ assimilate: pullet — check {{{2: run: assimilate check checks: - stderr: - matches regex: ^archive.* - ~/.local/share/assimilate/test.log: - contains regex: ^running command: check$ + contains text: + > running: + > borg \ + > check \ + > --last=1 \ + > --repo=/{run_dir}/REPO/test \ + > '--match-archives=sh:{hostname}-{username}-test-*' ~/.local/share/assimilate/test.log.nt: - contains lines in order: - - > running command: check - - + contains text: + > > running: + > > borg \ + > > check \ + > > --last=1 \ + > > --repo=/{run_dir}/REPO/test \ + > > '--match-archives=sh:{hostname}-{username}-test-*' ~/.local/share/assimilate/test.latest.nt: contains regex: ^check last run: \d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.*$ @@ -761,7 +867,13 @@ assimilate: contains text: Reserve some repository storage space now for emergencies ~/.local/share/assimilate/test.log: - contains regex: ^running command: repo-create$ + contains text: + > running: + > borg \ + > repo-create \ + > --repo=/{run_dir}/REPO/test \ + > --make-parent-dirs \ + > --encryption=none ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -778,13 +890,27 @@ assimilate: > test check never run. ~/.local/share/assimilate/test.log.nt: - excludes line: > running command: due + excludes line: > running command: due - fuxme clammy — create {{{2: run: assimilate create checks: ~/.local/share/assimilate/test.log: - contains regex: ^running command: create$ + contains text: + > running: + > borg \ + > create \ + > --repo=/{run_dir}/REPO/test \ + > '--pattern=R /{run_dir}' \ + > '--pattern=- /{run_dir}/.cache' \ + > '--pattern=- /{run_dir}/.local' \ + > '--pattern=- /{run_dir}/bu' \ + > '--pattern=- /{run_dir}/REPO' \ + > --stats \ + > --exclude-caches \ + > --exclude-nodump \ + > --exclude-if-present=.nobackup \ + > '{hostname}-{username}-test-{{now}}' ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -800,7 +926,43 @@ assimilate: run: assimilate checks: ~/.local/share/assimilate/test.log: - contains line: running command: create + contains text: + > running: + > borg \ + > create \ + > --repo=/{run_dir}/REPO/test \ + > '--pattern=R /{run_dir}' \ + > '--pattern=- /{run_dir}/.cache' \ + > '--pattern=- /{run_dir}/.local' \ + > '--pattern=- /{run_dir}/bu' \ + > '--pattern=- /{run_dir}/REPO' \ + > --stats \ + > --exclude-caches \ + > --exclude-nodump \ + > --exclude-if-present=.nobackup \ + > '{hostname}-{username}-test-{{now}}' + contains text: + > running: + > borg \ + > check \ + > --last=1 \ + > --repo=/{run_dir}/REPO/test \ + > '--match-archives=sh:{hostname}-{username}-test-*' + contains text: + > running: + > borg \ + > prune \ + > --repo=/{run_dir}/REPO/test \ + > --keep-within=1d \ + > --keep-daily=7 \ + > --keep-weekly=4 \ + > --keep-monthly=6 \ + > '--match-archives=sh:{hostname}-{username}-test-*' + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -819,7 +981,13 @@ assimilate: > 0 aid:(?P\w+) (?P[^ ]+) .* ~/.local/share/assimilate/test.log: - contains regex: ^running command: repo-list$ + contains text: + > running: + > borg \ + > repo-list \ + > --json \ + > --repo=/{run_dir}/REPO/test \ + > '--match-archives=sh:{hostname}-{username}-test-*' ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -834,7 +1002,12 @@ assimilate: > There is [0-9.]+ MB reserved space in this repository now. ~/.local/share/assimilate/test.log: - contains regex: ^running command: repo-space$ + contains text: + > running: + > borg \ + > repo-space \ + > --reserve=1048576 \ + > --repo=/{run_dir}/REPO/test ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -850,7 +1023,12 @@ assimilate: > Freed [0-9.]+ MB in repository. ~/.local/share/assimilate/test.log: - contains regex: ^running command: repo-space$ + contains text: + > running: + > borg \ + > repo-space \ + > --free \ + > --repo=/{run_dir}/REPO/test ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -949,8 +1127,22 @@ assimilate: > archive: {aid0} {ar0} .* ~/.local/share/assimilate/test.log: - contains regex: ^running command: list$ - contains regex: ^ aid:{aid0}[a-f0-9]+$ + contains text: + > running: + > borg \ + > repo-list \ + > --repo=/{run_dir}/REPO/test \ + > '--match-archives=sh:{hostname}-{username}-test-*' \ + > --json \ + > --last=1 + contains text: + > running: + > borg \ + > list \ + > --repo=/{run_dir}/REPO/test \ + > --json-lines \ + > '--format={{path}}{{type}}' \ + > aid:{aid0} ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -971,8 +1163,14 @@ assimilate: - {run_dir}/b ~/.local/share/assimilate/test.log: - contains regex: ^running command: list$ - contains regex: ^ aid:{aid1} + contains text: + > running: + > borg \ + > list \ + > --repo=/{run_dir}/REPO/test \ + > --json-lines \ + > '--format={{path}}{{type}}' \ + > aid:{aid1} ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -984,7 +1182,11 @@ assimilate: run: assimilate break-lock checks: ~/.local/share/assimilate/test.log: - contains regex: ^running command: break-lock$ + contains text: + > running: + > borg \ + > break-lock \ + > --repo=/{run_dir}/REPO/test ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -995,12 +1197,38 @@ assimilate: run: assimilate prune checks: ~/.local/share/assimilate/test.log: - contains regex: ^running command: prune$ + contains text: + > running: + > borg \ + > prune \ + > --repo=/{run_dir}/REPO/test \ + > --keep-within=1d \ + > --keep-daily=7 \ + > --keep-weekly=4 \ + > --keep-monthly=6 \ + > '--match-archives=sh:{hostname}-{username}-test-*' + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test ~/.local/share/assimilate/test.log.nt: - contains lines in order: - - > running command: prune - - + contains text: + > > running: + > > borg \ + > > prune \ + > > --repo=/{run_dir}/REPO/test \ + > > --keep-within=1d \ + > > --keep-daily=7 \ + > > --keep-weekly=4 \ + > > --keep-monthly=6 \ + > > '--match-archives=sh:{hostname}-{username}-test-*' + contains text: + > > running: + > > borg \ + > > compact \ + > > --repo=/{run_dir}/REPO/test ~/.local/share/assimilate/test.latest.nt: contains regex: ^prune last run: \d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.*$ @@ -1009,7 +1237,11 @@ assimilate: run: assimilate compact checks: ~/.local/share/assimilate/test.log: - contains regex: ^running command: compact$ + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -1023,16 +1255,23 @@ assimilate: exult — check {{{2: run: assimilate check checks: - stderr: - matches regex: ^archive.* - ~/.local/share/assimilate/test.log: - contains regex: ^running command: check$ + contains text: + > running: + > borg \ + > check \ + > --last=1 \ + > --repo=/{run_dir}/REPO/test \ + > '--match-archives=sh:{hostname}-{username}-test-*' ~/.local/share/assimilate/test.log.nt: - contains lines in order: - - > running command: check - - + contains text: + > > running: + > > borg \ + > > check \ + > > --last=1 \ + > > --repo=/{run_dir}/REPO/test \ + > > '--match-archives=sh:{hostname}-{username}-test-*' ~/.local/share/assimilate/test.latest.nt: contains regex: ^check last run: \d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.*$ @@ -1090,13 +1329,32 @@ assimilate: run: assimilate mount checks: stderr: - matches regex: - > mount point is: /{run_dir}/ASSIMILATE - > archive: {aid0} {ar0} .* + matches regex: mount point is: /{run_dir}/ASSIMILATE + + ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > mount \ + > --repo=/{run_dir}/REPO/test \ + > '--match-archives=sh:{hostname}-{username}-test-*' \ + > /{run_dir}/ASSIMILATE + + ~/.local/share/assimilate/test.log.nt: + contains text: + > > running: + > > borg \ + > > mount \ + > > --repo=/{run_dir}/REPO/test \ + > > '--match-archives=sh:{hostname}-{username}-test-*' \ + > > /{run_dir}/ASSIMILATE + ~/ASSIMILATE/{ar1}/{run_dir}/a: matches text: aaa + ~/ASSIMILATE/{ar1}/{run_dir}/b: matches text: bbb + ~/ASSIMILATE/{ar0}/{run_dir}/a: matches text: aaa @@ -1143,8 +1401,8 @@ assimilate: > running: > borg \ > delete \ - > --repo=/{run_dir}/REPO/test \ - > aid:{aid1} + > --match-archives=aid:{aid1} \ + > --repo=/{run_dir}/REPO/test contains text: > running: @@ -1170,7 +1428,13 @@ assimilate: > 0 aid:(?P\w+) (?P[^ ]+) .* ~/.local/share/assimilate/test.log: - contains regex: ^running command: repo-list$ + contains text: + > running: + > borg \ + > repo-list \ + > --json \ + > --repo=/{run_dir}/REPO/test \ + > '--match-archives=sh:{hostname}-{username}-test-*' ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -1342,7 +1606,19 @@ assimilate: contains text: Reserve some repository storage space now for emergencies ~/.local/share/assimilate/test.log: - contains regex: ^running command: repo-create$ + contains text: + > Borg-related environment variables: {{ + > 'BORG_PASSPHRASE': '❬redacted❭', + > 'BORG_DISPLAY_PASSPHRASE': 'no', + > }} + excludes text: roadhouse pause govern parry + contains text: + > running: + > borg \ + > repo-create \ + > --repo=/{run_dir}/REPO/test \ + > --make-parent-dirs \ + > --encryption=repokey-blake2-chacha20-poly1305 ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -1365,7 +1641,50 @@ assimilate: run: assimilate create checks: ~/.local/share/assimilate/test.log: - contains regex: ^running command: create$ + contains text: + > Borg-related environment variables: {{ + > 'BORG_PASSPHRASE': '❬redacted❭', + > 'BORG_DISPLAY_PASSPHRASE': 'no', + > }} + excludes text: roadhouse pause govern parry + contains text: + > running: + > borg \ + > create \ + > --repo=/{run_dir}/REPO/test \ + > '--pattern=R /{run_dir}' \ + > '--pattern=- /{run_dir}/.cache' \ + > '--pattern=- /{run_dir}/.local' \ + > '--pattern=- /{run_dir}/bu' \ + > '--pattern=- /{run_dir}/REPO' \ + > --stats \ + > --compression=zstd,1 \ + > --exclude-caches \ + > --exclude-nodump \ + > --exclude-if-present=.nobackup \ + > test + contains text: + > running: + > borg \ + > check \ + > --last=1 \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test + contains text: + > running: + > borg \ + > prune \ + > --repo=/{run_dir}/REPO/test \ + > --keep-within=1d \ + > --keep-daily=7 \ + > --keep-weekly=4 \ + > --keep-monthly=6 \ + > --match-archives=sh:test + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -1385,7 +1704,50 @@ assimilate: run: assimilate checks: ~/.local/share/assimilate/test.log: - contains line: running command: create + contains text: + > Borg-related environment variables: {{ + > 'BORG_PASSPHRASE': '❬redacted❭', + > 'BORG_DISPLAY_PASSPHRASE': 'no', + > }} + excludes text: roadhouse pause govern parry + contains text: + > running: + > borg \ + > create \ + > --repo=/{run_dir}/REPO/test \ + > '--pattern=R /{run_dir}' \ + > '--pattern=- /{run_dir}/.cache' \ + > '--pattern=- /{run_dir}/.local' \ + > '--pattern=- /{run_dir}/bu' \ + > '--pattern=- /{run_dir}/REPO' \ + > --stats \ + > --compression=zstd,1 \ + > --exclude-caches \ + > --exclude-nodump \ + > --exclude-if-present=.nobackup \ + > test + contains text: + > running: + > borg \ + > check \ + > --last=1 \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test + contains text: + > running: + > borg \ + > prune \ + > --repo=/{run_dir}/REPO/test \ + > --keep-within=1d \ + > --keep-daily=7 \ + > --keep-weekly=4 \ + > --keep-monthly=6 \ + > --match-archives=sh:test + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -1404,7 +1766,19 @@ assimilate: > 0 aid:(?P\w+) (?P[^ ]+) .* ~/.local/share/assimilate/test.log: - contains regex: ^running command: repo-list$ + contains text: + > Borg-related environment variables: {{ + > 'BORG_PASSPHRASE': '❬redacted❭', + > 'BORG_DISPLAY_PASSPHRASE': 'no', + > }} + excludes text: roadhouse pause govern parry + contains text: + > running: + > borg \ + > repo-list \ + > --json \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -1436,7 +1810,17 @@ assimilate: > Security dir: /{run_dir}/.local/share/borg/security/[a-f0-9]+ ~/.local/share/assimilate/test.log: - contains regex: ^running command: info$ + contains text: + > Borg-related environment variables: {{ + > 'BORG_PASSPHRASE': '❬redacted❭', + > 'BORG_DISPLAY_PASSPHRASE': 'no', + > }} + excludes text: roadhouse pause govern parry + contains text: + > running: + > borg \ + > repo-info \ + > --repo=/{run_dir}/REPO/test ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -1461,8 +1845,28 @@ assimilate: > archive: {aid0} {ar0} .* ~/.local/share/assimilate/test.log: - contains regex: ^running command: list$ - contains regex: ^ aid:{aid0}[a-f0-9]+$ + contains text: + > Borg-related environment variables: {{ + > 'BORG_PASSPHRASE': '❬redacted❭', + > 'BORG_DISPLAY_PASSPHRASE': 'no', + > }} + excludes text: roadhouse pause govern parry + contains text: + > running: + > borg \ + > repo-list \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test \ + > --json \ + > --last=1 + contains text: + > running: + > borg \ + > list \ + > --repo=/{run_dir}/REPO/test \ + > --json-lines \ + > '--format={{path}}{{type}}' \ + > aid:{aid0} ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -1483,8 +1887,14 @@ assimilate: - {run_dir}/b ~/.local/share/assimilate/test.log: - contains regex: ^running command: list$ - contains regex: ^ aid:{aid1} + contains text: + > running: + > borg \ + > list \ + > --repo=/{run_dir}/REPO/test \ + > --json-lines \ + > '--format={{path}}{{type}}' \ + > aid:{aid1} ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -1496,7 +1906,17 @@ assimilate: run: assimilate break-lock checks: ~/.local/share/assimilate/test.log: - contains regex: ^running command: break-lock$ + contains text: + > Borg-related environment variables: {{ + > 'BORG_PASSPHRASE': '❬redacted❭', + > 'BORG_DISPLAY_PASSPHRASE': 'no', + > }} + excludes text: roadhouse pause govern parry + contains text: + > running: + > borg \ + > break-lock \ + > --repo=/{run_dir}/REPO/test ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -1507,7 +1927,27 @@ assimilate: run: assimilate prune checks: ~/.local/share/assimilate/test.log: - contains regex: ^running command: prune$ + contains text: + > Borg-related environment variables: {{ + > 'BORG_PASSPHRASE': '❬redacted❭', + > 'BORG_DISPLAY_PASSPHRASE': 'no', + > }} + excludes text: roadhouse pause govern parry + contains text: + > running: + > borg \ + > prune \ + > --repo=/{run_dir}/REPO/test \ + > --keep-within=1d \ + > --keep-daily=7 \ + > --keep-weekly=4 \ + > --keep-monthly=6 \ + > --match-archives=sh:test + contains text: + > running: + > borg \ + > compact \ + > --repo=/tmp/pytest-of-ken/pytest-0/test_assimilate_4_0/REPO/test ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -1521,7 +1961,17 @@ assimilate: run: assimilate compact checks: ~/.local/share/assimilate/test.log: - contains regex: ^running command: compact$ + contains text: + > Borg-related environment variables: {{ + > 'BORG_PASSPHRASE': '❬redacted❭', + > 'BORG_DISPLAY_PASSPHRASE': 'no', + > }} + excludes text: roadhouse pause govern parry + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -1535,9 +1985,6 @@ assimilate: waggle — check {{{2: run: assimilate check --repair checks: - stderr: - matches regex: ^archive.* - # stdout: # matches text: # > This is a potentially dangerous function. @@ -1548,12 +1995,29 @@ assimilate: # sometimes borg prints this message, and some times it does not. ~/.local/share/assimilate/test.log: - contains regex: ^running command: check$ + contains text: + > Borg-related environment variables: {{ + > 'BORG_CHECK_I_KNOW_WHAT_I_AM_DOING': 'YES', + > 'BORG_PASSPHRASE': '❬redacted❭', + > 'BORG_DISPLAY_PASSPHRASE': 'no', + > }} + excludes text: roadhouse pause govern parry + contains text: + > running: + > borg \ + > check \ + > --last=1 \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test ~/.local/share/assimilate/test.log.nt: - contains lines in order: - - > running command: check - - + contains text: + > > running: + > > borg \ + > > check \ + > > --last=1 \ + > > --repo=/{run_dir}/REPO/test \ + > > --match-archives=sh:test ~/.local/share/assimilate/test.latest.nt: contains regex: ^check last run: \d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.*$ @@ -1613,13 +2077,38 @@ assimilate: run: assimilate mount checks: stderr: - matches regex: - > mount point is: /{run_dir}/ASSIMILATE - > archive: {aid0} {ar0} .* + matches regex: mount point is: /{run_dir}/ASSIMILATE + + ~/.local/share/assimilate/test.log: + contains text: + > Borg-related environment variables: {{ + > 'BORG_PASSPHRASE': '❬redacted❭', + > 'BORG_DISPLAY_PASSPHRASE': 'no', + > }} + excludes text: roadhouse pause govern parry + contains text: + > running: + > borg \ + > mount \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test \ + > /{run_dir}/ASSIMILATE + + ~/.local/share/assimilate/test.log.nt: + contains text: + > > running: + > > borg \ + > > mount \ + > > --repo=/{run_dir}/REPO/test \ + > > --match-archives=sh:test \ + > > /{run_dir}/ASSIMILATE + ~/ASSIMILATE/{ar1}-{aid1}/{run_dir}/a: matches text: aaa + ~/ASSIMILATE/{ar1}-{aid1}/{run_dir}/b: matches text: bbb + ~/ASSIMILATE/{ar0}-{aid0}/{run_dir}/a: matches text: aaa @@ -1627,7 +2116,18 @@ assimilate: run: assimilate umount checks: ~/.local/share/assimilate/test.log: - contains regex: ^running command: umount$ + contains text: + > Borg-related environment variables: {{ + > 'BORG_PASSPHRASE': '❬redacted❭', + > 'BORG_DISPLAY_PASSPHRASE': 'no', + > }} + excludes text: roadhouse pause govern parry + contains text: + > running: + > borg \ + > umount \ + > --repo=/{run_dir}/REPO/test \ + > /{run_dir}/ASSIMILATE ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -1658,7 +2158,24 @@ assimilate: run: assimilate delete -a aid:{aid1} checks: ~/.local/share/assimilate/test.log: - contains regex: ^running command: delete$ + contains text: + > Borg-related environment variables: {{ + > 'BORG_PASSPHRASE': '❬redacted❭', + > 'BORG_DISPLAY_PASSPHRASE': 'no', + > }} + excludes text: roadhouse pause govern parry + contains text: + > running: + > borg \ + > delete \ + > --match-archives=aid:{aid1} \ + > --repo=/{run_dir}/REPO/test + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test + ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -1677,7 +2194,19 @@ assimilate: > 0 aid:(?P\w+) (?P[^ ]+) .* ~/.local/share/assimilate/test.log: - contains regex: ^running command: repo-list$ + contains text: + > Borg-related environment variables: {{ + > 'BORG_PASSPHRASE': '❬redacted❭', + > 'BORG_DISPLAY_PASSPHRASE': 'no', + > }} + excludes text: roadhouse pause govern parry + contains text: + > running: + > borg \ + > repo-list \ + > --json \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -1775,7 +2304,13 @@ assimilate: > === test2 === ~/.local/share/assimilate/test1.log: - contains regex: ^running command: repo-create$ + contains text: + > running: + > borg \ + > repo-create \ + > --repo=/{run_dir}/REPO/test1 \ + > --make-parent-dirs \ + > --encryption=repokey-blake2-chacha20-poly1305 ~/.local/share/assimilate/test1.log.nt: contains lines in order: @@ -1783,7 +2318,13 @@ assimilate: - ~/.local/share/assimilate/test2.log: - contains regex: ^running command: repo-create$ + contains text: + > running: + > borg \ + > repo-create \ + > --repo=/{run_dir}/REPO/test2 \ + > --make-parent-dirs \ + > --encryption=repokey-blake2-chacha20-poly1305 ~/.local/share/assimilate/test2.log.nt: contains lines in order: @@ -1819,7 +2360,48 @@ assimilate: > === test2 === ~/.local/share/assimilate/test1.log: - contains regex: ^running command: create$ + contains text: + > Borg-related environment variables: {{ + > 'BORG_PASSCOMMAND': 'echo "roadhouse pause govern parry"', + > }} + contains text: + > running: + > borg \ + > create \ + > --repo=/{run_dir}/REPO/test1 \ + > '--pattern=R /{run_dir}' \ + > '--pattern=- /{run_dir}/.cache' \ + > '--pattern=- /{run_dir}/.local' \ + > '--pattern=- /{run_dir}/bu' \ + > '--pattern=- /{run_dir}/REPO' \ + > --stats \ + > --compression=zstd,1 \ + > --exclude-caches \ + > --exclude-nodump \ + > --exclude-if-present=.nobackup \ + > test1 + contains text: + > running: + > borg \ + > check \ + > --last=1 \ + > --repo=/{run_dir}/REPO/test1 \ + > --match-archives=sh:test1 + contains text: + > running: + > borg \ + > prune \ + > --repo=/{run_dir}/REPO/test1 \ + > --keep-within=1d \ + > --keep-daily=7 \ + > --keep-weekly=4 \ + > --keep-monthly=6 \ + > --match-archives=sh:test1 + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test1 ~/.local/share/assimilate/test1.log.nt: contains lines in order: @@ -1830,7 +2412,48 @@ assimilate: contains regex: ^create last run: \d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.*$ ~/.local/share/assimilate/test2.log: - contains regex: ^running command: create$ + contains text: + > Borg-related environment variables: {{ + > 'BORG_PASSCOMMAND': 'echo "roadhouse pause govern parry"', + > }} + contains text: + > running: + > borg \ + > create \ + > --repo=/{run_dir}/REPO/test2 \ + > '--pattern=R /{run_dir}' \ + > '--pattern=- /{run_dir}/.cache' \ + > '--pattern=- /{run_dir}/.local' \ + > '--pattern=- /{run_dir}/bu' \ + > '--pattern=- /{run_dir}/REPO' \ + > --stats \ + > --compression=zstd,1 \ + > --exclude-caches \ + > --exclude-nodump \ + > --exclude-if-present=.nobackup \ + > test2 + contains text: + > running: + > borg \ + > check \ + > --last=1 \ + > --repo=/{run_dir}/REPO/test2 \ + > --match-archives=sh:test2 + contains text: + > running: + > borg \ + > prune \ + > --repo=/{run_dir}/REPO/test2 \ + > --keep-within=1d \ + > --keep-daily=7 \ + > --keep-weekly=4 \ + > --keep-monthly=6 \ + > --match-archives=sh:test2 + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test2 ~/.local/share/assimilate/test2.log.nt: contains lines in order: @@ -1850,8 +2473,44 @@ assimilate: run: assimilate -q checks: ~/.local/share/assimilate/test1.log: - contains lines in order: - - running command: create + contains text: + > running: + > borg \ + > create \ + > --repo=/{run_dir}/REPO/test1 \ + > '--pattern=R /{run_dir}' \ + > '--pattern=- /{run_dir}/.cache' \ + > '--pattern=- /{run_dir}/.local' \ + > '--pattern=- /{run_dir}/bu' \ + > '--pattern=- /{run_dir}/REPO' \ + > --stats \ + > --compression=zstd,1 \ + > --exclude-caches \ + > --exclude-nodump \ + > --exclude-if-present=.nobackup \ + > test1 + contains text: + > running: + > borg \ + > check \ + > --last=1 \ + > --repo=/{run_dir}/REPO/test1 \ + > --match-archives=sh:test1 + contains text: + > running: + > borg \ + > prune \ + > --repo=/{run_dir}/REPO/test1 \ + > --keep-within=1d \ + > --keep-daily=7 \ + > --keep-weekly=4 \ + > --keep-monthly=6 \ + > --match-archives=sh:test1 + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test1 ~/.local/share/assimilate/test1.log.nt: contains lines in order: @@ -1862,8 +2521,44 @@ assimilate: contains regex: ^create last run: \d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.*$ ~/.local/share/assimilate/test2.log: - contains lines in order: - - running command: create + contains text: + > running: + > borg \ + > create \ + > --repo=/{run_dir}/REPO/test2 \ + > '--pattern=R /{run_dir}' \ + > '--pattern=- /{run_dir}/.cache' \ + > '--pattern=- /{run_dir}/.local' \ + > '--pattern=- /{run_dir}/bu' \ + > '--pattern=- /{run_dir}/REPO' \ + > --stats \ + > --compression=zstd,1 \ + > --exclude-caches \ + > --exclude-nodump \ + > --exclude-if-present=.nobackup \ + > test2 + contains text: + > running: + > borg \ + > check \ + > --last=1 \ + > --repo=/{run_dir}/REPO/test2 \ + > --match-archives=sh:test2 + contains text: + > running: + > borg \ + > prune \ + > --repo=/{run_dir}/REPO/test2 \ + > --keep-within=1d \ + > --keep-daily=7 \ + > --keep-weekly=4 \ + > --keep-monthly=6 \ + > --match-archives=sh:test2 + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test2 ~/.local/share/assimilate/test2.log.nt: contains lines in order: @@ -1882,7 +2577,13 @@ assimilate: > 0 aid:(?P\w+) (?P[^ ]+) .* ~/.local/share/assimilate/test1.log: - contains line: running command: repo-list + contains text: + > running: + > borg \ + > repo-list \ + > --json \ + > --repo=/{run_dir}/REPO/test1 \ + > --match-archives=sh:test1 ~/.local/share/assimilate/test1.log.nt: contains lines in order: @@ -1903,7 +2604,12 @@ assimilate: > === test2 === ~/.local/share/assimilate/test1.log: - contains line: running command: repo-space + contains text: + > running: + > borg \ + > repo-space \ + > --reserve=1048576 \ + > --repo=/{run_dir}/REPO/test1 ~/.local/share/assimilate/test1.log.nt: contains lines in order: @@ -1911,7 +2617,12 @@ assimilate: - ~/.local/share/assimilate/test2.log: - contains line: running command: repo-space + contains text: + > running: + > borg \ + > repo-space \ + > --reserve=1048576 \ + > --repo=/{run_dir}/REPO/test2 ~/.local/share/assimilate/test2.log.nt: contains lines in order: @@ -1937,7 +2648,12 @@ assimilate: > After that, do not forget to reserve space again for next time! ~/.local/share/assimilate/test1.log: - contains regex: ^running command: repo-space$ + contains text: + > running: + > borg \ + > repo-space \ + > --free \ + > --repo=/{run_dir}/REPO/test1 ~/.local/share/assimilate/test1.log.nt: contains lines in order: @@ -1945,7 +2661,12 @@ assimilate: - ~/.local/share/assimilate/test2.log: - contains regex: ^running command: repo-space$ + contains text: + > running: + > borg \ + > repo-space \ + > --free \ + > --repo=/{run_dir}/REPO/test2 ~/.local/share/assimilate/test2.log.nt: contains lines in order: @@ -1983,14 +2704,17 @@ assimilate: > === test2 === ~/.local/share/assimilate/test1.log: - contains regex: ^running command: info$ + contains text: + > running: + > borg \ + > repo-info \ + > --repo=/{run_dir}/REPO/test1 ~/.local/share/assimilate/test1.log.nt: contains lines in order: - > running command: info - - faucet — list {{{2: run: assimilate list checks: @@ -2010,8 +2734,22 @@ assimilate: > archive: {aid0} {ar0} .* ~/.local/share/assimilate/test1.log: - contains regex: ^running command: list$ - contains regex: ^ aid:{aid0}[a-f0-9]+$ + contains text: + > running: + > borg \ + > repo-list \ + > --repo=/{run_dir}/REPO/test1 \ + > --match-archives=sh:test1 \ + > --json \ + > --last=1 + contains text: + > running: + > borg \ + > list \ + > --repo=/{run_dir}/REPO/test1 \ + > --json-lines \ + > '--format={{path}}{{type}}' \ + > aid:{aid0} ~/.local/share/assimilate/test1.log.nt: contains lines in order: @@ -2033,8 +2771,14 @@ assimilate: - {run_dir}/b ~/.local/share/assimilate/test1.log: - contains regex: ^running command: list$ - contains regex: ^ aid:{aid1} + contains text: + > running: + > borg \ + > list \ + > --repo=/{run_dir}/REPO/test1 \ + > --json-lines \ + > '--format={{path}}{{type}}' \ + > aid:{aid1} ~/.local/share/assimilate/test1.log.nt: contains lines in order: @@ -2060,7 +2804,21 @@ assimilate: > === test2 === ~/.local/share/assimilate/test1.log: - contains regex: ^running command: prune$ + contains text: + > running: + > borg \ + > prune \ + > --repo=/{run_dir}/REPO/test1 \ + > --keep-within=1d \ + > --keep-daily=7 \ + > --keep-weekly=4 \ + > --keep-monthly=6 \ + > --match-archives=sh:test1 + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test1 ~/.local/share/assimilate/test1.log.nt: contains lines in order: @@ -2071,7 +2829,21 @@ assimilate: contains regex: ^prune last run: \d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.*$ ~/.local/share/assimilate/test2.log: - contains regex: ^running command: prune$ + contains text: + > running: + > borg \ + > prune \ + > --repo=/{run_dir}/REPO/test2 \ + > --keep-within=1d \ + > --keep-daily=7 \ + > --keep-weekly=4 \ + > --keep-monthly=6 \ + > --match-archives=sh:test2 + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test2 ~/.local/share/assimilate/test2.log.nt: contains lines in order: @@ -2091,7 +2863,11 @@ assimilate: > === test2 === ~/.local/share/assimilate/test1.log: - contains regex: ^running command: compact$ + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test1 ~/.local/share/assimilate/test1.log.nt: contains lines in order: @@ -2102,7 +2878,11 @@ assimilate: contains regex: ^compact last run: \d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.*$ ~/.local/share/assimilate/test2.log: - contains regex: ^running command: compact$ + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test2 ~/.local/share/assimilate/test2.log.nt: contains lines in order: @@ -2119,35 +2899,53 @@ assimilate: stderr: matches regex: > === test1 === - > ^archive.* > > === test2 === - > ^archive.* ~/.local/share/assimilate/test1.log: - contains regex: ^running command: check$ - - ~/.local/share/assimilate/test1.log.nt: - contains lines in order: - - > running command: check - - - - ~/.local/share/assimilate/test1.latest.nt: - contains regex: ^check last run: \d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.*$ + contains text: + > running: + > borg \ + > check \ + > --last=1 \ + > --repo=/{run_dir}/REPO/test1 \ + > --match-archives=sh:test1 \ + > --verify-data ~/.local/share/assimilate/test2.log: - contains regex: ^running command: check$ + contains text: + > running: + > borg \ + > check \ + > --last=1 \ + > --repo=/{run_dir}/REPO/test2 \ + > --match-archives=sh:test2 \ + > --verify-data + + ~/.local/share/assimilate/test1.log.nt: + contains text: + > > running: + > > borg \ + > > check \ + > > --last=1 \ + > > --repo=/{run_dir}/REPO/test1 \ + > > --match-archives=sh:test1 \ + > > --verify-data ~/.local/share/assimilate/test2.log.nt: - contains lines in order: - - > running command: check - - + contains text: + > > running: + > > borg \ + > > check \ + > > --last=1 \ + > > --repo=/{run_dir}/REPO/test2 \ + > > --match-archives=sh:test2 \ + > > --verify-data - ~/.local/share/assimilate/test2.latest.nt: + ~/.local/share/assimilate/test1.latest.nt: contains regex: ^check last run: \d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.*$ - trestle — compare {{{2: run: assimilate compare checks: @@ -2201,13 +2999,38 @@ assimilate: run: assimilate mount checks: stderr: - matches regex: - > mount point is: /{run_dir}/ASSIMILATE - > archive: {aid0} {ar0} .* + matches regex: mount point is: /{run_dir}/ASSIMILATE + + ~/.local/share/assimilate/test1.log: + contains text: + > running: + > borg \ + > mount \ + > --repo=/{run_dir}/REPO/test1 \ + > --match-archives=sh:test1 \ + > /{run_dir}/ASSIMILATE + + ~/.local/share/assimilate/test1.log.nt: + contains text: + > > running: + > > borg \ + > > mount \ + > > --repo=/{run_dir}/REPO/test1 \ + > > --match-archives=sh:test1 \ + > > /{run_dir}/ASSIMILATE + + ~/.local/share/assimilate/test2.log: + excludes line: running command: mount + + ~/.local/share/assimilate/test2.log.nt: + excludes line: > running command: mount + ~/ASSIMILATE/{ar1}-{aid1}/{run_dir}/a: matches text: aaa + ~/ASSIMILATE/{ar1}-{aid1}/{run_dir}/b: matches text: bbb + ~/ASSIMILATE/{ar0}-{aid0}/{run_dir}/a: matches text: aaa @@ -2215,7 +3038,12 @@ assimilate: run: assimilate umount checks: ~/.local/share/assimilate/test1.log: - contains regex: ^running command: umount$ + contains text: + > running: + > borg \ + > umount \ + > --repo=/{run_dir}/REPO/test1 \ + > /{run_dir}/ASSIMILATE ~/.local/share/assimilate/test1.log.nt: contains lines in order: @@ -2246,7 +3074,17 @@ assimilate: run: assimilate -c test1 delete -a aid:{aid1} checks: ~/.local/share/assimilate/test1.log: - contains regex: ^running command: delete$ + contains text: + > running: + > borg \ + > delete \ + > --match-archives=aid:{aid1} \ + > --repo=/{run_dir}/REPO/test1 + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test1 ~/.local/share/assimilate/test1.log.nt: contains lines in order: @@ -2264,7 +3102,13 @@ assimilate: > 0 aid:(?P\w+) (?P[^ ]+) .* ~/.local/share/assimilate/test1.log: - contains line: running command: repo-list + contains text: + > running: + > borg \ + > repo-list \ + > --json \ + > --repo=/{run_dir}/REPO/test1 \ + > --match-archives=sh:test1 ~/.local/share/assimilate/test1.log.nt: contains lines in order: @@ -2272,7 +3116,7 @@ assimilate: - ~/.local/share/assimilate/test2.log: - excludes line: running command: repo-list + excludes line: running command: repo-list - fuxme ~/.local/share/assimilate/test2.log.nt: excludes line: > running command: repo-list @@ -2338,7 +3182,13 @@ assimilate: contains text: Reserve some repository storage space now for emergencies ~/.local/share/assimilate/test.log: - contains regex: ^running command: repo-create$ + contains text: + > running: + > borg \ + > repo-create \ + > --repo=/{run_dir}/REPO/test \ + > --make-parent-dirs \ + > --encryption=none ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -2349,7 +3199,21 @@ assimilate: run: assimilate create checks: ~/.local/share/assimilate/test.log: - contains regex: ^running command: create$ + contains text: + > running: + > borg \ + > create \ + > --repo=/{run_dir}/REPO/test \ + > '--pattern=R /{run_dir}' \ + > '--pattern=- /{run_dir}/.cache' \ + > '--pattern=- /{run_dir}/.local' \ + > '--pattern=- /{run_dir}/bu' \ + > '--pattern=- /{run_dir}/REPO' \ + > --stats \ + > test + excludes text: check + excludes text: prune + excludes text: compact ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -2363,7 +3227,21 @@ assimilate: run: assimilate checks: ~/.local/share/assimilate/test.log: - contains line: running command: create + contains text: + > running: + > borg \ + > create \ + > --repo=/{run_dir}/REPO/test \ + > '--pattern=R /{run_dir}' \ + > '--pattern=- /{run_dir}/.cache' \ + > '--pattern=- /{run_dir}/.local' \ + > '--pattern=- /{run_dir}/bu' \ + > '--pattern=- /{run_dir}/REPO' \ + > --stats \ + > test + excludes text: check + excludes text: prune + excludes text: compact ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -2377,7 +3255,21 @@ assimilate: run: assimilate checks: ~/.local/share/assimilate/test.log: - contains line: running command: create + contains text: + > running: + > borg \ + > create \ + > --repo=/{run_dir}/REPO/test \ + > '--pattern=R /{run_dir}' \ + > '--pattern=- /{run_dir}/.cache' \ + > '--pattern=- /{run_dir}/.local' \ + > '--pattern=- /{run_dir}/bu' \ + > '--pattern=- /{run_dir}/REPO' \ + > --stats \ + > test + excludes text: check + excludes text: prune + excludes text: compact ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -2391,7 +3283,21 @@ assimilate: run: assimilate checks: ~/.local/share/assimilate/test.log: - contains line: running command: create + contains text: + > running: + > borg \ + > create \ + > --repo=/{run_dir}/REPO/test \ + > '--pattern=R /{run_dir}' \ + > '--pattern=- /{run_dir}/.cache' \ + > '--pattern=- /{run_dir}/.local' \ + > '--pattern=- /{run_dir}/bu' \ + > '--pattern=- /{run_dir}/REPO' \ + > --stats \ + > test + excludes text: check + excludes text: prune + excludes text: compact ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -2405,7 +3311,21 @@ assimilate: run: assimilate checks: ~/.local/share/assimilate/test.log: - contains line: running command: create + contains text: + > running: + > borg \ + > create \ + > --repo=/{run_dir}/REPO/test \ + > '--pattern=R /{run_dir}' \ + > '--pattern=- /{run_dir}/.cache' \ + > '--pattern=- /{run_dir}/.local' \ + > '--pattern=- /{run_dir}/bu' \ + > '--pattern=- /{run_dir}/REPO' \ + > --stats \ + > test + excludes text: check + excludes text: prune + excludes text: compact ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -2426,6 +3346,16 @@ assimilate: > 1 aid:(?P\w+) (?P[^ ]+) .* > 0 aid:(?P\w+) (?P[^ ]+) .* + ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > repo-list \ + > --oldest=1440m \ + > --json \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test + indicate — repo-list --first=3 {{{2: run: assimilate repo-list --first=3 checks: @@ -2435,6 +3365,15 @@ assimilate: > aid:(?P\w+) (?P[^ ]+) .* > aid:(?P\w+) (?P[^ ]+) .* + ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > repo-list \ + > --first=3 \ + > --json \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test stockroom — repo-list --last=3 {{{2: run: assimilate repo-list --last=3 @@ -2445,6 +3384,16 @@ assimilate: > 1 aid:(?P\w+) (?P[^ ]+) .* > 0 aid:(?P\w+) (?P[^ ]+) .* + ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > repo-list \ + > --last=3 \ + > --json \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test + larder — repo-list --oldest=1d {{{2: run: assimilate repo-list --oldest=1d checks: @@ -2456,6 +3405,16 @@ assimilate: > aid:(?P\w+) (?P[^ ]+) .* > aid:(?P\w+) (?P[^ ]+) .* + ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > repo-list \ + > --oldest=1440m \ + > --json \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test + elevate — repo-list --newest=1d {{{2: run: assimilate repo-list --newest=1d checks: @@ -2467,12 +3426,32 @@ assimilate: > aid:(?P\w+) (?P[^ ]+) .* > aid:(?P\w+) (?P[^ ]+) .* + ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > repo-list \ + > --newest=1440m \ + > --json \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test + wrongdoer — repo-list --older=1d {{{2: run: assimilate repo-list --older=1d checks: stdout: matches regex: + ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > repo-list \ + > --older=1440m \ + > --json \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test + climb — repo-list --newer=1d {{{2: run: assimilate repo-list --newer=1d checks: @@ -2484,6 +3463,16 @@ assimilate: > aid:(?P\w+) (?P[^ ]+) .* > aid:(?P\w+) (?P[^ ]+) .* + ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > repo-list \ + > --newer=1440m \ + > --json \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test + parade — list -a 4 {{{2: run: assimilate list -a 4 checks: @@ -2500,6 +3489,18 @@ assimilate: stderr: matches regex: archive: {aid4} {ar4} .* + ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > repo-list \ + > --repo=/{run_dir}/REPO/test + contains text: + > running: + > borg \ + > list \ + > --repo=/{run_dir}/REPO/test + expect — list -a 3 {{{2: run: assimilate list -a 3 .config checks: @@ -2511,6 +3512,18 @@ assimilate: stderr: matches regex: archive: {aid3} {ar3} .* + ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > repo-list \ + > --repo=/{run_dir}/REPO/test + contains text: + > running: + > borg \ + > list \ + > --repo=/{run_dir}/REPO/test + gremlin — list -a 2 {{{2: run: assimilate list --archive 2 --recursive .config checks: @@ -2524,6 +3537,18 @@ assimilate: stderr: matches regex: archive: {aid2} {ar2} .* + ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > repo-list \ + > --repo=/{run_dir}/REPO/test + contains text: + > running: + > borg \ + > list \ + > --repo=/{run_dir}/REPO/test + tombola — list -a 1 {{{2: run: assimilate list -a 1 checks: @@ -2540,6 +3565,18 @@ assimilate: stderr: matches regex: archive: {aid1} {ar1} .* + ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > repo-list \ + > --repo=/{run_dir}/REPO/test + contains text: + > running: + > borg \ + > list \ + > --repo=/{run_dir}/REPO/test + partitive — list -a 0 {{{2: run: assimilate list -a 0 checks: @@ -2556,23 +3593,63 @@ assimilate: stderr: matches regex: archive: {aid0} {ar0} .* + ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > repo-list \ + > --repo=/{run_dir}/REPO/test + contains text: + > running: + > borg \ + > list \ + > --repo=/{run_dir}/REPO/test + outlet — mount ASSIMILATE {{{2: run: assimilate mount /{run_dir}/ASSIMILATE checks: stderr: - matches regex: - > mount point is: /{run_dir}/ASSIMILATE - > archive: {aid0} {ar0} .* + matches regex: mount point is: /{run_dir}/ASSIMILATE + + ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > mount \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test \ + > /{run_dir}/ASSIMILATE + + ~/.local/share/assimilate/test.log.nt: + contains text: + > > running: + > > borg \ + > > mount \ + > > --repo=/{run_dir}/REPO/test \ + > > --match-archives=sh:test \ + > > /{run_dir}/ASSIMILATE + ~/ASSIMILATE/test-{aid1}/{run_dir}/a: matches text: aaa + ~/ASSIMILATE/test-{aid1}/{run_dir}/b: matches text: bbb + ~/ASSIMILATE/test-{aid0}/{run_dir}/a: matches text: aaa virtue — umount ASSIMILATE {{{2: run: assimilate umount /{run_dir}/ASSIMILATE + checks: + ~/.local/share/assimilate/test.log.nt: + contains text: + > > running: + > > borg \ + > > umount \ + > > --repo=/{run_dir}/REPO/test \ + > > /{run_dir}/ASSIMILATE + analytic — single config, src_dirs, relative working_dir {{{1: initialization: create: @@ -2658,7 +3735,14 @@ assimilate: contains text: Reserve some repository storage space now for emergencies ~/.local/share/assimilate/test.log: - contains regex: ^running command: repo-create$ + contains text: + > running: + > borg \ + > repo-create \ + > --repo=/{run_dir}/REPO/test \ + > --make-parent-dirs \ + > --encryption=none + ~/.local/share/assimilate/test.log.nt: contains lines in order: @@ -2690,13 +3774,23 @@ assimilate: > running: > borg \ > check \ + > --last=1 \ > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test contains text: > running: > borg \ > prune \ > --repo=/{run_dir}/REPO/test \ + > --keep-within=1d \ + > --match-archives=sh:test + + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test hectare — create --progress {{{2: run: assimilate create --progress @@ -2706,17 +3800,40 @@ assimilate: > Running Borg create command ... ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > create \ + > --progress \ + > --repo=/{run_dir}/REPO/test \ + > --exclude=.cache \ + > --exclude=.local \ + > --exclude=bu \ + > --exclude=REPO \ + > test \ + > . + contains text: > running: > borg \ > check \ + > --last=1 \ > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test contains text: > running: > borg \ > prune \ > --repo=/{run_dir}/REPO/test \ + > --keep-within=1d \ + > --match-archives=sh:test + + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test malady — create --progress {{{2: run: assimilate create --stats @@ -2728,17 +3845,40 @@ assimilate: > Archive name: test ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > create \ + > --repo=/{run_dir}/REPO/test \ + > --exclude=.cache \ + > --exclude=.local \ + > --exclude=bu \ + > --exclude=REPO \ + > --stats \ + > test \ + > . + contains text: > running: > borg \ > check \ + > --last=1 \ > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test contains text: > running: > borg \ > prune \ > --repo=/{run_dir}/REPO/test \ + > --keep-within=1d \ + > --match-archives=sh:test + + contains text: + > running: + > borg \ + > compact \ + > --repo=/{run_dir}/REPO/test warder — create --fast {{{2: run: assimilate create --fast @@ -2778,17 +3918,47 @@ assimilate: softwood — check --repair {{{2: run: assimilate check --repair checks: - stderr: - contains regex: - > archive: {aid0} {ar0} .* + ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > check \ + > --last=1 \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test \ + > --repair + + ~/.local/share/assimilate/test.log.nt: + contains text: + > > running: + > > borg \ + > > check \ + > > --last=1 \ + > > --repo=/{run_dir}/REPO/test \ + > > --match-archives=sh:test \ + > > --repair vixen — check --verify-data {{{2: run: assimilate check --verify-data checks: - stderr: - matches regex: - > archive: {aid0} {ar0} .* - > + ~/.local/share/assimilate/test.log: + contains text: + > running: + > borg \ + > check \ + > --last=1 \ + > --repo=/{run_dir}/REPO/test \ + > --match-archives=sh:test + + ~/.local/share/assimilate/test.log.nt: + contains text: + > > running: + > > borg \ + > > check \ + > > --last=1 \ + > > --repo=/{run_dir}/REPO/test \ + > > --match-archives=sh:test + valency — compact --progress {{{2: run: assimilate compact --progress @@ -2805,8 +3975,8 @@ assimilate: > running: > borg \ > delete \ - > --repo=/{run_dir}/REPO/test \ - > aid:{aid3} + > --match-archives=aid:{aid3} \ + > --repo=/{run_dir}/REPO/test contains text: > running: @@ -2822,8 +3992,8 @@ assimilate: > running: > borg \ > delete \ - > --repo=/{run_dir}/REPO/test \ - > aid:{aid2} + > --match-archives=aid:{aid2} \ + > --repo=/{run_dir}/REPO/test excludes text: compact respond — due --since-backup ❬since❭ --message ❬msg❭ {{{2: diff --git a/tests/run-only.nt b/tests/run-only.nt index d86aba8..2306d7a 100644 --- a/tests/run-only.nt +++ b/tests/run-only.nt @@ -67,7 +67,7 @@ cases: # {assimilate: {assimilate: {druid:*}}, checks: *} # {assimilate: {assimilate: {shaman:*}}, checks: *} # {assimilate: {assimilate: {beautify:*}}, checks: *} - # {assimilate: {assimilate: {skirting:*}}, checks: *} + # {assimilate: {assimilate: {daemon:*}}, checks: *} # {assimilate: {assimilate: {hornet:*}}, checks: *} # {assimilate: {assimilate: {analytic:*}}, checks: *} # {assimilate: {assimilate: {retract:*}}, checks: *} diff --git a/tests/test_assimilate.py b/tests/test_assimilate.py index e5121f5..32b726d 100644 --- a/tests/test_assimilate.py +++ b/tests/test_assimilate.py @@ -20,6 +20,8 @@ import arrow import os import pytest +import pwd +import socket import re @@ -193,7 +195,10 @@ def check(self, match_type, expected, matches): # expand run_dir and replace matches def expand(s): try: - return s.format(run_dir=run_dir, **matches).rstrip() + return s.format( + run_dir=run_dir, hostname=hostname, username=username, + **matches + ).rstrip() except KeyError as e: raise KeyError(f"{e!s}: needs escaping in:\n{indent(s)}") @@ -280,7 +285,12 @@ def fail_message(self, match, expected=None, issue=None): directory = f"directory: {self.run_dir!s}" if self.run_dir else None match = f"match type: {match}" - if '\n' in expected and 'regex' not in match and 'in order' not in match: + if ( + '\n' in expected and + 'contains' not in match and + 'regex' not in match and + 'in order' not in match + ): new = [] for e, r in zip(expected.splitlines(), realized.splitlines()): okay = '✓' if e == r else '✗' @@ -491,6 +501,16 @@ def add_script(home_dir): path.write_text(SCRIPT.format(home_dir=home_dir)) path.chmod(0o777) +# gethostname {{{1 +def gethostname(): + return socket.gethostname().split(".")[0] +hostname = gethostname() + +# getusername {{{1 +def getusername(): + return pwd.getpwuid(os.getuid()).pw_name +username = getusername() + # MAIN {{{1 @parametrize(