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.

--
David Kupka
From 6c9767df40c656ce45fb06b2018ab93eaa05034a 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 | 57 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index 85f669af618f8de759fe57d3e4410c1d6ce1f3e0..d37b616bd6efe437a1a979cc7a9ad8c7ea803773 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -857,6 +857,63 @@ def tree2_topo(master, replicas):
         yield master, replica
         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):
-- 
2.5.0

From 049917e146bc7ad1580e474d090cf4db5301af5f 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 0d50bf001f7450d36f9a52e68b07cf67eefc4e2c Mon Sep 17 00:00:00 2001
From: David Kupka <dku...@redhat.com>
Date: Wed, 10 Feb 2016 08:46:43 +0100
Subject: [PATCH 3/3] CI: Add test for 2-connected topology generator.

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

diff --git a/ipatests/test_integration/test_topologies.py b/ipatests/test_integration/test_topologies.py
index 86ca1904f17c6f8af2660c51862988d5229f07b7..f5332adbef12e8c18471592d4fd5c89097e2d4ed 100644
--- a/ipatests/test_integration/test_topologies.py
+++ b/ipatests/test_integration/test_topologies.py
@@ -96,3 +96,22 @@ 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),
+    ]
-- 
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