getncchanges.py: Add a multi-valued linked attribute test
authorTim Beale <timbeale@catalyst.net.nz>
Tue, 15 Aug 2017 00:18:02 +0000 (12:18 +1200)
committerGarming Sam <garming@samba.org>
Mon, 18 Sep 2017 03:51:25 +0000 (05:51 +0200)
Add a test where a source object links to multiple different targets.
First we do the replication without GET_TGT and check that the server
can handle sending a chunk containing only links (in the middle of the
replication). Then we repeat the replication forcing GET_TGT to be used.

To avoid having to create 1500 objects/links, I've lowered the 'max
link sync' setting on the vampire_dc testenv to 250.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
selftest/knownfail.d/getncchanges
selftest/target/Samba4.pm
source4/torture/drs/python/getncchanges.py

index 64e2c4284d3ea4b126160ee9318e7c17bdb8851b..5ef1bc98befbf815357cdbbde20d45d3fbf31bec 100644 (file)
@@ -3,3 +3,4 @@
 samba4.drs.getncchanges.python\(promoted_dc\).getncchanges.DrsReplicaSyncIntegrityTestCase.test_repl_get_tgt\(promoted_dc\)
 samba4.drs.getncchanges.python\(promoted_dc\).getncchanges.DrsReplicaSyncIntegrityTestCase.test_repl_get_tgt_chain\(promoted_dc\)
 samba4.drs.getncchanges.python\(promoted_dc\).getncchanges.DrsReplicaSyncIntegrityTestCase.test_repl_get_tgt_and_anc\(promoted_dc\)
+samba4.drs.getncchanges.python\(promoted_dc\).getncchanges.DrsReplicaSyncIntegrityTestCase.test_repl_get_tgt_multivalued_links\(promoted_dc\)
index 3d148850e07e44e295f00d790e4113dc0dc9bfbd..7930a4ec8a8cf81bd6553371c5b51ea6290e83c3 100755 (executable)
@@ -1293,7 +1293,8 @@ sub provision_vampire_dc($$$)
        if ($fl == "2000") {
                $name = "vampire2000dc";
        } else {
-               $extra_conf = "drs: immediate link sync = yes";
+               $extra_conf = "drs: immediate link sync = yes
+                       drs: max link sync = 250";
        }
 
        # We do this so that we don't run the provision.  That's the job of 'net vampire'.
index bf0066911d0617e3633919585dad0e12e1d5b8cd..9022f4a19095f3c7edbd07fc95637da0170fe2d5 100644 (file)
@@ -1045,6 +1045,59 @@ class DrsReplicaSyncIntegrityTestCase(drs_base.DrsBaseTestCase):
         # cleanup the server object we created in the Configuration partition
         self.test_ldb_dc.delete(la_source)
 
+    def test_repl_get_tgt_multivalued_links(self):
+        """Tests replication with multi-valued link attributes."""
+
+        # create the target/source objects and link them together
+        la_targets = self.create_object_range(0, 500, prefix="la_tgt")
+        la_source = "CN=la_src,%s" % self.ou
+        self.add_object(la_source, objectclass="msExchConfigurationContainer")
+
+        for tgt in la_targets:
+            self.modify_object(la_source, "addressBookRoots2", tgt)
+
+        filler = self.create_object_range(0, 100, prefix="filler")
+
+        # We should receive the objects/links in the following order:
+        # [500 targets + 1 source][500 links][100 filler]
+        expected_objects = la_targets + [la_source] + filler
+        link_only_chunk = False
+
+        # First do the replication without needing GET_TGT
+        while not self.replication_complete():
+            ctr6 = self.repl_get_next()
+
+            if ctr6.object_count == 0 and ctr6.linked_attributes_count != 0:
+                link_only_chunk = True
+
+        # we should receive one chunk that contains only links
+        self.assertTrue(link_only_chunk,
+                        "Expected to receive a chunk containing only links")
+
+        # check we received all the expected objects/links
+        self.assert_expected_data(expected_objects)
+        self.assert_expected_links([la_source], link_attr="addressBookRoots2", num_expected=500)
+
+        # Do the replication again, forcing the use of GET_TGT this time
+        self.init_test_state()
+
+        for x in range(0, 500):
+            self.modify_object(la_targets[x], "displayName", "OU-%d" % x)
+
+        # The objects/links should get sent in the following order:
+        # [1 source][500 targets][500 links][100 filler]
+
+        while not self.replication_complete():
+            ctr6 = self.repl_get_next()
+
+        self.assertTrue(self.used_get_tgt,
+                        "Test didn't use the GET_TGT flag as expected")
+
+        # check we received all the expected objects/links
+        self.assert_expected_data(expected_objects)
+        self.assert_expected_links([la_source], link_attr="addressBookRoots2", num_expected=500)
+
+
 class DcConnection:
     """Helper class to track a connection to another DC"""