Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize list-units and list-unit-files tests #929

Merged
merged 5 commits into from
Aug 29, 2024

Conversation

mwperina
Copy link
Member

@mwperina mwperina commented Aug 23, 2024

  • Eliminate special characters from systemctl list-units
  • Minimize code duplication around list-units tests
  • Improve verification of bluechictl list-units
  • Minimize code duplication around list-unit-files tests
  • Remove duplicate debug log information

@mwperina
Copy link
Member Author

Moving back to draft, further optimizations including list-unit-files is possible

@mwperina mwperina marked this pull request as draft August 26, 2024 11:50
@mwperina mwperina force-pushed the list-units-code-duplication branch from 23439d0 to 3344434 Compare August 27, 2024 12:16
@mwperina mwperina changed the title Optimize list-units tests Optimize list-units and list-unit-files tests Aug 27, 2024
@mwperina mwperina marked this pull request as ready for review August 27, 2024 12:18
@mwperina mwperina force-pushed the list-units-code-duplication branch from 3344434 to 80e5a86 Compare August 27, 2024 12:23
@coveralls
Copy link

coveralls commented Aug 27, 2024

Coverage Status

coverage: 85.466% (+0.1%) from 85.348%
when pulling 0a5fb84 on mwperina:list-units-code-duplication
into a88ee95 on eclipse-bluechi:main.

@mwperina mwperina force-pushed the list-units-code-duplication branch 2 times, most recently from ee4e15f to 690f7eb Compare August 27, 2024 14:14
systemctl list-units uses special characters in front of unit name to
emphasize state of the unit. But such special characters make parsing of
the output more complicated, so let's remove such characters using
--plain parameter.

Signed-off-by: Martin Perina <[email protected]>
@mwperina mwperina force-pushed the list-units-code-duplication branch from 690f7eb to 81dedcb Compare August 29, 2024 09:36
Copy link
Member

@engelmi engelmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small NIT, otherwise LGTM

Up-until-now we have only verified, that bluechictl list-units output
contains all units, which are reported by systemctl list-units. But we
had a bug, because bluechictl list-units reported more units than
systemctl, which is caused by different behavior between ListUnits D-Bus
API, which by default reports all units (and this option cannot be
changed), and systemctl list-units reported only loaded units. So --all
parameter was added to systemctl list-units and verification was
improved to have really a match between systemctl and bluechictl
list-units results.

Signed-off-by: Martin Perina <[email protected]>
Remove logging of the output from BluechiCtl._run(), because the output
is already logged in ContainerClient.exec_run() or SSHClient.exec_run()

Signed-off-by: Martin Perina <[email protected]>
@mwperina mwperina force-pushed the list-units-code-duplication branch from 81dedcb to 0a5fb84 Compare August 29, 2024 12:19
Copy link
Member

@engelmi engelmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mwperina mwperina merged commit a890cbb into eclipse-bluechi:main Aug 29, 2024
22 checks passed
@mwperina mwperina deleted the list-units-code-duplication branch August 29, 2024 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants