Debian Codegraph @

dirsrvtests/tests/suites/replication/conftest.py

raw
1 # --- BEGIN COPYRIGHT BLOCK ---
2 # Copyright (C) 2018 Red Hat, Inc.
3 # All rights reserved.
4 #
5 # License: GPL (version 3 or any later version).
6 # See LICENSE for details.
7 # --- END COPYRIGHT BLOCK ---
8 #
9 import os
10 import logging
11 import pytest
12 from test389.topologies import create_topology
13 from lib389._constants import ReplicaRole
14
15 DEBUGGING = os.getenv('DEBUGGING', default=False)
16 if DEBUGGING:
17 logging.getLogger(__name__).setLevel(logging.DEBUG)
18 else:
19 logging.getLogger(__name__).setLevel(logging.INFO)
20 log = logging.getLogger(__name__)
21
22
23 # Redefine some fixtures so we can use them with class scope
24 @pytest.fixture(scope="class")
25 def topology_m2(request):
26 """Create Replication Deployment with two suppliers"""
27
28 topology = create_topology({ReplicaRole.SUPPLIER: 2})
29
30 def fin():
31 if DEBUGGING:
32 [inst.stop() for inst in topology]
33 else:
34 [inst.delete() for inst in topology]
35 request.addfinalizer(fin)
36
37 return topology
38
39
40 @pytest.fixture(scope="class")
41 def topology_m3(request):
42 """Create Replication Deployment with three suppliers"""
43
44 topology = create_topology({ReplicaRole.SUPPLIER: 3})
45
46 def fin():
47 if DEBUGGING:
48 [inst.stop() for inst in topology]
49 else:
50 [inst.delete() for inst in topology]
51 request.addfinalizer(fin)
52
53 return topology