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

Make default_os name and major versions configurable #14670

Merged
merged 1 commit into from
May 6, 2024

Conversation

dosas
Copy link
Collaborator

@dosas dosas commented Apr 8, 2024

Problem Statement

default os is hardcoded in fixture

Solution

  • make default os configurable

Related Question

Why is a new instance of OperatingSystem created here instead of returning the one create above?

Related test

tests/foreman/ui/test_registration.py::test_global_registration_form_populate

@dosas dosas requested a review from a team as a code owner April 8, 2024 09:52
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.

Looks good to me. Let's run PRT and see how it goes.

pytest_fixtures/component/os.py Outdated Show resolved Hide resolved
pytest_fixtures/component/os.py Outdated Show resolved Hide resolved
pytest_fixtures/component/os.py Outdated Show resolved Hide resolved
@Griffin-Sullivan
Copy link
Contributor

Why is a new instance of OperatingSystem created here instead of returning the one create above?

My assumption would be to make sure the os variable is updated with a final GET before we return it. Might not be necessary, but it's not a bad practice IMO.

@Griffin-Sullivan Griffin-Sullivan 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 labels Apr 8, 2024
@Griffin-Sullivan
Copy link
Contributor

trigger: test-robottelo
pytest: tests/foreman/ui/test_registration.py::test_global_registration_form_populate

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6359
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_registration.py::test_global_registration_form_populate --external-logging
Test Result : ================== 1 passed, 6 warnings in 843.05s (0:14:03) ===================

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 8, 2024
@dosas dosas force-pushed the make-default-os-configurable branch from 45998cc to 43cc628 Compare April 9, 2024 06:49
@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 9, 2024
Copy link
Contributor

@lpramuk lpramuk left a comment

Choose a reason for hiding this comment

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

We need to find better place for DEFAULT_OS setting than in server.yaml (relates to Satellite server)

conf/server.yaml.template Outdated Show resolved Hide resolved
Copy link
Contributor

@lpramuk lpramuk left a comment

Choose a reason for hiding this comment

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

We need to find better place for DEFAULT_OS setting than in server.yaml (relates to Satellite server)

@dosas dosas requested a review from lpramuk April 9, 2024 13:29
@jameerpathan111 jameerpathan111 self-requested a review April 10, 2024 09:18
@dosas dosas force-pushed the make-default-os-configurable branch from 43cc628 to 541cf57 Compare April 10, 2024 12:03
@dosas dosas requested a review from jyejare April 10, 2024 12:04
@ogajduse
Copy link
Member

