selftest: Avoid returning errors (rather than failures) in gpo test
authorAndrew Bartlett <abartlet@samba.org>
Mon, 12 Nov 2012 10:48:46 +0000 (21:48 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 12 Nov 2012 23:00:25 +0000 (00:00 +0100)
This should help find the real cause of the flakey test, if it ever returns.

Andrew Bartlett

Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
source4/scripting/python/samba/tests/samba_tool/gpo.py

index 84154f5756356e5dd3a5d37e8903443f8fd72a19..c2e069d2b6197cbe60b7dcc160bf69770d5e6eba 100644 (file)
@@ -46,9 +46,11 @@ os.environ["SERVER"])
         """set up a temporary GPO to work with"""
         super(GpoCmdTestCase, self).setUp()
         (result, out, err) = self.runsubcmd("gpo", "create", self.gpo_name, "-H", "ldap://%s" % os.environ["SERVER"], "-U%s%%%s" % (os.environ["USERNAME"], os.environ["PASSWORD"]))
-        self.gpo_guid = "{%s}" % out.split("{")[1].split("}")[0]
-
         self.assertCmdSuccess(result, "Ensuring gpo created successfully")
+        try:
+            self.gpo_guid = "{%s}" % out.split("{")[1].split("}")[0]
+        except IndexError:
+            self.fail("Failed to find GUID in output: %s" % out)
 
     def tearDown(self):
         """remove the temporary GPO to work with"""