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

Fix and update installer ping test #13614

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

Griffin-Sullivan
Copy link
Contributor

Problem Statement

This test is failing on stream because hammer ping now has a couple new lines that are nested for the cache

Solution

Simplify the assertion so it's much easier.

Related Issues

@Griffin-Sullivan Griffin-Sullivan added CherryPick PR needs CherryPick to previous branches AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing 6.15.z Introduced in or relating directly to Satellite 6.15 labels Jan 4, 2024
@Griffin-Sullivan Griffin-Sullivan requested a review from a team as a code owner January 4, 2024 20:51
@Griffin-Sullivan
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/installer/test_installer.py::test_positive_check_installer_hammer_ping

result = target_sat.cli.Base.ping()
for line in result.split('\n'):
if 'Status' in line:
assert 'ok' in line
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a weaker assertion. For example, when I stop the foreman services, I get this output and the assertion won't fail for it:

Error: Failed to open TCP connection to <FQDN>:443 (Connection refused - connect(2) for "<FQDN>" port 443)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm good catch. I'll reevaluate.

@Griffin-Sullivan Griffin-Sullivan marked this pull request as draft January 5, 2024 16:50
@Griffin-Sullivan Griffin-Sullivan marked this pull request as ready for review January 8, 2024 15:00
@Griffin-Sullivan
Copy link
Contributor Author

@lhellebr during local testing I found that the command won't execute if services are unreachable / down. This causes the test to fail and give you the output you pasted above. So I think it should work fine the way it is.

@Griffin-Sullivan
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/installer/test_installer.py::test_positive_check_installer_hammer_ping

@lhellebr
Copy link
Contributor

lhellebr commented Feb 1, 2024

What you're trying to do goes against the sense of this test. Think about it, what is the purpose of the second assertion? It will only evaluate if return code of the previous command is 0.
You state the command won't execute if services are unreachable, I think what you mean is it executes and returns non-zero status.
Now, point of this test is testing hammer ping, not only to the level of it returning 0 when it should but also parsing its output and having some expectations on it. The original version didn't do it ideally but it was still a stronger assertion than the new version. If you conclude that "if return value is 0 and there is not a single line saying Status: ok means this still should pass", then you can almost remove the second assertion entirely.

@rmynar
Copy link
Contributor

rmynar commented Feb 2, 2024

I think that the purpose of this change is mainly to parse the new output of hammer ping. For hammer ping we have separate tests (https://github.com/SatelliteQE/robottelo/blob/master/tests/foreman/cli/test_ping.py)

@lhellebr
Copy link
Contributor

lhellebr commented Feb 2, 2024

That being said, you're the owner of the test so feel free to merge without my ACK if you feel I'm being too harsh :)

@Griffin-Sullivan
Copy link
Contributor Author

I was unaware of the other ping test. I'm not sure I understand the reason we have both tests. I feel inclined to remove this test since it's just a different version of the other test in test_ping.py. Thoughts @rmynar since you did the eval for this file?

@rmynar
Copy link
Contributor

rmynar commented Feb 2, 2024

I was also unaware of the other ping test when I did the eval. However I think this one is kind of sanity test for the Installer component (i.e. "No need to continue further testing when some service fails to run after installation/upgrade"). I'm not against removing this test or moving the assertion into another testcase. Current changes seem sufficient to adapt the test to the new hammer ping output.

@Griffin-Sullivan Griffin-Sullivan merged commit ad192b7 into SatelliteQE:master Feb 5, 2024
6 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 5, 2024
shweta83 pushed a commit to shweta83/robottelo that referenced this pull request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.15.z Introduced in or relating directly to Satellite 6.15 AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing CherryPick PR needs CherryPick to previous branches
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants