From 82584b322afe993d377cf33140063b0cab9c54ea Mon Sep 17 00:00:00 2001 From: Daniel Diblik Date: Tue, 26 Nov 2024 18:44:19 +0100 Subject: [PATCH] [RHELC-1535] Test set envar through config * modify one of the tests to validate the functionality * disable flaky fail after ponr test Signed-off-by: Daniel Diblik --- plans/tier1.fmf | 6 ++---- .../tier1/destructive/host-metering/main.fmf | 2 -- .../test_run_conversion_with_metering.py | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/plans/tier1.fmf b/plans/tier1.fmf index ca79cf3277..2514fe790a 100644 --- a/plans/tier1.fmf +++ b/plans/tier1.fmf @@ -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, diff --git a/tests/integration/tier1/destructive/host-metering/main.fmf b/tests/integration/tier1/destructive/host-metering/main.fmf index dceee7c733..fa1bab0b3d 100644 --- a/tests/integration/tier1/destructive/host-metering/main.fmf +++ b/tests/integration/tier1/destructive/host-metering/main.fmf @@ -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 diff --git a/tests/integration/tier1/destructive/host-metering/test_run_conversion_with_metering.py b/tests/integration/tier1/destructive/host-metering/test_run_conversion_with_metering.py index a4dbae0df7..68f7060cb6 100644 --- a/tests/integration/tier1/destructive/host-metering/test_run_conversion_with_metering.py +++ b/tests/integration/tier1/destructive/host-metering/test_run_conversion_with_metering.py @@ -16,6 +16,7 @@ # along with this program. If not, see . from conftest import TEST_VARS +import configparser def setup_test_metering_endpoint(): @@ -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 @@ -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(