From: Tim Beale Date: Tue, 20 Nov 2018 04:30:37 +0000 (+1300) Subject: tests: Fix flappiness in DRS tests due to RID Set changing X-Git-Tag: tdb-1.3.17~661 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a45e5b136bedfed1fa3a8b87b79da759c3958c4;p=thirdparty%2Fsamba.git tests: Fix flappiness in DRS tests due to RID Set changing The test_link_utdv_hwm test case in getnc_exop has started getting slightly flappy (8 failures in the last 2 weeks). The problem is the test case creates a new computer, which can occasionally result in a new RID pool being allocated. The problem can be reproduced by running the test case repeatedly (it usually fails after ~250 times). This patch updates the _check_ctr6() assertion to filter out the 'CN=RID Set' object, if it happens to be present. Signed-off-by: Tim Beale Reviewed-by: Andrew Bartlett --- diff --git a/source4/torture/drs/python/drs_base.py b/source4/torture/drs/python/drs_base.py index 77abd439794..d19e625021b 100644 --- a/source4/torture/drs/python/drs_base.py +++ b/source4/torture/drs/python/drs_base.py @@ -384,9 +384,20 @@ class DrsBaseTestCase(SambaToolCmdTest): """ Check that a ctr6 matches the specified parameters. """ - ctr6_dns = self._get_ctr6_dn_list(ctr6) - self.assertEqual(ctr6.object_count, len(expected_dns), + ctr6_raw_dns = self._get_ctr6_dn_list(ctr6) + + # filter out changes to the RID Set objects, as these can happen + # intermittently and mess up the test assertions + ctr6_dns = [] + for dn in ctr6_raw_dns: + if "CN=RID Set," in dn or "CN=RID Manager$," in dn: + print("Removing {0} from GetNCChanges reply".format(dn)) + else: + ctr6_dns.append(dn) + + self.assertEqual(len(ctr6_dns), len(expected_dns), "Received unexpected objects (%s)" % ctr6_dns) + self.assertEqual(ctr6.object_count, len(ctr6_raw_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)