summaryrefslogtreecommitdiff
path: root/source4/torture/drs
diff options
context:
space:
mode:
authorTim Beale <timbeale@catalyst.net.nz>2017-05-23 14:37:56 +1200
committerGarming Sam <garming@samba.org>2017-09-18 05:51:24 +0200
commit172eedc0760b5d471af091c2f08ea70f17b36293 (patch)
treece21dae6d8f130f451d80facb7cfcd80a95cae9d /source4/torture/drs
parentaf38d73b06c0c40ef59c2ffe0fc6580b0787b7d0 (diff)
downloadsamba-172eedc0760b5d471af091c2f08ea70f17b36293.tar.gz
getnc_exop.py: Fix GET_TGT behaviour in DRS tests
The existing code never passed the more_flags parameter into the actual getNCChanges request, i.e. _getnc_req10(). This meant the existing GET_TGT tests effectively did nothing. Passing the flag through properly means we have to now change the tests as the DNs returned by Windows now include any target objects in the linked attributes. These tests now fail against Samba (because it doesn't support GET_TGT yet). Also added comments to the tests to help explain what they are actually doing. Note that Samba and Windows can return the objects in different orders, due to significant differences in their underlying DB implementations (Windows stores links in a separate DB, so sends links ordered strictly by USN, whereas Samba sends links based on the USN of the source object). To make the test a fair comparison between Windows and Samba, we need to use dn_ordered=False. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'source4/torture/drs')
-rw-r--r--source4/torture/drs/python/drs_base.py3
-rw-r--r--source4/torture/drs/python/getnc_exop.py20
2 files changed, 18 insertions, 5 deletions
diff --git a/source4/torture/drs/python/drs_base.py b/source4/torture/drs/python/drs_base.py
index e79f076268c..57bb0545ea0 100644
--- a/source4/torture/drs/python/drs_base.py
+++ b/source4/torture/drs/python/drs_base.py
@@ -279,7 +279,8 @@ class DrsBaseTestCase(SambaToolCmdTest):
nc_dn_str=nc_dn_str,
exop=exop,
max_objects=max_objects,
- replica_flags=replica_flags)
+ replica_flags=replica_flags,
+ more_flags=more_flags)
req10.highwatermark = highwatermark
if uptodateness_vector is not None:
uptodateness_vector_v1 = drsuapi.DsReplicaCursorCtrEx()
diff --git a/source4/torture/drs/python/getnc_exop.py b/source4/torture/drs/python/getnc_exop.py
index 37e5333e245..b87404926f2 100644
--- a/source4/torture/drs/python/getnc_exop.py
+++ b/source4/torture/drs/python/getnc_exop.py
@@ -434,11 +434,16 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase):
drsuapi.DRSUAPI_DRS_GET_ANC,
expected_links=[dc3_managedBy_ou1])
- self._check_replication([dc3],
+ # GET_TGT seems to override DRS_CRITICAL_ONLY and also returns any
+ # object(s) that relate to the linked attributes (similar to GET_ANC)
+ self._check_replication([ou1, dc3],
drsuapi.DRSUAPI_DRS_CRITICAL_ONLY,
more_flags=drsuapi.DRSUAPI_DRS_GET_TGT,
- expected_links=[dc3_managedBy_ou1])
+ expected_links=[dc3_managedBy_ou1], dn_ordered=False)
+ # Change DC3's managedBy to OU2 instead of OU1
+ # Note that the OU1 managedBy linked attribute will still exist as
+ # a tombstone object (and so will be returned in the replication still)
m = ldb.Message()
m.dn = ldb.Dn(self.ldb_dc1, dc3)
m["managedBy"] = ldb.MessageElement(ou2, ldb.FLAG_MOD_REPLACE, "managedBy")
@@ -467,11 +472,16 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase):
drsuapi.DRSUAPI_DRS_GET_ANC,
expected_links=[dc3_managedBy_ou1,dc3_managedBy_ou2])
- self._check_replication([dc3],
+ # GET_TGT will also return any DNs referenced by the linked attributes
+ # (including the Tombstone attribute)
+ self._check_replication([ou1, ou2, dc3],
drsuapi.DRSUAPI_DRS_CRITICAL_ONLY,
more_flags=drsuapi.DRSUAPI_DRS_GET_TGT,
- expected_links=[dc3_managedBy_ou1,dc3_managedBy_ou2])
+ expected_links=[dc3_managedBy_ou1,dc3_managedBy_ou2], dn_ordered=False)
+ # Use the highwater-mark prior to changing ManagedBy - this should
+ # only return the old/Tombstone and new linked attributes (we already
+ # know all the DNs)
self._check_replication([],
drsuapi.DRSUAPI_DRS_WRIT_REP,
expected_links=[dc3_managedBy_ou1,dc3_managedBy_ou2],
@@ -500,6 +510,8 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase):
expected_links=[dc3_managedBy_ou1,dc3_managedBy_ou2],
highwatermark=hwm7)
+ # Repeat the above set of tests using the uptodateness_vector
+ # instead of the highwater-mark
self._check_replication([],
drsuapi.DRSUAPI_DRS_WRIT_REP,
expected_links=[dc3_managedBy_ou1,dc3_managedBy_ou2],