Conversation
… 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.
Owner
|
Thanks for the PR @ntdatt812 Just merged into develop. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One append in the wrong block
build_titleassembles the containers header by appending fragments to a single list. The final append sits outside the branch that produces its message:With one engine the branch runs and the append is right. With several engines the branch is skipped,
msgstill holds the fragment appended just above it, and appending it again repeats it in the header.show_engine_nameis set when the containers come from more than one engine:so this is exactly the Docker + Podman case.
Measured
Driving the real
build_title:CONTAINERS 2 sorted by CPU consumptionsorted by CPU consumptionCONTAINERSCONTAINERSCONTAINERS 2 sorted by CPU consumption (served by docker)✓CONTAINERS (served by docker)✓After the fix the first two read
CONTAINERS 2 sorted by CPU consumptionandCONTAINERS, and the two correct rows are unchanged.The fix
Move the append inside its branch. Nothing is lost in the multi-engine case:
maybe_add_engine_name_or_pod_linealready adds a per-row Engine column there, which is why the header deliberately omits "(served by …)".Tests
Six cases in
tests/test_plugin_containers.py, drivingbuild_titlewith the curses helpers stubbed:(served by docker)still shown, with and without the countmemory consumption,container name)Mutation-checked — putting the append back outside the branch turns 3 of the 6 red:
ruff checkandruff format --checkclean on both files.