Skip to content

Commit

Permalink
[RHELC-1535] Test set envar through config (#1440)
Browse files Browse the repository at this point in the history
* modify one of the tests to validate the functionality
* disable flaky fail after ponr test

Signed-off-by: Daniel Diblik <[email protected]>
  • Loading branch information
danmyway authored Nov 28, 2024
1 parent 14be22b commit 02fa48a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
6 changes: 2 additions & 4 deletions plans/tier1.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,9 @@ adjust+:
- proxy-conversion/proxy_conversion

/error-after-ponr:
enabled: false
adjust+:
- enabled: true
when: distro == alma-9, rocky-9, oracle-9
because: It will behave the same anywhere. Too expensive to run it on more hosts.
- enabled: false
because: The test is very flaky and expensive to maintain. Needs further investigation.
discover+:
# Disregarding inheritance in the test discovery.
# As the conversion fails and the system is left in an undetermined state,
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/tier1/destructive/host-metering/main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ link:
- https://issues.redhat.com/browse/RHELC-1226

/test_host_metering_conversion:
environment+:
CONVERT2RHEL_CONFIGURE_HOST_METERING: force
tag+:
- test-host-metering-conversion
test: pytest -m test_run_conversion_with_host_metering
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.

from conftest import TEST_VARS
import configparser


def setup_test_metering_endpoint():
Expand All @@ -39,6 +40,19 @@ def setup_test_metering_endpoint():
)


# TODO (danmyway) refactor this into a helper function/class when we move away from the environment variables completely
def set_the_option_in_config():
"""
Set the configure_host_metering option through the config file.
"""
config_path = "/etc/convert2rhel.ini"
config = configparser.ConfigParser()
config.read(config_path)
config.set("host_metering", "configure_host_metering", "force")
with open(config_path, "w") as file:
config.write(file)


# TODO (danmyway) We might boil this down to just a preparation of the envar and the endpoint
# and then use whatever basic conversion method for the conversion itself
# We do not really need to care about the output of the utility
Expand All @@ -52,6 +66,7 @@ def test_run_conversion_with_host_metering(shell, convert2rhel):
service on hyperscalers on RHEL 7.9.
"""
setup_test_metering_endpoint()
set_the_option_in_config()

with convert2rhel(
"-y --serverurl {} --username {} --password {} --debug".format(
Expand Down

0 comments on commit 02fa48a

Please sign in to comment.