Skip to content

Commit

Permalink
bug: fix compact_after_delete
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Kundert authored and Ken Kundert committed Mar 29, 2022
1 parent db59ec6 commit e809fb3
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install Borg
run: sudo apt install borgbackup
run: sudo apt install borgbackup=1.2.\*
- name: Install packages
run:
python -m pip install --upgrade pip
Expand Down
8 changes: 4 additions & 4 deletions emborg/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,14 +833,14 @@ def run(cls, command, args, settings, options):
if settings.compact_after_delete:
narrate("Compacting repository ...")
compact = CompactCommand()
compact_status = compact.run("compact", args, settings, options)
compact_status = compact.run("compact", [], settings, options)
else:
compact_status = 0

except Error as e:
e.reraise(
codicil = (
f"This error occurred while compacting the repository.",
"This error occurred while compacting the repository.",
"No error was reported while deleting the archive.",
)
)
Expand Down Expand Up @@ -1769,14 +1769,14 @@ def run(cls, command, args, settings, options):
if settings.compact_after_delete:
narrate("Compacting repository ...")
compact = CompactCommand()
compact_status = compact.run("compact", args, settings, options)
compact_status = compact.run("compact", [], settings, options)
else:
compact_status = 0

except Error as e:
e.reraise(
codicil = (
f"This error occurred while compacting the repository.",
"This error occurred while compacting the repository.",
"No error was reported while pruning the repository.",
)
)
Expand Down
2 changes: 1 addition & 1 deletion tests/CONFIGS/settings
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# These settings are common to all configurations
# configurations
configurations = '''
test0 test1 test2 test3 test4 test5 test6 test7 test8
test0 test1 test2 test3 test4 test5 test6 test7 test8 test9
tests=test0,test1,test2,test3
'''

Expand Down
8 changes: 8 additions & 0 deletions tests/CONFIGS/test9
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
patterns = '''
R ~
+ ~/configs
- ~
- fm:*/.viminfo
- ~/**/.*.swp
- **/.*.swo
'''
80 changes: 52 additions & 28 deletions tests/test-cases.nt
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ emborg with configs:
> test6
> test7
> test8
> test9
> tests=test0,test1,test2,test3
>
> Default Configuration:
Expand All @@ -346,7 +347,7 @@ emborg with configs:
> config_dir: '/⟪EMBORG⟫/tests/.config/emborg'
> config_name: 'test0'
> configurations: """
> test0 test1 test2 test3 test4 test5 test6 test7 test8
> test0 test1 test2 test3 test4 test5 test6 test7 test8 test9
> tests=test0,test1,test2,test3
> """
> default_configuration: 'tests'
Expand Down Expand Up @@ -481,6 +482,7 @@ emborg with configs:
> ⟪EMBORG⟫/tests/configs/test7
> ⟪EMBORG⟫/tests/configs/test7patterns
> ⟪EMBORG⟫/tests/configs/test8
> ⟪EMBORG⟫/tests/configs/test9
expected_type: regex

shiver:
Expand All @@ -502,6 +504,7 @@ emborg with configs:
> ⟪EMBORG⟫/tests/configs/test7
> ⟪EMBORG⟫/tests/configs/test7patterns
> ⟪EMBORG⟫/tests/configs/test8
> ⟪EMBORG⟫/tests/configs/test9
expected_type: regex

whiplash:
Expand Down Expand Up @@ -640,7 +643,7 @@ emborg with configs:
> run_before_borg on test0
> run_after_borg on test0
dependencies: fuse
# if this test fails with 'EMBORG: Mountpoint must be a writable',
# if this test fails with EMBORG: Mountpoint must be a writable”,
# it is because EMBORG is still mounted from a previous run.

whitewash:
Expand Down Expand Up @@ -711,14 +714,15 @@ emborg with configs:
> 66 tests/configs/test2excludes
> 82 tests/configs/test6patterns
> 87 tests/configs/test7
> 105 tests/configs/test9
> 111 tests/configs/test7patterns
> 132 tests/configs/test6
> 182 tests/configs/test8
> 191 tests/configs/test5
> 526 tests/configs/test0
> 556 tests/configs/overdue.conf
> 559 tests/configs/test2
> 594 tests/configs/settings
> 600 tests/configs/settings
> 612 tests/configs/test1
> 671 tests/configs/test3
> 965 tests/configs/test4
Expand Down Expand Up @@ -869,6 +873,7 @@ emborg with configs:
> ⟪EMBORG⟫/tests/configs/test7
> ⟪EMBORG⟫/tests/configs/test7patterns
> ⟪EMBORG⟫/tests/configs/test8
> ⟪EMBORG⟫/tests/configs/test9
expected_type: regex

