This is an automated email from the git hooks/post-receive script.
spichugi pushed a commit to branch master
in repository lib389.
commit 78e3fbaea6cb09a5caa88ec10e96975e25a8b2e2
Author: Simon Pichugin <spichugi(a)redhat.com>
Date: Tue Mar 21 18:55:52 2017 +0100
Issue 7 - Add pause and resume methods to topology fixtures
Description: For testing purposes, sometimes we need to pause the
replication on a big amount of agreements (4 and more, for instance).
Add the methods to the TopologyMain class of lib389/topologies.py module.
https://pagure.io/lib389/issue/7
Reviewed by: wibrown (Thanks!)
---
lib389/topologies.py | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/lib389/topologies.py b/lib389/topologies.py
index 56a8169..9b2258a 100644
--- a/lib389/topologies.py
+++ b/lib389/topologies.py
@@ -27,6 +27,8 @@ log = logging.getLogger(__name__)
class TopologyMain(object):
def __init__(self, standalones=None, masters=None,
consumers=None, hubs=None):
+ insts_with_agreements = {}
+
if standalones:
if isinstance(standalones, dict):
self.ins = standalones
@@ -34,10 +36,29 @@ class TopologyMain(object):
self.standalone = standalones
if masters:
self.ms = masters
+ insts_with_agreements.update(self.ms)
if consumers:
self.cs = consumers
+ insts_with_agreements.update(self.cs)
if hubs:
self.hs = hubs
+ insts_with_agreements.update(self.hs)
+
+ self._insts = {name: inst for name, inst in insts_with_agreements.items() if not
name.endswith('agmts')}
+
+ def pause_all_replicas(self):
+ """Pause all agreements in the class instance"""
+
+ for inst in self._insts.values():
+ for agreement in inst.agreement.list(suffix=DEFAULT_SUFFIX):
+ inst.agreement.pause(agreement.dn)
+
+ def resume_all_replicas(self):
+ """Resume all agreements in the class instance"""
+
+ for inst in self._insts.values():
+ for agreement in inst.agreement.list(suffix=DEFAULT_SUFFIX):
+ inst.agreement.resume(agreement.dn)
@pytest.fixture(scope="module")
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.