@@ -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