summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorTim Beale <timbeale@catalyst.net.nz>2017-09-28 14:42:08 +1300
committerAndrew Bartlett <abartlet@samba.org>2017-10-20 04:05:21 +0200
commit499fa6b4a68f93f20df00dc776637fc93ae4c37b (patch)
treef992b83130efa2e0ea89f46ae8bb9cfa0959e087 /source4
parent831953656590c1d4725d2d798d3d6cdee8499513 (diff)
downloadsamba-499fa6b4a68f93f20df00dc776637fc93ae4c37b.tar.gz
selftest: Add test for initial link attribute RMD_VERSION value
While testing link conflicts I noticed that links on Windows start from a different RMD_VERSION compared to Samba. This adds a simple test to highlight the problem. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/drs/python/link_conflicts.py37
1 files changed, 32 insertions, 5 deletions
diff --git a/source4/torture/drs/python/link_conflicts.py b/source4/torture/drs/python/link_conflicts.py
index c8b65563ad6..6522fb610d6 100644
--- a/source4/torture/drs/python/link_conflicts.py
+++ b/source4/torture/drs/python/link_conflicts.py
@@ -141,14 +141,16 @@ class DrsReplicaLinkConflictTestCase(drs_base.DrsBaseTestCase):
self.assertTrue(val in res2[0][attr],
"%s '%s' not found on DC2" %(attr, val))
- def _check_replicated_links(self, src_obj_dn, expected_links):
- """Checks that replication sends back the expected linked attributes"""
-
+ def zero_highwatermark(self):
+ """Returns a zeroed highwatermark so that all DRS data gets returned"""
hwm = drsuapi.DsReplicaHighWaterMark()
hwm.tmp_highest_usn = 0
hwm.reserved_usn = 0
hwm.highest_usn = 0
+ return hwm
+ def _check_replicated_links(self, src_obj_dn, expected_links):
+ """Checks that replication sends back the expected linked attributes"""
self._check_replication([src_obj_dn],
drsuapi.DRSUAPI_DRS_WRIT_REP,
dest_dsa=None,
@@ -156,7 +158,7 @@ class DrsReplicaLinkConflictTestCase(drs_base.DrsBaseTestCase):
nc_dn_str=src_obj_dn,
exop=drsuapi.DRSUAPI_EXOP_REPL_OBJ,
expected_links=expected_links,
- highwatermark=hwm)
+ highwatermark=self.zero_highwatermark())
# Check DC2 as well
self.set_test_ldb_dc(self.ldb_dc2)
@@ -168,7 +170,7 @@ class DrsReplicaLinkConflictTestCase(drs_base.DrsBaseTestCase):
nc_dn_str=src_obj_dn,
exop=drsuapi.DRSUAPI_EXOP_REPL_OBJ,
expected_links=expected_links,
- highwatermark=hwm,
+ highwatermark=self.zero_highwatermark(),
drs=self.drs2, drs_handle=self.drs2_handle)
self.set_test_ldb_dc(self.ldb_dc1)
@@ -698,3 +700,28 @@ class DrsReplicaLinkConflictTestCase(drs_base.DrsBaseTestCase):
self._test_conflict_existing_single_valued_link(sync_order=DC1_TO_DC2)
self._test_conflict_existing_single_valued_link(sync_order=DC2_TO_DC1)
+ def test_link_attr_version(self):
+ """
+ Checks the link attribute version starts from the correct value
+ """
+ # create some objects and add a link
+ src_ou = self.unique_dn("OU=src")
+ src_guid = self.add_object(self.ldb_dc1, src_ou)
+ target1_ou = self.unique_dn("OU=target1")
+ target1_guid = self.add_object(self.ldb_dc1, target1_ou)
+ self.add_link_attr(self.ldb_dc1, src_ou, "managedBy", target1_ou)
+
+ # get the link info via replication
+ ctr6 = self._get_replication(drsuapi.DRSUAPI_DRS_WRIT_REP,
+ dest_dsa=None,
+ drs_error=drsuapi.DRSUAPI_EXOP_ERR_SUCCESS,
+ exop=drsuapi.DRSUAPI_EXOP_REPL_OBJ,
+ highwatermark=self.zero_highwatermark(),
+ nc_dn_str=src_ou)
+
+ self.assertTrue(ctr6.linked_attributes_count == 1,
+ "DRS didn't return a link")
+ link = ctr6.linked_attributes[0]
+ self.assertTrue(link.meta_data.version == 1,
+ "Link version started from %u, not 1" % link.meta_data.version)
+