Commit Graph
4 Commits
Author SHA1 Message Date
nicolargo e02a45faf5 Mark shebang-carrying test files as executable 2026-09-05 10:35:58 +02:00
Nguyen Thanh Dat 9e625e1e08 fix(containers): stop repeating a title fragment when several engines run
build_title appends the pieces of the header to one list, and the last
append sits outside the branch that produces its message:

        if not self.views['show_engine_name']:
            msg = f' (served by {self.stats[0].get("engine", "")})'
        ret.append(self.curse_add_line(msg))

With one engine the branch runs and the append is correct. With several -
Docker and Podman on the same host, which is the only case
show_engine_name is True - the branch is skipped, msg still holds the
previous fragment, and appending it again repeats it.

Measured against the real build_title:

    2 containers, 2 engines -> 'CONTAINERS 2 sorted by CPU consumption sorted by CPU consumption'
    1 container,  2 engines -> 'CONTAINERSCONTAINERS'
    2 containers, 1 engine  -> 'CONTAINERS 2 sorted by CPU consumption (served by docker)'
    1 container,  1 engine  -> 'CONTAINERS (served by docker)'

Move the append inside the branch. The engine name genuinely has nothing
to add in the multi-engine case: maybe_add_engine_name_or_pod_line adds a
per-row Engine column there instead.
2026-08-25 10:05:41 +07:00
Nguyen Thanh Dat b11fd3947c test(containers): add the class docstrings the sibling plugin tests carry
Matches the convention in tests/test_plugin_sensors.py and clears the
docstring findings Codacy raised on the PR.
2026-08-19 11:16:28 +07:00
Nguyen Thanh Dat 061402b012 fix(containers): aggregate network stats over all container interfaces
_get_network_stats() read the container network counters from a single
hardcoded interface. The Docker stats endpoint returns one entry per
container interface, so a container attached to several networks gets
eth0, eth1... and everything past eth0 was silently dropped, making the
reported RX/TX rates too low.

Sum rx_bytes/tx_bytes across all the interfaces instead. Loopback is
excluded, since Docker-API-compatible runtimes have been observed to
report it and its traffic would inflate the totals. Interfaces with
missing counters are skipped rather than aborting the whole method, so
one malformed interface no longer discards the valid ones. None is still
returned when nothing usable remains, keeping --network host containers
unchanged.

The output contract is untouched: same keys, same types, same units.

Fixes #3669
2026-08-19 10:35:48 +07:00