Debian Codegraph @

tests/test_ipa_topology.py

raw symbols SCIP
1 #
2 # Copyright (C) 2019 FreeIPA Contributors see COPYING for license
3 #
4
5 from utilscip-python python ipahealthcheck 0.16 util/__init__: import capture_resultsscip-python python ipahealthcheck 0.16 `tests.util`/capture_results().
6 from utilscip-python python ipahealthcheck 0.16 util/__init__: import m_apiscip-python python ipahealthcheck 0.16 `tests.util`/m_api.
7 from basescip-python python ipahealthcheck 0.16 base/__init__: import BaseTestscip-python python ipahealthcheck 0.16 `tests.base`/BaseTest#
8
9 from ipahealthcheck.corescip-python python ipahealthcheck 0.16 `ipahealthcheck.core`/__init__: import config, constants
10 from ipahealthcheck.ipa.pluginscip-python python ipahealthcheck 0.16 `ipahealthcheck.ipa.plugin`/__init__: import registry
11 from ipahealthcheck.ipa.topologyscip-python python ipahealthcheck 0.16 `ipahealthcheck.ipa.topology`/__init__: import IPATopologyDomainCheck
12
13
14 class TestTopologyscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#(BaseTestscip-python python ipahealthcheck 0.16 `tests.base`/BaseTest#):
15 def test_topology_okscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_ok().(selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_ok().(self)):
16 m_apiscip-python python ipahealthcheck 0.16 `tests.util`/m_api..Command.topologysuffix_verify.side_effect = [
17 {
18 u'result': {
19 u"in_order": True,
20 }
21 },
22 {
23 u'result': {
24 u"in_order": True,
25 }
26 },
27 ]
28 m_apiscip-python python ipahealthcheck 0.16 `tests.util`/m_api..Command.ca_is_enabled.return_value = {'result': True}
29
30 framework = objectscip-python python python-stdlib 3.11 builtins/object#()
31 registry.initialize(framework, config.Config)
32 f = IPATopologyDomainCheck(registry)
33
34 selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_ok().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results. = capture_resultsscip-python python ipahealthcheck 0.16 `tests.util`/capture_results().(f)
35
36 assert len(selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_ok().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results.) == 2
37
38 for result in selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_ok().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results..results:
39 assert result.result == constants.SUCCESS
40 assert result.source == 'ipahealthcheck.ipa.topology'
41 assert result.check == 'IPATopologyDomainCheck'
42
43 def test_topology_domain_badscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_domain_bad().(selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_domain_bad().(self)):
44 m_apiscip-python python ipahealthcheck 0.16 `tests.util`/m_api..Command.topologysuffix_verify.side_effect = [
45 {
46 u'result': {
47 u"connect_errors": [
48 [
49 u"ipa.example.test",
50 [u"ipa.example.test"],
51 [u"replica2.example.test"]
52 ],
53 [
54 u"replica2.example.test",
55 [u"replica2.example.test"],
56 [u"ipa.example.test"]
57 ]
58 ],
59 u"in_order": False,
60 u"max_agmts": 4,
61 u"max_agmts_errors": []
62 }
63 },
64 {
65 u'result': {
66 u"in_order": True,
67 }
68 },
69 ]
70 m_apiscip-python python ipahealthcheck 0.16 `tests.util`/m_api..Command.ca_is_enabled.return_value = {'result': True}
71
72 framework = objectscip-python python python-stdlib 3.11 builtins/object#()
73 registry.initialize(framework, config.Config)
74 f = IPATopologyDomainCheck(registry)
75
76 selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_domain_bad().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results. = capture_resultsscip-python python ipahealthcheck 0.16 `tests.util`/capture_results().(f)
77
78 assert len(selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_domain_bad().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results.) == 3
79
80 for result in selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_domain_bad().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results..results:
81 assert result.source == 'ipahealthcheck.ipa.topology'
82 assert result.check == 'IPATopologyDomainCheck'
83
84 # The first two results are failures in the domain suffix, the
85 # third is a success in the ca suffix.
86 result = selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_domain_bad().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results..results[0]
87 assert result.result == constants.ERROR
88 assert result.kw.get('key') == 'ipa.example.test'
89 assert result.kw.get('replicas') == ['replica2.example.test']
90 assert result.kw.get('suffix') == 'domain'
91 assert result.kw.get('type') == 'connect'
92 assert 'can\'t contact servers' in result.kw.get('msg')
93
94 result = selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_domain_bad().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results..results[1]
95 assert result.result == constants.ERROR
96 assert result.kw.get('key') == 'replica2.example.test'
97 assert result.kw.get('replicas') == ['ipa.example.test']
98 assert result.kw.get('suffix') == 'domain'
99 assert result.kw.get('type') == 'connect'
100 assert 'can\'t contact servers' in result.kw.get('msg')
101
102 result = selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_domain_bad().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results..results[2]
103 assert result.result == constants.SUCCESS
104 assert result.kw.get('suffix') == 'ca'
105
106 def test_topology_ca_badscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_ca_bad().(selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_ca_bad().(self)):
107 m_apiscip-python python ipahealthcheck 0.16 `tests.util`/m_api..Command.topologysuffix_verify.side_effect = [
108 {
109 u'result': {
110 u"in_order": True,
111 }
112 },
113 {
114 u'result': {
115 u"connect_errors": [
116 [
117 u"ipa.example.test",
118 [u"ipa.example.test"],
119 [u"replica2.example.test"]
120 ],
121 [
122 u"replica2.example.test",
123 [u"replica2.example.test"],
124 [u"ipa.example.test"]
125 ]
126 ],
127 u"in_order": False,
128 u"max_agmts": 4,
129 u"max_agmts_errors": []
130 }
131 },
132 ]
133 m_apiscip-python python ipahealthcheck 0.16 `tests.util`/m_api..Command.ca_is_enabled.return_value = {'result': True}
134
135 framework = objectscip-python python python-stdlib 3.11 builtins/object#()
136 registry.initialize(framework, config.Config)
137 f = IPATopologyDomainCheck(registry)
138
139 selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_ca_bad().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results. = capture_resultsscip-python python ipahealthcheck 0.16 `tests.util`/capture_results().(f)
140
141 assert len(selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_ca_bad().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results.) == 3
142
143 for result in selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_ca_bad().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results..results:
144 assert result.source == 'ipahealthcheck.ipa.topology'
145 assert result.check == 'IPATopologyDomainCheck'
146
147 # The first result is ok (domain) and the last two are failures
148 # (ca)
149 result = selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_ca_bad().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results..results[0]
150 assert result.result == constants.SUCCESS
151 assert result.kw.get('suffix') == 'domain'
152
153 result = selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_ca_bad().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results..results[1]
154 assert result.result == constants.ERROR
155 assert result.kw.get('key') == 'ipa.example.test'
156 assert result.kw.get('replicas') == ['replica2.example.test']
157 assert result.kw.get('suffix') == 'ca'
158 assert result.kw.get('type') == 'connect'
159 assert 'can\'t contact servers' in result.kw.get('msg')
160
161 result = selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_ca_bad().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results..results[2]
162 assert result.result == constants.ERROR
163 assert result.kw.get('key') == 'replica2.example.test'
164 assert result.kw.get('replicas') == ['ipa.example.test']
165 assert result.kw.get('suffix') == 'ca'
166 assert result.kw.get('type') == 'connect'
167 assert 'can\'t contact servers' in result.kw.get('msg')
168
169 def test_topology_domain_max_agmtsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_domain_max_agmts().(selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_domain_max_agmts().(self)):
170 m_apiscip-python python ipahealthcheck 0.16 `tests.util`/m_api..Command.topologysuffix_verify.side_effect = [
171 {
172 u'result': {
173 u"connect_errors": [],
174 u"in_order": False,
175 u"max_agmts": 1,
176 u"max_agmts_errors": [
177 [
178 u"ipa.example.test",
179 [u"replica2.example.test"],
180 ],
181 ],
182 }
183 },
184 {
185 u'result': {
186 u"in_order": True,
187 }
188 },
189 ]
190 m_apiscip-python python ipahealthcheck 0.16 `tests.util`/m_api..Command.ca_is_enabled.return_value = {'result': True}
191
192 framework = objectscip-python python python-stdlib 3.11 builtins/object#()
193 registry.initialize(framework, config.Config)
194 f = IPATopologyDomainCheck(registry)
195
196 selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_domain_max_agmts().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results. = capture_resultsscip-python python ipahealthcheck 0.16 `tests.util`/capture_results().(f)
197
198 assert len(selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_domain_max_agmts().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results.) == 2
199
200 for result in selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_domain_max_agmts().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results..results:
201 assert result.source == 'ipahealthcheck.ipa.topology'
202 assert result.check == 'IPATopologyDomainCheck'
203
204 result = selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_domain_max_agmts().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results..results[0]
205 assert result.result == constants.ERROR
206 assert result.kw.get('key') == 'ipa.example.test'
207 assert result.kw.get('replicas') == ['replica2.example.test']
208 assert result.kw.get('suffix') == 'domain'
209 assert result.kw.get('type') == 'max'
210 assert 'recommended max' in result.kw.get('msg')
211
212 result = selfscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#test_topology_domain_max_agmts().(self).resultsscip-python python ipahealthcheck 0.16 `tests.test_ipa_topology`/TestTopology#results..results[1]
213 assert result.result == constants.SUCCESS
214 assert result.kw.get('suffix') == 'ca'