ldb sort tests: point out a known fails against Windows
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Mon, 14 Mar 2016 23:51:18 +0000 (12:51 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 22 Mar 2016 07:00:31 +0000 (08:00 +0100)
It seems that Windows 2012R2 has issues ordering attributes with the
"generalized time" syntax (2.5.5.11), and that these show up in our
tests when the number of elements exceeds 27. As far as I can tell
there is no logic to the results after that point.

To avoid failures, use the --elements option, like this:

python source4/dsdb/tests/python/sort.py --elements=25

Against Samba this makes no difference because we don't fail.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
source4/dsdb/tests/python/sort.py

index b7b9d836e8f11482aa05d0e99c13d561955dccd5..62d8fb80de506c7c798d0a5cb3551d56bf2315fd 100644 (file)
@@ -295,7 +295,7 @@ class BaseSortTests(samba.tests.TestCase):
         sort_functions = {'cn': cmp_binary,
                           "employeeNumber": cmp_locale,
                           "accountExpires": cmp_numeric,
-                          "msTSExpireDate4":cmp_binary}
+                          "msTSExpireDate4": cmp_binary}
         attrs = sort_functions.keys()
         attr_pairs = zip(attrs, attrs[1:] + attrs[:1])
 
@@ -312,8 +312,9 @@ class BaseSortTests(samba.tests.TestCase):
                                       controls=["server_sort:1:%d:%s" %
                                                 (rev, sort_attr)])
                 self.assertEqual(len(res), len(self.users))
+                pairs = (forward, reverse)[rev]
 
-                expected_order = [x[1] for x in (forward, reverse)[rev]]
+                expected_order = [x[1] for x in pairs]
                 received_order = [norm(x[result_attr][0]) for x in res]
 
                 if expected_order != received_order:
@@ -323,6 +324,17 @@ class BaseSortTests(samba.tests.TestCase):
                     print "unnormalised:", [x[result_attr][0] for x in res]
                     print "unnormalised: «%s»" % '»  «'.join(x[result_attr][0]
                                                              for x in res)
+                    print "pairs:", pairs
+                    # There are bugs in Windows that we don't want (or
+                    # know how) to replicate regarding timestamp sorting.
+                    # Let's remind ourselves.
+                    if result_attr == "msTSExpireDate4":
+                        print '-' * 72
+                        print ("This test fails against Windows with the "
+                               "default number of elements (33).")
+                        print "Try with --elements=27 (or similar)."
+                        print '-' * 72
+
                 self.assertEquals(expected_order, received_order)
                 for x in res:
                     if sort_attr in x: