blob: 314cacca201fd0c2ac675a6042202e8cd98e8298 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# SPDX-License-Identifier: GPL-3.0-or-later
"""Post-install checks: backup_system_file ran during a real install.
Expansion coverage (P4). The unit suite (tests/backup-system-file/) covers the
helper's logic; this confirms it actually fires end-to-end — archsetup leaves a
<file>.archsetup.bak next to each pre-existing file it edits in place.
These targets are edited unconditionally on every run (pacman.conf/makepkg.conf
always sed'd, sudoers always appended, mkinitcpio.conf HOOKS on non-ZFS), so
their backups must exist. Conditionally-edited files (locale.gen, geoclue,
fstab) aren't asserted here since their edits depend on the base image.
"""
import pytest
ALWAYS_BACKED_UP = [
"/etc/pacman.conf",
"/etc/makepkg.conf",
"/etc/sudoers",
"/etc/mkinitcpio.conf",
]
@pytest.mark.attribution("archsetup")
@pytest.mark.parametrize("path", ALWAYS_BACKED_UP)
def test_backup_created_for_edited_file(host, path):
bak = host.file(path + ".archsetup.bak")
assert bak.exists, "%s.archsetup.bak missing — backup_system_file did not fire" % path
assert bak.is_file
|