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

Verify a variable created and added to the host #14477

Merged

Conversation

shweta83
Copy link
Contributor

Problem Statement

We are missing scenario for creating and adding variable to the host.
Automated BZ: 2170727

Solution

Added the scenario

Related Issues

@shweta83 shweta83 requested a review from a team as a code owner March 21, 2024 19:13
@shweta83
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_ansible.py -k test_positive_verify_ansible_role_on_host

@shweta83 shweta83 force-pushed the automate_customer_scenario branch from 8db1360 to 65d44b5 Compare March 21, 2024 19:15
@shweta83 shweta83 added CherryPick PR needs CherryPick to previous branches 6.13.z Introduced in or relating directly to Satellite 6.13 6.14.z Introduced in or relating directly to Satellite 6.14 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 labels Mar 21, 2024
@shweta83
Copy link
Contributor Author

shweta83 commented Mar 21, 2024

trigger: test-robottelo
pytest: tests/foreman/ui/test_ansible.py -k test_positive_verify_ansible_variable_on_host

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6160
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_ansible.py -k test_positive_verify_ansible_variable_on_host --external-logging
Test Result : =========== 1 passed, 10 deselected, 4 warnings in 804.09s (0:13:24) ===========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Mar 21, 2024
Comment on lines 314 to 330
session.ansiblevariables.create_with_overrides(
{
'key': key,
'ansible_role': SELECTED_ROLE,
'override': 'true',
'parameter_type': 'array',
'default_value': '[\'test\']',
'validator_type': None,
'attribute_order': 'domain \n fqdn \n hostgroup \n os',
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like this test is just extending the existing test_positive_create_variable_with_overrides, so can we combine this two tests by adding a assert for verifying if variable is created or etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The existing test is taking integer type and the BZ was specific about array(which will contain string) type.

Comment on lines +336 to +347
values = session.host_new.get_details(rhel_contenthost.hostname, 'ansible')['ansible'][
'variables'
]['table']
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add a check for verifying the assigned role here first on host then variable?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We already have the test for it test_positive_host_role_information, so if you agree on this we can combine this too and remove the existing test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't matter here. But I can surely add it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

well, you're asserting for var['Ansible role'] currently, but what I meant was that in the Ansible tab, check the roles subtab rather than the variables subtab, for roles assigned as similar to test_positive_host_role_information

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am verifying the role has been assigned to the variable which is needed for the this test.

Copy link
Collaborator

Choose a reason for hiding this comment

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

its a good thing to check, but its fine, we can skip this check for now

Comment on lines +303 to +314
command = target_sat.api.RegistrationCommand(
organization=module_org,
location=module_location,
activation_keys=[module_activation_key.name],
).create()
result = rhel_contenthost.execute(command)
Copy link
Collaborator

Choose a reason for hiding this comment

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

As you're not using the host here, so you could skip the rhel_contenthost and its registration, instead create a fake host without registration and assign the role directly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good to use the actual host here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Either way, this should be setup.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, it is part of setup, but we're using fake hosts everywhere for such tests for Ansible component, also this will make the execution faster and will save time for unnecessary checkout of actual host

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is using container so it doesn't take much time.

@Gauravtalreja1 Gauravtalreja1 added the QETestCoverage Issues and PRs relating to a Satellite bug label Mar 22, 2024
@shweta83 shweta83 force-pushed the automate_customer_scenario branch from 65d44b5 to 597cedd Compare March 22, 2024 17:14
@shweta83
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_ansible.py -k test_positive_assign_ansible_role_variable_on_host

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6171
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/ui/test_ansible.py -k test_positive_assign_ansible_role_variable_on_host --external-logging
Test Result : =========== 1 failed, 10 deselected, 4 warnings in 833.11s (0:13:53) ===========

@Satellite-QE Satellite-QE added PRT-Failed Indicates that latest PRT run is failed for the PR and removed PRT-Passed Indicates that latest PRT run is passed for the PR labels Mar 22, 2024
@shweta83 shweta83 force-pushed the automate_customer_scenario branch from 597cedd to 72bbe92 Compare March 22, 2024 18:36
@Satellite-QE Satellite-QE removed the PRT-Failed Indicates that latest PRT run is failed for the PR label Mar 22, 2024
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6172
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_ansible.py -k test_positive_assign_ansible_role_variable_on_host --external-logging
Test Result : =========== 1 passed, 10 deselected, 4 warnings in 829.18s (0:13:49) ===========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Mar 22, 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 pending comments

@shweta83 shweta83 force-pushed the automate_customer_scenario branch 2 times, most recently from cd8ff11 to b67774c Compare April 3, 2024 19:14
@shweta83
Copy link
Contributor Author

shweta83 commented Apr 3, 2024

trigger: test-robottelo
pytest: tests/foreman/ui/test_ansible.py -k test_positive_verify_ansible_variable_on_host

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

shweta83 commented Apr 4, 2024

trigger: test-robottelo
pytest: tests/foreman/ui/test_ansible.py -k test_positive_assign_ansible_role_variable_on_host

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6306
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_ansible.py -k test_positive_assign_ansible_role_variable_on_host --external-logging
Test Result : =========== 1 passed, 10 deselected, 7 warnings in 825.40s (0:13:45) ===========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 4, 2024
@shweta83 shweta83 force-pushed the automate_customer_scenario branch from b67774c to a787d66 Compare April 4, 2024 07:26
@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 4, 2024
@shweta83
Copy link
Contributor Author

shweta83 commented Apr 4, 2024

trigger: test-robottelo
pytest: tests/foreman/ui/test_ansible.py -k test_positive_assign_ansible_role_variable_on_host

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6309
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_ansible.py -k test_positive_assign_ansible_role_variable_on_host --external-logging
Test Result : =========== 1 passed, 10 deselected, 7 warnings in 841.99s (0:14:01) ===========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 4, 2024
@Gauravtalreja1 Gauravtalreja1 merged commit fc64c78 into SatelliteQE:master Apr 4, 2024
10 checks passed
github-actions bot pushed a commit that referenced this pull request Apr 4, 2024
github-actions bot pushed a commit that referenced this pull request Apr 4, 2024
github-actions bot pushed a commit that referenced this pull request Apr 4, 2024
shweta83 added a commit to shweta83/robottelo that referenced this pull request Apr 5, 2024
shweta83 added a commit that referenced this pull request Apr 5, 2024
shweta83 added a commit that referenced this pull request Apr 5, 2024
shweta83 added a commit that referenced this pull request Apr 5, 2024
shweta83 added a commit that referenced this pull request Apr 5, 2024
shweta83 added 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.13.z Introduced in or relating directly to Satellite 6.13 6.14.z Introduced in or relating directly to Satellite 6.14 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 PRT-Passed Indicates that latest PRT run is passed for the PR QETestCoverage Issues and PRs relating to a Satellite bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants