On 10/02/16 08:51, David Kupka wrote:
This topology should be closer to the ones in real world than our
current ones. But it is still impractical and (hopefully) no one has
such deployment.
If some user could share his/her deployment topology I will be happy to
create generator based on it.

Updated patches attached.

--
David Kupka
From 6f5c46c6e99dc6639b7272d2d47f3cea1f4d4c5e Mon Sep 17 00:00:00 2001
From: David Kupka <dku...@redhat.com>
Date: Tue, 9 Feb 2016 15:45:45 +0100
Subject: [PATCH 1/3] CI: Add '2-connected' topology generator.

If number of servers (master+replicas) is equal to 4 + SUM(1, n, 2^n*5) for
any n >= 0:
 * every server has replication agreement with 2 - 4 other servers.
 * at least two agreements must fail in order to disconnect the topology.
Otherwise there can be server(s) with single agreement on the edge of the
topology.
---
 ipatests/test_integration/tasks.py | 58 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index 85f669af618f8de759fe57d3e4410c1d6ce1f3e0..77cba89825574f5354017bf184b106e94eb75c59 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -858,6 +858,64 @@ def tree2_topo(master, replicas):
         master = replica
 
 
+@_topo('2-connected')
+def two_connected_topo(master, replicas):
+    r"""No replica has more than 4 agreements and at least two
+        replicas must fail to disconnect the topology.
+
+         .     .     .     .
+         .     .     .     .
+         .     .     .     .
+     ... R --- R     R --- R ...
+          \   / \   / \   /
+           \ /   \ /   \ /
+        ... R     R     R ...
+             \   / \   /
+              \ /   \ /
+               M0 -- R2
+               |     |
+               |     |
+               R1 -- R3
+              . \   /  .
+             .   \ /    .
+            .     R      .
+                 .  .
+                .    .
+               .      .
+    """
+    grow = []
+    pool = [master] + replicas
+
+    try:
+        v0 = pool.pop(0)
+        v1 = pool.pop(0)
+        yield v0, v1
+
+        v2 = pool.pop(0)
+        yield v0, v2
+        grow.append((v0, v2))
+
+        v3 = pool.pop(0)
+        yield v2, v3
+        yield v1, v3
+        grow.append((v1, v3))
+
+        for (r, s) in grow:
+            t = pool.pop(0)
+
+            for (u, v) in [(r, t), (s, t)]:
+                yield u, v
+                w = pool.pop(0)
+                yield u, w
+                x = pool.pop(0)
+                yield v, x
+                yield w, x
+                grow.append((w, x))
+
+    except IndexError:
+        return
+
+
 def install_topo(topo, master, replicas, clients,
                  skip_master=False, setup_replica_cas=True):
     """Install IPA servers and clients in the given topology"""
-- 
2.5.0

From 8a66d160e47763abfc8838d7722bc0ea7face0fd Mon Sep 17 00:00:00 2001
From: David Kupka <dku...@redhat.com>
Date: Tue, 9 Feb 2016 17:12:00 +0100
Subject: [PATCH 2/3] CI: Add simple replication test in 2-connected topology.

---
 ipatests/test_integration/test_replication_layouts.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/ipatests/test_integration/test_replication_layouts.py b/ipatests/test_integration/test_replication_layouts.py
index 3a3e9641e8645c62c95c8d48ecf67f2dc32dbd4d..4dd3fb51b638970139043e0b33f01864ee003192 100644
--- a/ipatests/test_integration/test_replication_layouts.py
+++ b/ipatests/test_integration/test_replication_layouts.py
@@ -85,3 +85,21 @@ class TestCompleteTopologyWithCA(LayoutsBaseTest):
         tasks.install_topo('complete', self.master, self.replicas, [],
                            setup_replica_cas=True)
         self.replication_is_working()
+
+
+class Test2ConnectedTopologyWithoutCA(LayoutsBaseTest):
+    num_replicas = 33
+
+    def test_2_connected_topology_without_ca(self):
+        tasks.install_topo('2-connected', self.master, self.replicas, [],
+                           setup_replica_cas=False)
+        self.replication_is_working()
+
+
+class Test2ConnectedTopologyWithCA(LayoutsBaseTest):
+    num_replicas = 33
+
+    def test_2_connected_topology_with_ca(self):
+        tasks.install_topo('2-connected', self.master, self.replicas, [],
+                           setup_replica_cas=True)
+        self.replication_is_working()
-- 
2.5.0

From 865381cc60e579958fc384632e119fb3a8689a08 Mon Sep 17 00:00:00 2001
From: David Kupka <dku...@redhat.com>
Date: Wed, 10 Feb 2016 16:11:54 +0100
Subject: [PATCH 3/3] CI: Add test for 2-connected topology generator.

---
 ipatests/test_integration/test_topologies.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/ipatests/test_integration/test_topologies.py b/ipatests/test_integration/test_topologies.py
index 86ca1904f17c6f8af2660c51862988d5229f07b7..e12d141391840cc7f9150a178875393a96dd469b 100644
--- a/ipatests/test_integration/test_topologies.py
+++ b/ipatests/test_integration/test_topologies.py
@@ -96,3 +96,23 @@ def test_topology_complete():
         (2, 3),
     ]
     assert list(topo('M', [])) == []
+
+
+def test_topology_two_connected():
+    topo = tasks.get_topo('2-connected')
+    assert topo == tasks.two_connected_topo
+    assert list(topo('M', [1, 2, 3, 4, 5, 6, 7, 8])) == [
+        ('M', 1),
+        ('M', 2),
+        (2, 3),
+        (1, 3),
+        ('M', 4),
+        ('M', 5),
+        (4, 6),
+        (5, 6),
+        (2, 4),
+        (2, 7),
+        (4, 8),
+        (7, 8),
+    ]
+    assert list(topo('M', [])) == []
-- 
2.5.0

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to