diff --git a/e2e_test/hawk_test_driver.py b/e2e_test/hawk_test_driver.py index 7f3a837a..d81de030 100644 --- a/e2e_test/hawk_test_driver.py +++ b/e2e_test/hawk_test_driver.py @@ -47,6 +47,11 @@ class Xpath: HREF_CONFIGURATION = '//a[contains(@href, "#configurationMenu")]' HREF_CONFIG_EDIT = '//a[contains(@href, "config/edit")]' HREF_CRM_CONFIG_EDIT = '//a[contains(@href, "crm_config/edit")]' + HREF_CRM_CONFIG_FENCE_REACTION = '//option[contains(@value, "fence-reaction")]' + HREF_CRM_CONFIG_NO_QUORUM_POLICY = '//option[contains(@value, "no-quorum-policy")]' + HREF_CRM_CONFIG_STONITH_ACTION = '//option[contains(@value, "stonith-action")]' + HREF_CRM_CONFIG_NODE_HEALTH_STRATEGY = '//option[contains(@value, "node-health-strategy")]' + HREF_CRM_CONFIG_NODE_PLACEMENT_STRATEGY = '//option[contains(@value, "placement-strategy")]' HREF_CONSTRAINTS = '//a[contains(@href, "#constraints")]' HREF_DASHBOARD = '//a[contains(@href, "/dashboard")]' HREF_DELETE_FORMAT = '//a[contains(@href, "{}") and contains(@title, "Delete")]' @@ -551,10 +556,17 @@ def test_add_group(self, group): return False def test_check_cluster_configuration(self, ssh): + """ + The test does two things. + First, it checks that the available resources are correct. + Second, that the options of select-type resources are correct. + The test doesn't create those resources. + """ print(f"TEST: test_check_cluster_configuration: Check crm options") self.click_if_major_version("15", 'configuration') self.check_and_click_by_xpath("Click on Cluster Configuration", [Xpath.HREF_CRM_CONFIG_EDIT]) + ### 1. # The rsc_defaults and op_defaults are hardcoded in app/models/tableless.rb elem = self.find_element(By.NAME, 'temp_crm_config[rsc_defaults]') if not elem: @@ -572,9 +584,9 @@ def test_check_cluster_configuration(self, ssh): print(f"ERROR: temp_crm_config[op_defaults] has WRONG values") return False - # The crm_config is trickier. We should get those attribute from the crm_attribute - # in the newer versions of pacemaker.If it's an older version of pacemaker - # let's simply compare with a literal. + # The crm_config is trickier. We should get those attributes from the crm_attribute + # in the newer versions of pacemaker. If it's an older version of pacemaker + # let's simply compare it against LongLiterals.CRM_CONFIG_ATTRIBUTES. elem = self.find_element(By.NAME, 'temp_crm_config[crm_config]') if not elem: print(f"ERROR: Couldn't find element temp_crm_config[crm_config]") @@ -598,6 +610,36 @@ def test_check_cluster_configuration(self, ssh): print(f'ERROR: {Error.CRM_CONFIG_ADVANCED_ATTRIBUTES}, attr: {a}') return False + ### 2. + # Show out all but fence-reaction select-type resources + # (fence-reaction is a string the pacemaker-controld + # and a select in the crm_attribute. Let's not overengineer.) + elem.click() + for xref in [Xpath.HREF_CRM_CONFIG_NO_QUORUM_POLICY, + Xpath.HREF_CRM_CONFIG_STONITH_ACTION, + Xpath.HREF_CRM_CONFIG_NODE_HEALTH_STRATEGY, + Xpath.HREF_CRM_CONFIG_NODE_PLACEMENT_STRATEGY]: + self.check_and_click_by_xpath(f'Couldn\'t find {xref} resource in the drop-down list', + [xref]) + time.sleep(1) + + # ["", ["", ",..."]] + for check_options in [ ["no-quorum-policy", ["stop", "freeze", "ignore", "demote", "suicide"]], + ["stonith-action", ["reboot", "off", "poweroff"]], + ["node-health-strategy", ["none", "migrate-on-red", "only-green", "progressive", "custom"]], + ["placement-strategy", ["default", "utilization", "minimal", "balanced"]]]: + elem = self.find_element(By.NAME, f'crm_config[crm_config][{check_options[0]}]') + if not elem: + print(f'ERROR: Couldn\'t find {check_options[0]}') + return False + + lst = elem.text.split('\n') + lst.sort() + check_options[1].sort() + if lst != check_options[1]: + print(f'ERROR: {check_options[0]} options. Expected: {lst}, are: {check_options[1]}') + return False + time.sleep(self.timeout_scale) return self.test_status diff --git a/hawk/app/assets/javascripts/module/attrlist.js b/hawk/app/assets/javascripts/module/attrlist.js index 051d7d58..68005192 100644 --- a/hawk/app/assets/javascripts/module/attrlist.js +++ b/hawk/app/assets/javascripts/module/attrlist.js @@ -36,7 +36,7 @@ '
', '
', - '{^{if ~root.mapping[key]["type"] == "enum"}}', + '{^{if (~root.mapping[key]["type"] == "enum" || ~root.mapping[key]["type"] == "select" )}}', '