I have traced the origin of the fixture back to d1cce26 (#7604).

Can we rework the fixture to create Operating Systems instead of creating new ones? If not, can we create a new fixture that would create new OSes instead of searching for existing ones? Eventually, this fixture can stay if there are tests that need to search for existing OSes.

@dosas
Copy link
Collaborator Author

dosas commented Apr 11, 2024

I have traced the origin of the fixture back to d1cce26 (#7604).

Can we rework the fixture to create Operating Systems instead of creating new ones?
If not, can we create a new fixture that would create new OSes instead of searching for existing ones?

IMO this is out of scope for this PR

Eventually, this fixture can stay if there are tests that need to search for existing OSes.

As I understand it this fixture is used to search for operating systems that have been setup by the foreman installer?

pytest_fixtures/component/os.py Outdated Show resolved Hide resolved
pytest_fixtures/component/os.py Outdated Show resolved Hide resolved
@rplevka
Copy link
Member

rplevka commented Apr 11, 2024

What I am worried about is that this fixture is very misleading.
I'd expect it to return just 1 OS entity - the one that was created on Satellite/Foreman installation - that is the representation of the OS the satellite is running on.
It is used by satellite host entity. Now this could be done by navigating to the hosts, accessing the satellite host entity and read out its OS.

Even better, this could be directly accessed through sat object returned by target_sat fixture (target_sat.nailgun_host.operatingsystem).
I'd probably rewrite this fixture to a oneliner:

@pytest.fixture(scope='session')
def default_os(session_target_sat):
    return session_target_sat.nailgun_host.operatingsystem

@Griffin-Sullivan
Copy link
Contributor

It seems this has gathered a lot of attention. While I agree with @rplevka's opinion that this fixture is misleading, the original intent of this PR was to keep the same functionality of default_os, but make it more flexible for passing in other OSes. I think for now we could leave this as is, and in a separate PR discuss @rplevka's idea and possibly rename / add a better description to the current fixture to be more obvious.

@Griffin-Sullivan
Copy link
Contributor

trigger: test-robottelo
pytest: tests/foreman/ui/test_registration.py::test_global_registration_form_populate

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6464
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/ui/test_registration.py::test_global_registration_form_populate --external-logging
Test Result : =================== 8 warnings, 1 error in 720.53s (0:12:00) ===================

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Apr 11, 2024
@dosas dosas force-pushed the make-default-os-configurable branch from 541cf57 to 9f12a7e Compare April 16, 2024 11:33
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6531
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/ui/test_registration.py::test_global_registration_form_populate --external-logging
Test Result : ================== 1 failed, 9 warnings in 1284.46s (0:21:24) ==================

@ogajduse
Copy link
Member

It seems that our Selenium grid is down ATM.

selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. New session request timed out 

Let's try different test

@ogajduse
Copy link
Member

trigger: test-robottelo
pytest: tests/foreman/api/test_architecture.py::test_positive_CRUD

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6533
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/api/test_architecture.py::test_positive_CRUD --external-logging
Test Result : ================== 1 passed, 9 warnings in 657.96s (0:10:57) ===================

@Satellite-QE Satellite-QE added PRT-Passed Indicates that latest PRT run is passed for the PR and removed PRT-Failed Indicates that latest PRT run is failed for the PR labels Apr 16, 2024
@dosas dosas requested a review from jyejare April 29, 2024 12:37
@jyejare
Copy link
Member

jyejare commented Apr 30, 2024

@ogajduse I will be merging this as @dosas has been waiting for it for a long. We will discuss and implement the dynamic approach sometimes in this quarter.

@jyejare
Copy link
Member

jyejare commented Apr 30, 2024

trigger: test-robottelo
pytest: tests/foreman/api/test_architecture.py::test_positive_CRUD

also enable searching for os names other than redhat os
@dosas dosas force-pushed the make-default-os-configurable branch from 8b88576 to 5a2d67f Compare May 6, 2024 08:00
@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label May 6, 2024
@dosas
Copy link
Collaborator Author

dosas commented May 6, 2024

@jyejare I rebased

@jyejare
Copy link
Member

jyejare commented May 6, 2024

trigger: test-robottelo
pytest: tests/foreman/api/test_architecture.py::test_positive_CRUD

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6799
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/api/test_architecture.py::test_positive_CRUD --external-logging
Test Result : ================== 1 passed, 9 warnings in 757.00s (0:12:37) ===================

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label May 6, 2024
@jyejare jyejare merged commit 56441e0 into SatelliteQE:master May 6, 2024
11 checks passed
@jyejare jyejare added the 6.12.z Introduced in or relating directly to Satellite 6.12 label May 6, 2024
dosas added a commit to ATIX-AG/robottelo that referenced this pull request May 15, 2024
also enable searching for os names other than redhat os

(cherry picked from commit 56441e0)
vsedmik pushed a commit that referenced this pull request May 17, 2024
Make default_os name and major versions configurable (#14670)

also enable searching for os names other than redhat os

(cherry picked from commit 56441e0)
dosas added a commit to ATIX-AG/robottelo that referenced this pull request May 23, 2024
also enable searching for os names other than redhat os

(cherry picked from commit 56441e0)
dosas added a commit to ATIX-AG/robottelo that referenced this pull request May 23, 2024
also enable searching for os names other than redhat os

(cherry picked from commit 56441e0)
Gauravtalreja1 pushed a commit that referenced this pull request Jun 3, 2024
Make default_os name and major versions configurable (#14670)

also enable searching for os names other than redhat os

(cherry picked from commit 56441e0)
Gauravtalreja1 pushed a commit that referenced this pull request Jun 3, 2024
Make default_os name and major versions configurable (#14670)

also enable searching for os names other than redhat os

(cherry picked from commit 56441e0)
jyejare pushed a commit to jyejare/robottelo that referenced this pull request Oct 19, 2024
also enable searching for os names other than redhat os
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.12.z Introduced in or relating directly to Satellite 6.12 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 CherryPick PR needs CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants