Skip to content

Commit 6297a42

Browse files
committed
integration test fix
Signed-off-by: Abhishek Kumar <[email protected]>
1 parent 69ede10 commit 6297a42

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

test/integration/smoke/test_extension_custom.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ def test_02_run_custom_action(self):
533533
self.apiclient,
534534
extensionid=self.extension.id,
535535
name=name,
536+
enabled=True,
536537
details=details,
537538
parameters=parameters,
538539
successmessage='Successfully completed {{actionName}}'
@@ -579,6 +580,7 @@ def test_03_run_invalid_custom_action(self):
579580
self.apiclient,
580581
extensionid=self.extension.id,
581582
name=name,
583+
enabled=True,
582584
errormessage='Failed {{actionName}}'
583585
)
584586
self.cleanup.append(self.custom_action)

test/integration/smoke/test_extension_custom_action_lifecycle.py

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,36 @@ def test_04_extension_update_custom_action(self):
236236
self.assertEqual(v, actual, f"Parameter property for key '{k}' should be '{v}'")
237237

238238
@attr(tags=["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
239-
def test_05_extension_run_custom_action_fail(self):
239+
def test_05_extension_run_custom_action_invalid_resource_type_fail(self):
240240
name = random_gen()
241241
self.custom_action = ExtensionCustomAction.create(
242242
self.apiclient,
243243
extensionid=self.extension.id,
244-
name=name
244+
name=name,
245+
enabled=True
246+
)
247+
self.cleanup.append(self.custom_action)
248+
try:
249+
self.custom_action.run(
250+
self.apiclient,
251+
resourcetype='Host',
252+
resourceid='abcd'
253+
)
254+
self.fail(f"Invalid resource custom action: {name} ran successfully")
255+
except Exception as e:
256+
msg = str(e)
257+
if msg.startswith("Job failed") == False or "Internal error running action" not in msg == False:
258+
self.fail(f"Unknown exception occurred: {e}")
259+
pass
260+
261+
@attr(tags=["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
262+
def test_06_extension_run_custom_action_fail(self):
263+
name = random_gen()
264+
self.custom_action = ExtensionCustomAction.create(
265+
self.apiclient,
266+
extensionid=self.extension.id,
267+
name=name,
268+
enabled=True
245269
)
246270
self.cleanup.append(self.custom_action)
247271
try:
@@ -251,6 +275,7 @@ def test_05_extension_run_custom_action_fail(self):
251275
)
252276
self.fail(f"Invalid resource custom action: {name} ran successfully")
253277
except Exception as e:
254-
if str(e).startswith("Job failed") == False:
278+
msg = str(e)
279+
if msg.startswith("Job failed") == False or "Invalid action" not in msg == False:
255280
self.fail(f"Unknown exception occurred: {e}")
256281
pass

0 commit comments

Comments
 (0)