[Part-2] Helpers refactor of helpers.py helpers :)
Refactor:
-
Fact: get_available_capsule_port function is used only with satellite server for identifying free ports. The options in that function is never used. Also, this property is already added into capsulemixins which isnt the right place since the operations in functions are happening on satellite.
- Consideration: Moving under satellite mixins as property would be good since the option is never used. Removing this property from CapsuleMixins as we are finding open ports for capsule on
Satellitenot onCapsule.
- Consideration: Moving under satellite mixins as property would be good since the option is never used. Removing this property from CapsuleMixins as we are finding open ports for capsule on
-
Fact: refactor of default_url_on_new_port function is used only with satellite server. Also, this property is already added into capsulemixins which isnt the right place since the operations in the function are happening on satellite.
- Consideration: Moving under satellite mixins to access it from satellite object. Removing this property from CapsuleMixins for said issue. Also Extra [1] has been performed as part of this commit!
-
Fact: Storage class is not being instantiated anywhere or used in robottelo. As well as there is a better replacement for it and thats
Boxwhich turns dict into object with attributes.- Consideration: Removed the class and even its robottelo unit tests.
-
Fact: get_func_name function isnt used anywhere in robottelo and I dont see its useful at all since we have better alternative for it an that is
inspect.- Consideration: Removed!
-
Fact: form_repo_url is used only in one test module for content management, the content management test cases are only tested from API.
- Consideration: Moved the helper directly to the test module and renamed it to
get_published_repo_urlas thats the only module its used and doesnt have general applicability for other tests.
- Consideration: Moved the helper directly to the test module and renamed it to
-
Fact: create_repo function that creates a repo from given rpms and moves it to the directory to be accessed via HTTP is not being used anywhere. Also there are some similar names defs but are doing different work altogether.
- Consideration: Removing it as I dont see a direct need of it in robottelo.
-
Fact: extract_ui_token and get_web_session used to create UI session on the fly but both of them are no more required.
- Consideration: Removing both of them because now we have airgun and satellite.ui_session to interact with satellites UI session.
-
Fact: check_provisioned_host is being used to verify if the host ip of provisioned host pings from satellite only.
- Consideration: Moved under contenthost class as parent class for sat and cap classes as general
ping_hostfunction to check any host with name or IP pings.
- Consideration: Moved under contenthost class as parent class for sat and cap classes as general
-
Fact: slugify_component is only used in issue_handlers plugin and its tests.
- Consideration: Moving to utils as a general purpose function.
-
Fact: idgen function is not used anywhere.
- Consideration: Removed
-
Fact: InstalledCommand is used to generate satellite installer command
stringbased on given options and its not playing with satellite system itself.- Consideration: Created new installer utils and moved
InstallerCommandutility in that module.
- Consideration: Created new installer utils and moved
Extra:
- Some of these helpers being used in depreciated
cli/factory.pyand those factory functions been used tests. So as part of this effort I have removed concerning function fromcli/factoryand the dependent tests were moved to usesat.cli_factory.
trigger: test-robottelo pytest: tests/foreman/destructive/test_realm.py --uses-fixtures module_fake_proxy
Th 6 test failures in commit https://github.com/SatelliteQE/robottelo/pull/9936/commits/ff19a1cdaffa9f4901122d8cf59c5f10ffeeb8d7 are similar to CI run and its not caused by this PR.
trigger: test-robottelo pytest: tests/foreman/cli/test_organization.py --uses-fixtures proxy
All tests passed here !
trigger: test-robottelo pytest: tests/foreman/api/test_smartproxy.py -k test_positive_create_with_name
All tests passed for this except html based name in smart proxy creation which could be ignored!
trigger: test-robottelo pytest: tests/foreman/api/test_smartproxy.py -k test_positive_create_with_name
Please don't pass any extra details in the PRT comment except the recommended one otherwise job could be failed with any of the reasons, your recent job got failed because of the below comment which had the backquotes(```).
All tests passed for this except html based name in smart proxy creation which could be ignored!
@devendra104 Ohh! I was able to run the PRT successfully and without backquotes. After the successful PRT, I edited the comment and said this PRT was successful so that reviewers know that PRT went well or if it failed, failed with a proper reason.
So we need to disable PRT run on edited comments and just run them when we create.
Can we merge @JacobCallahan @mshriver @shweta83 and @Gauravtalreja1 ?