mirror of
https://github.com/samba-team/samba.git
synced 2025-12-06 16:23:49 +03:00
downgradedatabase: blackbox: check ordered integer removed
Test that when we undo GUID indexing on a TDB-backed database with downgradedatabase, ORDERED_INTEGER is removed from @ATTRIBUTES Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
committed by
Andrew Bartlett
parent
08b9d204b6
commit
d6ded22cb6
@@ -83,11 +83,28 @@ class DowngradeTest(BlackboxTestCase):
|
||||
|
||||
return dn_keys_no_at_attrs, guid_keys
|
||||
|
||||
# Check that sambadowngradedatabase replaces all GUID keys with DN keys
|
||||
# Get a set of all distinct types in @ATTRIBUTES
|
||||
def attribute_types(self):
|
||||
at_attributes = self.ldb.search(base="@ATTRIBUTES",
|
||||
scope=ldb.SCOPE_BASE,
|
||||
attrs=["*"])
|
||||
self.assertEqual(len(at_attributes), 1)
|
||||
keys = at_attributes[0].keys()
|
||||
attribute_types = {str(at_attributes[0].get(k)) for k in keys}
|
||||
|
||||
return attribute_types
|
||||
|
||||
# Check that running sambadowngradedatabase with a TDB backend:
|
||||
# * Replaces all GUID keys with DN keys
|
||||
# * Removes ORDERED_INTEGER from @ATTRIBUTES
|
||||
def test_downgrade_database(self):
|
||||
type_prefix = "LDB_SYNTAX_"
|
||||
ordered_int_type = ldb.SYNTAX_ORDERED_INTEGER[len(type_prefix):]
|
||||
|
||||
dn_keys, guid_keys = self.ldbdump_keys_pack_formats()
|
||||
self.assertGreater(len(guid_keys), 20)
|
||||
self.assertEqual(len(dn_keys), 0)
|
||||
self.assertTrue(ordered_int_type in self.attribute_types())
|
||||
|
||||
num_guid_keys_before_downgrade = len(guid_keys)
|
||||
|
||||
@@ -97,3 +114,4 @@ class DowngradeTest(BlackboxTestCase):
|
||||
dn_keys, guid_keys = self.ldbdump_keys_pack_formats()
|
||||
self.assertEqual(len(guid_keys), 0)
|
||||
self.assertEqual(len(dn_keys), num_guid_keys_before_downgrade)
|
||||
self.assertTrue(ordered_int_type not in self.attribute_types())
|
||||
|
||||
Reference in New Issue
Block a user