Skip to content

Commit

Permalink
Merge pull request #286 from aleksei-burlakov/update-test-add-primitive
Browse files Browse the repository at this point in the history
Update: test_add_primitive
  • Loading branch information
aleksei-burlakov authored Sep 7, 2024
2 parents a23057e + 42b1789 commit 8945dc8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
15 changes: 5 additions & 10 deletions e2e_test/hawk_test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Error:

# XPATH constants
class Xpath:
ANYTHING_OPT_LIST = '//option[contains(@value, "anything")]'
DUMMY_OPT_LIST = '//option[contains(@value, "Dummy")]'
CLICK_OK_SUBMIT = '//*[@id="modal"]/div/div/form/div[3]/input'
CLONE_CHILD = '//select[contains(@data-help-filter, ".row.resource") and contains(@name, "clone[child]")]'
CLONE_DATA_HELP_FILTER = '//a[contains(@data-help-filter, ".clone")]'
Expand Down Expand Up @@ -602,13 +602,8 @@ def test_add_primitive(self, primitive):
print(f"ERROR: Couldn't find element [primitive[type]]. Cannot add primitive [{primitive}].")
return False
elem.click()
self.check_and_click_by_xpath("Couldn't find value [anything] for primitive type",
[Xpath.ANYTHING_OPT_LIST])
elem = self.find_element(By.NAME, 'primitive[params][binfile]')
if not elem:
print("ERROR: Couldn't find element [primitive[params][binfile]]")
return False
elem.send_keys("file")
self.check_and_click_by_xpath("Couldn't find value [Dummy] for primitive type",
[Xpath.DUMMY_OPT_LIST])
# Set start timeout value in 35s
self.check_and_click_by_xpath("Couldn't find edit button for start operation",
[Xpath.EDIT_START_TIMEOUT, Xpath.MODAL_TIMEOUT])
Expand Down Expand Up @@ -642,7 +637,7 @@ def test_add_primitive(self, primitive):
elem.click()
status = self.verify_success()
if status:
print(f"INFO: Successfully added primitive [{primitive}] of class [ocf:heartbeat:anything]")
print(f"INFO: Successfully added primitive [{primitive}] of class [ocf:heartbeat:Dummy]")
else:
print(f"ERROR: Could not create primitive [{primitive}]")
return status
Expand All @@ -662,7 +657,7 @@ def remove_rsc(self, name):
self.check_and_click_by_xpath(f"Cannot delete resource [{name}]", [Xpath.HREF_DELETE_FORMAT.format(name)])
time.sleep(2)
self.check_and_click_by_xpath(f"Cannot confirm delete of resource [{name}]", [Xpath.COMMIT_BTN_DANGER])
time.sleep(2)
time.sleep(20)
self.check_and_click_by_xpath("Couldn't find Edit Configuration element", [Xpath.HREF_CONFIG_EDIT])
time.sleep(3)
if not self.test_status:
Expand Down
4 changes: 2 additions & 2 deletions e2e_test/hawk_test_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def verify_primitive(self, primitive, version, results):
False when configuration is not defined in configuration
'''
print(f"TEST: verify_primitive: check primitive [{primitive}] exists")
matches = [f"{primitive} anything", "binfile=file", "op start timeout=35s",
matches = [f"{primitive} Dummy", "op start timeout=35s",
"op monitor timeout=9s interval=13s", "meta target-role=Started"]
if Version(version) < Version('15'):
matches.append("op stop timeout=15s")
Expand All @@ -154,7 +154,7 @@ def verify_primitive_removed(self, primitive, results):
False when configuration is not removed
'''
print(f"TEST: verify_primitive_removed: check primitive [{primitive}] is removed")
if self.check_cluster_conf_ssh("crm resource status | grep ocf::heartbeat:anything", ''):
if self.check_cluster_conf_ssh("crm resource status | grep ocf::heartbeat:Dummy", ''):
print("INFO: primitive successfully removed")
self.set_test_status(results, 'verify_primitive_removed', 'passed')
return True
Expand Down
1 change: 1 addition & 0 deletions hawk/app/controllers/agents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def show
else
@name = params[:id]
end
@name = CGI.unescape(@name)
@agent = Util.get_metadata_hash(@name)

if @agent
Expand Down

0 comments on commit 8945dc8

Please sign in to comment.