bobbin:
Expand All @@ -881,24 +886,25 @@ emborg with configs:
args: --quiet --config test5 extract /⟪EMBORG⟫/tests/configs
expected:
> ⟪EMBORG⟫/tests/configs
> ⟪EMBORG⟫/tests/configs/test6patterns
> ⟪EMBORG⟫/tests/configs/test2excludes
> ⟪EMBORG⟫/tests/configs/test2
> ⟪EMBORG⟫/tests/configs/test2passphrase
> ⟪EMBORG⟫/tests/configs/test7patterns
> ⟪EMBORG⟫/tests/configs/overdue.conf
> ⟪EMBORG⟫/tests/configs/test3
> ⟪EMBORG⟫/tests/configs/README
> ⟪EMBORG⟫/tests/configs/settings
> ⟪EMBORG⟫/tests/configs/test6
> ⟪EMBORG⟫/tests/configs/test7
> ⟪EMBORG⟫/tests/configs/test8
> ⟪EMBORG⟫/tests/configs/subdir
> ⟪EMBORG⟫/tests/configs/subdir/file
> ⟪EMBORG⟫/tests/configs/test0
> ⟪EMBORG⟫/tests/configs/test5
> ⟪EMBORG⟫/tests/configs/test1
> ⟪EMBORG⟫/tests/configs/test2
> ⟪EMBORG⟫/tests/configs/test2excludes
> ⟪EMBORG⟫/tests/configs/test2passphrase
> ⟪EMBORG⟫/tests/configs/test3
> ⟪EMBORG⟫/tests/configs/test4
> ⟪EMBORG⟫/tests/configs/subdir
> ⟪EMBORG⟫/tests/configs/subdir/file
> ⟪EMBORG⟫/tests/configs/test5
> ⟪EMBORG⟫/tests/configs/test6
> ⟪EMBORG⟫/tests/configs/test6patterns
> ⟪EMBORG⟫/tests/configs/test7
> ⟪EMBORG⟫/tests/configs/test7patterns
> ⟪EMBORG⟫/tests/configs/test8
> ⟪EMBORG⟫/tests/configs/test9
expected_type: sort-lines
cmp_dirs: ⟪EMBORG⟫/tests/configs configs

Expand All @@ -907,24 +913,25 @@ emborg with configs:
args: --quiet --config test5 restore configs
expected:
> ⟪EMBORG⟫/tests/configs
> ⟪EMBORG⟫/tests/configs/test6patterns
> ⟪EMBORG⟫/tests/configs/test2excludes
> ⟪EMBORG⟫/tests/configs/test2
> ⟪EMBORG⟫/tests/configs/test2passphrase
> ⟪EMBORG⟫/tests/configs/test7patterns
> ⟪EMBORG⟫/tests/configs/overdue.conf
> ⟪EMBORG⟫/tests/configs/test3
> ⟪EMBORG⟫/tests/configs/README
> ⟪EMBORG⟫/tests/configs/settings
> ⟪EMBORG⟫/tests/configs/test6
> ⟪EMBORG⟫/tests/configs/test7
> ⟪EMBORG⟫/tests/configs/test8
> ⟪EMBORG⟫/tests/configs/subdir
> ⟪EMBORG⟫/tests/configs/subdir/file
> ⟪EMBORG⟫/tests/configs/test0
> ⟪EMBORG⟫/tests/configs/test5
> ⟪EMBORG⟫/tests/configs/test1
> ⟪EMBORG⟫/tests/configs/test2
> ⟪EMBORG⟫/tests/configs/test2excludes
> ⟪EMBORG⟫/tests/configs/test2passphrase
> ⟪EMBORG⟫/tests/configs/test3
> ⟪EMBORG⟫/tests/configs/test4
> ⟪EMBORG⟫/tests/configs/subdir
> ⟪EMBORG⟫/tests/configs/subdir/file
> ⟪EMBORG⟫/tests/configs/test5
> ⟪EMBORG⟫/tests/configs/test6
> ⟪EMBORG⟫/tests/configs/test6patterns
> ⟪EMBORG⟫/tests/configs/test7
> ⟪EMBORG⟫/tests/configs/test7patterns
> ⟪EMBORG⟫/tests/configs/test8
> ⟪EMBORG⟫/tests/configs/test9
expected_type: sort-lines
cmp_dirs: CONFIGS configs

Expand Down Expand Up @@ -972,14 +979,15 @@ emborg with configs:
> 66 tests/configs/test2excludes
> 82 tests/configs/test6patterns
> 87 tests/configs/test7
> 105 tests/configs/test9
> 111 tests/configs/test7patterns
> 132 tests/configs/test6
> 182 tests/configs/test8
> 191 tests/configs/test5
> 526 tests/configs/test0
> 556 tests/configs/overdue.conf
> 559 tests/configs/test2
> 594 tests/configs/settings
> 600 tests/configs/settings
> 612 tests/configs/test1
> 671 tests/configs/test3
> 965 tests/configs/test4
Expand Down Expand Up @@ -1225,6 +1233,22 @@ emborg with configs:
expected: test8-\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d
expected_type: regex

panther:
args: --quiet --config test9 create
dependencies: borg1.2

archivist:
args: --quiet --config test9 compact
dependencies: borg1.2

planet:
args: --quiet --config test9 prune
dependencies: borg1.2

gable:
args: --quiet --config test9 delete
dependencies: borg1.2

close:
# this is needed for the API tests
args: --quiet --config tests create
Expand Down
11 changes: 8 additions & 3 deletions tests/test_emborg.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Tesr Emborg
# Test Emborg
#
# These tests require BorgBackup to be available. As such, they are not really
# suitable for public continuous integration services such as GitHub Actions.
# These tests require BorgBackup to be available.
# You can set MISSING_DEPENDENCIES environment turn off tests that depend on
# features you do not have. Currently there are two such features, “fuse” and
# “borg1.2”. Simply list each dependency you do not have in this variable
# separated by spaces. For example:
#
# export MISSING_DEPENDENCIES="fuse borg1.2"

# Imports {{{1
import arrow
Expand Down

0 comments on commit e809fb3

Please sign in to comment.