Skip to content

Commit

Permalink
Add support to change-components-stage in test-variable (#866)
Browse files Browse the repository at this point in the history
* Add support to change components stage in test-variable

Signed-off-by: mwaykole <[email protected]>

* Add support to change components stage

Signed-off-by: mwaykole <[email protected]>

---------

Signed-off-by: mwaykole <[email protected]>
  • Loading branch information
mwaykole authored Jul 31, 2023
1 parent 85a6c3c commit fdabe0c
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions ods_ci/utils/scripts/testconfig/generateTestConfigFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,25 @@ def parse_args():
action="store_true",
dest="skip_clone",
)
parser.add_argument(
"--components",
type=str,
dest="components",
help="Comma-separated list of components and their states (component1:state1,component2:state2,...)",
)

return parser.parse_args()

def change_component_state(components):
# Parse and convert the component states argument into a dictionary
component_states = {}
components_list = components.split(",")
for component in components_list:
comp, state = component.split(":")
component_states[comp] = True if state.lower() == "true" else False

return component_states


def get_prometheus_token(project):
"""
Expand All @@ -116,7 +133,8 @@ def get_prometheus_url(project):


def generate_test_config_file(
config_template, config_data, test_cluster, set_prometheus_config
config_template, config_data, test_cluster, set_prometheus_config,
components=None
):
"""
Generates test config file dynamically by
Expand Down Expand Up @@ -187,6 +205,9 @@ def generate_test_config_file(
data["DEFAULT_NOTIFICATION_EMAIL"] = config_data["DEFAULT_NOTIFICATION_EMAIL"]
data["RHM_TOKEN"] = config_data["RHM_TOKEN"]

if components:
data["COMPONENTS"] = change_component_state(components)

# Login to test cluster using oc command
oc_login(
data["OCP_CONSOLE_URL"],
Expand Down Expand Up @@ -230,7 +251,9 @@ def main():

# Generate test config file
generate_test_config_file(
args.config_template, config_data, args.test_cluster, args.set_prometheus_config
args.config_template, config_data, args.test_cluster, args.set_prometheus_config,
components=args.components,

)


Expand Down

0 comments on commit fdabe0c

Please sign in to comment.