aboutsummaryrefslogtreecommitdiff
path: root/scripts/testing/tests/test_config_applied.py
blob: 00c410e9d3b59ccde86fa1eef98e5f12ee728a80 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# SPDX-License-Identifier: GPL-3.0-or-later
"""Post-install checks: archsetup's in-place config edits actually took effect.

Expansion coverage (P4). These assert the *content* archsetup writes, not just
that a service is enabled — catching cases where a sed silently no-ops (e.g.
ParallelDownloads, which current Arch ships uncommented so a "^#"-only match
left it at 5).
"""

import pytest


@pytest.mark.attribution("archsetup")
def test_pacman_parallel_downloads(host):
    line = host.run("grep -E '^ParallelDownloads' /etc/pacman.conf").stdout
    assert "ParallelDownloads = 10" in line, "ParallelDownloads not set to 10 (got: %r)" % line


@pytest.mark.attribution("archsetup")
def test_pacman_color_enabled(host):
    assert host.run("grep -qx Color /etc/pacman.conf").rc == 0


@pytest.mark.attribution("archsetup")
def test_pacman_multilib_enabled(host):
    # -F: [multilib] is a literal section header, not a regex character class.
    assert host.run("grep -Fxq '[multilib]' /etc/pacman.conf").rc == 0


@pytest.mark.attribution("archsetup")
def test_makepkg_parallel_make(host):
    line = host.run("grep -E '^MAKEFLAGS' /etc/makepkg.conf").stdout
    assert "-j" in line, "MAKEFLAGS not configured for parallel make (got: %r)" % line


@pytest.mark.attribution("archsetup")
def test_makepkg_options_trimmed(host):
    opts = host.run("grep -E '^OPTIONS' /etc/makepkg.conf").stdout
    assert "!debug" in opts and "purge" in opts, "makepkg OPTIONS not customized"


@pytest.mark.attribution("archsetup")
@pytest.mark.parametrize("rel", ["dns.conf", "wifi-privacy.conf"])
def test_networkmanager_dropin(host, rel):
    assert host.file("/etc/NetworkManager/conf.d/%s" % rel).exists


@pytest.mark.attribution("archsetup")
def test_fail2ban_jail_local(host):
    assert host.file("/etc/fail2ban/jail.local").exists


@pytest.mark.attribution("archsetup")
def test_reflector_config(host):
    assert host.file("/etc/xdg/reflector/reflector.conf").exists