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

add integration test for bluechi-is-online agent --monitor #1025

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nsimsolo
Copy link
Contributor

Adding integration test for bluechi-is-online agent --monitor

--monitor keeps monitoring as long as agent is online and exits if it detects an offline state.

  1. Start node and agent, keep it running and verify --monitor does not return output.
  2. Stop agent and verify --monitor returns 1.

@coveralls
Copy link

coveralls commented Jan 14, 2025

Coverage Status

coverage: 82.251% (+0.02%) from 82.236%
when pulling e54509f on nsimsolo:bluechi-is-online-agent-monitor
into 1cb7527 on eclipse-bluechi:main.

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 comment, otherwise looks good to me.

Comment on lines +68 to +71
assert (
monitor_result_test_two.result is not None
and monitor_result_test_two.output != ""
), "Monitor command should produce an output when agent is stopped."
Copy link
Member

Choose a reason for hiding this comment

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

NIT: I think we could check the .result more specifically:

Suggested change
assert (
monitor_result_test_two.result is not None
and monitor_result_test_two.output != ""
), "Monitor command should produce an output when agent is stopped."
assert (
monitor_result_test_two.result == 1
and monitor_result_test_two.output != ""
), "Monitor command should produce an output when agent is stopped."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using 'monitor_result_test_two.result == 1' failed, Based on the test logs, monitor_result_test_two.result is currently captured as False when the agent is offline, rather than the exit code (1).
Also, when I run this test manually the command outputs text and not 1:
~$ sudo bluechi-is-online agent --monitor
org.eclipse.bluechi.Agent is offline
~$ echo $?
1

To make monitor_result_test_two.result == 1 work, we’d need to modify the monitor_agent() function to explicitly return the exit code from the bluechi-is-online command
or use 'monitor_result_test_two.result is False'
but that approach wouldn't align with the other bluechi-is-online tests.
Please Let me know your preference!

@engelmi
Copy link
Member

engelmi commented Jan 14, 2025

Please remove the merge commit.

@nsimsolo nsimsolo force-pushed the bluechi-is-online-agent-monitor branch 2 times, most recently from 5109d6b to d4391f5 Compare January 14, 2025 15:04
@engelmi
Copy link
Member

engelmi commented Jan 15, 2025

@nsimsolo Please pull the latest changes from main. This should fix the failing pipelines.

Signed-off-by: nsimsolo <nsimsolo@redhat.com>
@nsimsolo nsimsolo force-pushed the bluechi-is-online-agent-monitor branch from d4391f5 to e54509f Compare January 15, 2025 08:17
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