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

[Customer Case] Test for creating a host with lce specified #14321

Merged
merged 4 commits into from
May 8, 2024

Conversation

ColeHiggins2
Copy link
Member

Problem Statement

hammer host create did not previously support --lifecycle-environment options, only --lifecycle-environment-id

Now users should be able to create a host with --lifecycle-environment ['name'] set

Solution

Automation to create a host using the --lifecycle-environment option

@ColeHiggins2 ColeHiggins2 added CLI Issues and PRs involving the CLI CherryPick PR needs CherryPick to previous branches 6.15.z Introduced in or relating directly to Satellite 6.15 labels Mar 8, 2024
@ColeHiggins2 ColeHiggins2 self-assigned this Mar 8, 2024
@ColeHiggins2 ColeHiggins2 requested a review from a team as a code owner March 8, 2024 22:28
@ColeHiggins2
Copy link
Member Author

trigger: test-robottelo
pytest: tests/foreman/cli/test_host.py -k test_positive_create_host_with_lifecycle_environment_name

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6006
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/cli/test_host.py -k test_positive_create_host_with_lifecycle_environment_name --external-logging
Test Result : =========== 1 passed, 90 deselected, 1 warning in 719.65s (0:11:59) ============

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Mar 8, 2024
}
)
hosts = module_target_sat.cli.Host.list({'organization-id': module_org.id})
for i in hosts:
Copy link
Contributor

@lhellebr lhellebr Mar 12, 2024

Choose a reason for hiding this comment

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

Use something like

assert 'string' in [item['name'] for item in list_of_something]

... and get rid of the unnecessary variable, loop and iterating through a dict!

if new_host.name in i.values():
found_host = True
break
assert found_host is True, 'Assertion failed: host not found'
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. You can delete this using my comment above
  2. We don't do assert x is True, just assert x is enough

Copy link
Contributor

@Griffin-Sullivan Griffin-Sullivan left a comment

Choose a reason for hiding this comment

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

Good for me pending @lhellebr's comments

@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 1, 2024
Copy link
Contributor

@lhellebr lhellebr left a comment

Choose a reason for hiding this comment

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

ACK if PRT passes

@vsedmik
Copy link
Contributor

vsedmik commented Apr 8, 2024

trigger: test-robottelo
pytest: tests/foreman/cli/test_host.py -k test_positive_create_host_with_lifecycle_environment_name

Comment on lines +2723 to +2734
found_host = any(new_host.name in i.values() for i in hosts)
assert found_host, 'Assertion failed: host not found'
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocking

Suggested change
found_host = any(new_host.name in i.values() for i in hosts)
assert found_host, 'Assertion failed: host not found'
assert any(new_host.name in i.values() for i in hosts), 'Assertion failed: host not found'

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6358
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/cli/test_host.py -k test_positive_create_host_with_lifecycle_environment_name --external-logging
Test Result : =========== 1 passed, 90 deselected, 4 warnings in 766.00s (0:12:45) ===========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 8, 2024
@ColeHiggins2
Copy link
Member Author

trigger: test-robottelo
pytest: tests/foreman/cli/test_host.py -k test_positive_create_host_with_lifecycle_environment_name

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6810
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/cli/test_host.py -k test_positive_create_host_with_lifecycle_environment_name --external-logging
Test Result : ========== 1 passed, 86 deselected, 95 warnings in 708.64s (0:11:48) ===========

@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label May 7, 2024
@sambible sambible merged commit 4e13993 into SatelliteQE:master May 8, 2024
8 checks passed
github-actions bot pushed a commit that referenced this pull request May 8, 2024
* Test for creating a host with lce specified

* addressing comments

* rebase and adding to docstring

* fixing docstring issue

(cherry picked from commit 4e13993)
pondrejk pushed a commit that referenced this pull request May 9, 2024
…15006)

[Customer Case] Test for creating a host with lce specified (#14321)

* Test for creating a host with lce specified

* addressing comments

* rebase and adding to docstring

* fixing docstring issue

(cherry picked from commit 4e13993)

Co-authored-by: Cole Higgins <[email protected]>
jyejare pushed a commit to jyejare/robottelo that referenced this pull request Oct 19, 2024
…eQE#14321)

* Test for creating a host with lce specified

* addressing comments

* rebase and adding to docstring

* fixing docstring issue
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 CherryPick PR needs CherryPick to previous branches CLI Issues and PRs involving the CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants