summaryrefslogtreecommitdiffstats
path: root/ipatests/test_integration/test_replication_layouts.py
blob: f1408453b3a88248f630da4bc08ea489595162e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#
# Copyright (C) 2015  FreeIPA Contributors see COPYING for license
#

import time
import pytest
from ipalib.constants import DOMAIN_LEVEL_0
from ipatests.pytest_plugins.integration.env_config import get_global_config
from ipatests.test_integration.base import IntegrationTest
from ipatests.pytest_plugins.integration import tasks

config = get_global_config()

class LayoutsBaseTest(IntegrationTest):

    @classmethod
    def install(cls, mh):
        # tests use custom installation
        pass

    def replication_is_working(self):
        test_user = 'replication-testuser'
        self.master.run_command(
            ['ipa', 'user-add', test_user, '--first', 'test', '--last', 'user']
        )

        time.sleep(60)  # make sure the replication of user is done

        for r in self.replicas:
            r.run_command(['ipa', 'user-show', test_user])


@pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
                    reason='does not work on DOMAIN_LEVEL_0 by design')
class TestLineTopologyWithoutCA(LayoutsBaseTest):

    num_replicas = 3

    def test_line_topology_without_ca(self):
        tasks.install_topo('line', self.master, self.replicas, [],
                           setup_replica_cas=False)
        self.replication_is_working()


class TestLineTopologyWithCA(LayoutsBaseTest):

    num_replicas = 3

    def test_line_topology_with_ca(self):
        tasks.install_topo('line', self.master, self.replicas, [],
                           setup_replica_cas=True)
        self.replication_is_working()


class TestLineTopologyWithCAKRA(LayoutsBaseTest):

    num_replicas = 3

    def test_line_topology_with_ca_kra(self):
        tasks.install_topo('line', self.master, self.replicas, [],
                           setup_replica_cas=True, setup_replica_kras=True)
        self.replication_is_working()


class TestStarTopologyWithoutCA(LayoutsBaseTest):

    num_replicas = 3

    def test_star_topology_without_ca(self):
        tasks.install_topo('star', self.master, self.replicas, [],
                           setup_replica_cas=False)
        self.replication_is_working()


class TestStarTopologyWithCA(LayoutsBaseTest):

    num_replicas = 3

    def test_star_topology_with_ca(self):
        tasks.install_topo('star', self.master, self.replicas, [],
                           setup_replica_cas=True)
        self.replication_is_working()


class TestStarTopologyWithCAKRA(LayoutsBaseTest):

    num_replicas = 3

    def test_star_topology_with_ca_kra(self):
        tasks.install_topo('star', self.master, self.replicas, [],
                           setup_replica_cas=True, setup_replica_kras=True)
        self.replication_is_working()


class TestCompleteTopologyWithoutCA(LayoutsBaseTest):

    num_replicas = 3

    def test_complete_topology_without_ca(self):
        tasks.install_topo('complete', self.master, self.replicas, [],
                           setup_replica_cas=False)
        self.replication_is_working()


class TestCompleteTopologyWithCA(LayoutsBaseTest):

    num_replicas = 3

    def test_complete_topology_with_ca(self):
        tasks.install_topo('complete', self.master, self.replicas, [],
                           setup_replica_cas=True)
        self.replication_is_working()


class TestCompleteTopologyWithCAKRA(LayoutsBaseTest):

    num_replicas = 3

    def test_complete_topology_with_ca_kra(self):
        tasks.install_topo('complete', self.master, self.replicas, [],
                           setup_replica_cas=True, setup_replica_kras=True)
        self.replication_is_working()


@pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
                    reason='does not work on DOMAIN_LEVEL_0 by design')
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()


class Test2ConnectedTopologyWithCAKRA(LayoutsBaseTest):
    num_replicas = 33

    def test_2_connected_topology_with_ca_kra(self):
        tasks.install_topo('2-connected', self.master, self.replicas, [],
                           setup_replica_cas=True, setup_replica_kras=True)
        self.replication_is_working()


@pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
                    reason='does not work on DOMAIN_LEVEL_0 by design')
class TestDoubleCircleTopologyWithoutCA(LayoutsBaseTest):
    num_replicas = 29

    def test_2_connected_topology_with_ca(self):
        tasks.install_topo('double-circle', self.master, self.replicas, [],
                           setup_replica_cas=False)
        self.replication_is_working()


class TestDoubleCircleTopologyWithCA(LayoutsBaseTest):
    num_replicas = 29

    def test_2_connected_topology_with_ca(self):
        tasks.install_topo('double-circle', self.master, self.replicas, [],
                           setup_replica_cas=True)
        self.replication_is_working()


class TestDoubleCircleTopologyWithCAKRA(LayoutsBaseTest):
    num_replicas = 29

    def test_2_connected_topology_with_ca_kra(self):
        tasks.install_topo('double-circle', self.master, self.replicas, [],
                           setup_replica_cas=True, setup_replica_kras=True)
        self.replication_is_working()