tests: Add better error for DRS tests
authorTim Beale <timbeale@catalyst.net.nz>
Tue, 20 Nov 2018 04:15:41 +0000 (17:15 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 23 Nov 2018 04:00:22 +0000 (05:00 +0100)
We've got a flappy test hitting this assertion failure, but we can't
tell why it's failing intermittently (probably because we're bumping the
RID-Set, but there's no way to confirm this).

Add some extra debug info if the test assertion fails.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/torture/drs/python/drs_base.py

index 2e8598d529ba023ed8fabd09cc9ab6b98883138b..77abd439794510710b7fa6c41ada20cfc53f3375 100644 (file)
@@ -384,15 +384,15 @@ class DrsBaseTestCase(SambaToolCmdTest):
         """
         Check that a ctr6 matches the specified parameters.
         """
-        self.assertEqual(ctr6.object_count, len(expected_dns))
+        ctr6_dns = self._get_ctr6_dn_list(ctr6)
+        self.assertEqual(ctr6.object_count, len(expected_dns),
+                         "Received unexpected objects (%s)" % ctr6_dns)
         self.assertEqual(ctr6.linked_attributes_count, len(expected_links))
         self.assertEqual(ctr6.more_data, more_data)
         self.assertEqual(ctr6.nc_object_count, nc_object_count)
         self.assertEqual(ctr6.nc_linked_attributes_count, nc_linked_attributes_count)
         self.assertEqual(ctr6.drs_error[0], drs_error)
 
-        ctr6_dns = self._get_ctr6_dn_list(ctr6)
-
         i = 0
         for dn in expected_dns:
             # Expect them back in the exact same order as specified.