aboutsummaryrefslogtreecommitdiff
path: root/scripts/testing/net-scenarios/20-rival-manager.sh
blob: 0d7836b330fd4534c37b7fa4fa5a2c8a6fb487fb (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
# shellcheck shell=bash disable=SC2034  # sourced by run-net-scenarios.sh
# Scenario: a rival network manager active alongside NetworkManager is disabled.
#
# dhcpcd (or systemd-networkd / iwd) running next to NM fights it for the link.
# Break by enabling dhcpcd; the fix disables it, and the chain resets to
# reconnect. Requires dhcpcd installed in the target.
SCENARIO_DESC="an active rival manager (dhcpcd) is disabled"
SCENARIO_GROUP="control-plane"

scenario_break() {
    nexec "systemctl enable --now dhcpcd"
}

scenario_diagnose_expect() {
    # The verdict fires only when the link is also failing; in a fresh target
    # with no configured uplink that holds, so the rival should be named.
    ndoctor_json ".report.control_plane.rivals | index(\"dhcpcd\")" \
        | grep -vqx null
}

scenario_fix() {
    nfix
}

scenario_assert() {
    ! nexec "systemctl is-active dhcpcd >/dev/null 2>&1"
}