1    	import inspect
2    	from unittest import TestCase
3    	
4    	from pcs.common import file_type_codes
5    	from pcs.common.fencing_topology import (
6    	    TARGET_TYPE_ATTRIBUTE,
7    	    TARGET_TYPE_NODE,
8    	    TARGET_TYPE_REGEXP,
9    	)
10   	from pcs.common.file import RawFileError
11   	from pcs.common.permissions.types import PermissionTargetType
12   	from pcs.common.reports import const
13   	from pcs.common.reports import messages as reports
14   	from pcs.common.resource_agent.dto import ResourceAgentNameDto
15   	from pcs.common.resource_status import ResourceState
16   	from pcs.common.types import CibRuleExpressionType
17   	
18   	# pylint: disable=too-many-lines
19   	
20   	
21   	class AllClassesTested(TestCase):
22   	    def test_success(self):
23   	        self.maxDiff = None
24   	        message_classes = frozenset(
25   	            name
26   	            for name, member in inspect.getmembers(reports, inspect.isclass)
27   	            if issubclass(member, reports.ReportItemMessage)
28   	            and member
29   	            not in {reports.ReportItemMessage, reports.LegacyCommonMessage}
30   	        )
31   	        test_classes = frozenset(
32   	            name
33   	            for name, member in inspect.getmembers(
34   	                inspect.getmodule(self), inspect.isclass
35   	            )
36   	            if issubclass(member, NameBuildTest)
37   	        )
38   	        untested = sorted(message_classes - test_classes)
39   	        self.assertEqual(
40   	            untested,
41   	            [],
42   	            f"It seems {len(untested)} subclass(es) of 'ReportItemMessage' are "
43   	            "missing tests. Make sure the test classes have the same name as "
44   	            "the code classes.",
45   	        )
46   	
47   	
48   	class NameBuildTest(TestCase):
49   	    """
50   	    Base class for the testing of message building.
51   	    """
52   	
53   	    def assert_message_from_report(self, message, report):
54   	        self.maxDiff = None
55   	        self.assertEqual(message, report.message)
56   	
57   	
58   	class ResourceForConstraintIsMultiinstance(NameBuildTest):
59   	    def test_success(self):
60   	        self.assertEqual(
61   	            (
62   	                "resource1 is a bundle resource, you should use the "
63   	                "bundle id: parent1 when adding constraints"
64   	            ),
65   	            reports.ResourceForConstraintIsMultiinstance(
66   	                "resource1", "bundle", "parent1"
67   	            ).message,
68   	        )
69   	
70   	
71   	class DuplicateConstraintsExist(NameBuildTest):
72   	    def test_build_singular(self):
73   	        self.assert_message_from_report(
74   	            "Duplicate constraint already exists",
75   	            reports.DuplicateConstraintsExist(["c1"]),
76   	        )
77   	
78   	    def test_build_plural(self):
79   	        self.assert_message_from_report(
80   	            "Duplicate constraints already exist",
81   	            reports.DuplicateConstraintsExist(["c1", "c3", "c0"]),
82   	        )
83   	
84   	
85   	class EmptyResourceSet(NameBuildTest):
86   	    def test_success(self):
87   	        self.assert_message_from_report(
88   	            "Resource set is empty",
89   	            reports.EmptyResourceSet(),
90   	        )
91   	
92   	
93   	class EmptyResourceSetList(NameBuildTest):
94   	    def test_success(self):
95   	        self.assert_message_from_report(
96   	            "Resource set list is empty",
97   	            reports.EmptyResourceSetList(),
98   	        )
99   	
100  	
101  	class CannotSetOrderConstraintsForResourcesInTheSameGroup(NameBuildTest):
102  	    def test_success(self):
103  	        self.assert_message_from_report(
104  	            "Cannot create an order constraint for resources in the same group",
105  	            reports.CannotSetOrderConstraintsForResourcesInTheSameGroup(),
106  	        )
107  	
108  	
109  	class RequiredOptionsAreMissing(NameBuildTest):
110  	    def test_build_message_with_type(self):
111  	        self.assert_message_from_report(
112  	            "required TYPE option 'NAME' is missing",
113  	            reports.RequiredOptionsAreMissing(["NAME"], option_type="TYPE"),
114  	        )
115  	
116  	    def test_build_message_without_type(self):
117  	        self.assert_message_from_report(
118  	            "required option 'NAME' is missing",
119  	            reports.RequiredOptionsAreMissing(["NAME"]),
120  	        )
121  	
122  	    def test_build_message_with_multiple_names(self):
123  	        self.assert_message_from_report(
124  	            "required options 'ANOTHER', 'NAME' are missing",
125  	            reports.RequiredOptionsAreMissing(["NAME", "ANOTHER"]),
126  	        )
127  	
128  	
129  	class PrerequisiteOptionIsMissing(NameBuildTest):
130  	    def test_without_type(self):
131  	        self.assert_message_from_report(
132  	            "If option 'a' is specified, option 'b' must be specified as well",
133  	            reports.PrerequisiteOptionIsMissing("a", "b"),
134  	        )
135  	
136  	    def test_with_type(self):
137  	        self.assert_message_from_report(
138  	            "If some option 'a' is specified, "
139  	            "other option 'b' must be specified as well",
140  	            reports.PrerequisiteOptionIsMissing("a", "b", "some", "other"),
141  	        )
142  	
143  	
144  	class PrerequisiteOptionMustBeEnabledAsWell(NameBuildTest):
145  	    def test_without_type(self):
146  	        self.assert_message_from_report(
147  	            "If option 'a' is enabled, option 'b' must be enabled as well",
148  	            reports.PrerequisiteOptionMustBeEnabledAsWell("a", "b"),
149  	        )
150  	
151  	    def test_with_type(self):
152  	        self.assert_message_from_report(
153  	            "If some option 'a' is enabled, "
154  	            "other option 'b' must be enabled as well",
155  	            reports.PrerequisiteOptionMustBeEnabledAsWell(
156  	                "a", "b", "some", "other"
157  	            ),
158  	        )
159  	
160  	
161  	class PrerequisiteOptionMustBeDisabled(NameBuildTest):
162  	    def test_without_type(self):
163  	        self.assert_message_from_report(
164  	            "If option 'a' is enabled, option 'b' must be disabled",
165  	            reports.PrerequisiteOptionMustBeDisabled("a", "b"),
166  	        )
167  	
168  	    def test_with_type(self):
169  	        self.assert_message_from_report(
170  	            "If some option 'a' is enabled, other option 'b' must be disabled",
171  	            reports.PrerequisiteOptionMustBeDisabled("a", "b", "some", "other"),
172  	        )
173  	
174  	
175  	class PrerequisiteOptionMustNotBeSet(NameBuildTest):
176  	    def test_without_type(self):
177  	        self.assert_message_from_report(
178  	            "Cannot set option 'a' because option 'b' is already set",
179  	            reports.PrerequisiteOptionMustNotBeSet(
180  	                "a",
181  	                "b",
182  	            ),
183  	        )
184  	
185  	    def test_with_type(self):
186  	        self.assert_message_from_report(
187  	            "Cannot set some option 'a' because other option 'b' is "
188  	            "already set",
189  	            reports.PrerequisiteOptionMustNotBeSet(
190  	                "a",
191  	                "b",
192  	                option_type="some",
193  	                prerequisite_type="other",
194  	            ),
195  	        )
196  	
197  	
198  	class RequiredOptionOfAlternativesIsMissing(NameBuildTest):
199  	    def test_minimal(self):
200  	        self.assert_message_from_report(
201  	            "option 'aAa', 'bBb' or 'cCc' has to be specified",
202  	            reports.RequiredOptionOfAlternativesIsMissing(
203  	                ["aAa", "cCc", "bBb"]
204  	            ),
205  	        )
206  	
207  	    def test_with_type(self):
208  	        self.assert_message_from_report(
209  	            "test option 'aAa' has to be specified",
210  	            reports.RequiredOptionOfAlternativesIsMissing(
211  	                ["aAa"], option_type="test"
212  	            ),
213  	        )
214  	
215  	    def test_with_deprecated(self):
216  	        self.assert_message_from_report(
217  	            (
218  	                "option 'bBb', 'aAa' (deprecated) or 'cCc' (deprecated) has "
219  	                "to be specified"
220  	            ),
221  	            reports.RequiredOptionOfAlternativesIsMissing(
222  	                ["aAa", "cCc", "bBb"], deprecated_names=["cCc", "aAa"]
223  	            ),
224  	        )
225  	
226  	
227  	class InvalidOptions(NameBuildTest):
228  	    def test_build_message_with_type(self):
229  	        self.assert_message_from_report(
230  	            "invalid TYPE option 'NAME', allowed options are: 'FIRST', "
231  	            "'SECOND'",
232  	            reports.InvalidOptions(["NAME"], ["SECOND", "FIRST"], "TYPE"),
233  	        )
234  	
235  	    def test_build_message_without_type(self):
236  	        self.assert_message_from_report(
237  	            "invalid option 'NAME', allowed options are: 'FIRST', 'SECOND'",
238  	            reports.InvalidOptions(["NAME"], ["FIRST", "SECOND"], ""),
239  	        )
240  	
241  	    def test_build_message_with_multiple_names(self):
242  	        self.assert_message_from_report(
243  	            "invalid options: 'ANOTHER', 'NAME', allowed option is 'FIRST'",
244  	            reports.InvalidOptions(["NAME", "ANOTHER"], ["FIRST"], ""),
245  	        )
246  	
247  	    def test_pattern(self):
248  	        self.assert_message_from_report(
249  	            (
250  	                "invalid option 'NAME', allowed are options matching patterns: "
251  	                "'exec_<name>'"
252  	            ),
253  	            reports.InvalidOptions(["NAME"], [], "", ["exec_<name>"]),
254  	        )
255  	
256  	    def test_allowed_and_patterns(self):
257  	        self.assert_message_from_report(
258  	            (
259  	                "invalid option 'NAME', allowed option is 'FIRST' and options "
260  	                "matching patterns: 'exec_<name>'"
261  	            ),
262  	            reports.InvalidOptions(
263  	                ["NAME"], ["FIRST"], "", allowed_patterns=["exec_<name>"]
264  	            ),
265  	        )
266  	
267  	    def test_no_allowed_options(self):
268  	        self.assert_message_from_report(
269  	            "invalid options: 'ANOTHER', 'NAME', there are no options allowed",
270  	            reports.InvalidOptions(["NAME", "ANOTHER"], [], ""),
271  	        )
272  	
273  	
274  	class InvalidUserdefinedOptions(NameBuildTest):
275  	    def test_without_type(self):
276  	        self.assert_message_from_report(
277  	            (
278  	                "invalid option 'exec_NAME', options may contain "
279  	                "a-z A-Z 0-9 /_- characters only"
280  	            ),
281  	            reports.InvalidUserdefinedOptions(["exec_NAME"], "a-z A-Z 0-9 /_-"),
282  	        )
283  	
284  	    def test_with_type(self):
285  	        self.assert_message_from_report(
286  	            (
287  	                "invalid heuristics option 'exec_NAME', heuristics options may "
288  	                "contain a-z A-Z 0-9 /_- characters only"
289  	            ),
290  	            reports.InvalidUserdefinedOptions(
291  	                ["exec_NAME"], "a-z A-Z 0-9 /_-", "heuristics"
292  	            ),
293  	        )
294  	
295  	    def test_more_options(self):
296  	        self.assert_message_from_report(
297  	            (
298  	                "invalid TYPE options: 'ANOTHER', 'NAME', TYPE options may "
299  	                "contain a-z A-Z 0-9 /_- characters only"
300  	            ),
301  	            reports.InvalidUserdefinedOptions(
302  	                ["NAME", "ANOTHER"], "a-z A-Z 0-9 /_-", "TYPE"
303  	            ),
304  	        )
305  	
306  	
307  	class InvalidOptionType(NameBuildTest):
308  	    def test_allowed_string(self):
309  	        self.assert_message_from_report(
310  	            "specified option name is not valid, use allowed types",
311  	            reports.InvalidOptionType("option name", "allowed types"),
312  	        )
313  	
314  	    def test_allowed_list(self):
315  	        self.assert_message_from_report(
316  	            "specified option name is not valid, use 'allowed', 'types'",
317  	            reports.InvalidOptionType("option name", ["types", "allowed"]),
318  	        )
319  	
320  	
321  	class InvalidOptionValue(NameBuildTest):
322  	    def test_multiple_allowed_values(self):
323  	        self.assert_message_from_report(
324  	            "'VALUE' is not a valid NAME value, use 'FIRST', 'SECOND'",
325  	            reports.InvalidOptionValue("NAME", "VALUE", ["SECOND", "FIRST"]),
326  	        )
327  	
328  	    def test_textual_hint(self):
329  	        self.assert_message_from_report(
330  	            "'VALUE' is not a valid NAME value, use some hint",
331  	            reports.InvalidOptionValue("NAME", "VALUE", "some hint"),
332  	        )
333  	
334  	    def test_cannot_be_empty(self):
335  	        self.assert_message_from_report(
336  	            "NAME cannot be empty",
337  	            reports.InvalidOptionValue(
338  	                "NAME", "VALUE", allowed_values=None, cannot_be_empty=True
339  	            ),
340  	        )
341  	
342  	    def test_cannot_be_empty_with_hint(self):
343  	        self.assert_message_from_report(
344  	            "NAME cannot be empty, use 'FIRST', 'SECOND'",
345  	            reports.InvalidOptionValue(
346  	                "NAME", "VALUE", ["SECOND", "FIRST"], cannot_be_empty=True
347  	            ),
348  	        )
349  	
350  	    def test_forbidden_characters(self):
351  	        self.assert_message_from_report(
352  	            r"NAME cannot contain }{\r\n characters",
353  	            reports.InvalidOptionValue(
354  	                "NAME",
355  	                "VALUE",
356  	                allowed_values=None,
357  	                forbidden_characters="}{\\r\\n",
358  	            ),
359  	        )
360  	
361  	    def test_forbidden_characters_with_hint(self):
362  	        self.assert_message_from_report(
363  	            r"NAME cannot contain }{\r\n characters, use 'FIRST', 'SECOND'",
364  	            reports.InvalidOptionValue(
365  	                "NAME",
366  	                "VALUE",
367  	                ["SECOND", "FIRST"],
368  	                forbidden_characters="}{\\r\\n",
369  	            ),
370  	        )
371  	
372  	    def test_cannot_be_empty_and_forbidden_characters(self):
373  	        self.assert_message_from_report(
374  	            "NAME cannot be empty, use 'FIRST', 'SECOND'",
375  	            reports.InvalidOptionValue(
376  	                "NAME", "VALUE", ["SECOND", "FIRST"], True
377  	            ),
378  	        )
379  	
380  	
381  	class DeprecatedOption(NameBuildTest):
382  	    def test_no_desc_hint_array(self):
383  	        self.assert_message_from_report(
384  	            (
385  	                "option 'option name' is deprecated and might be removed in a "
386  	                "future release, therefore it should not be used, use 'new_a', "
387  	                "'new_b' instead"
388  	            ),
389  	            reports.DeprecatedOption("option name", ["new_b", "new_a"], ""),
390  	        )
391  	
392  	    def test_desc_hint_string(self):
393  	        self.assert_message_from_report(
394  	            (
395  	                "option type option 'option name' is deprecated and might be "
396  	                "removed in a future release, therefore it should not be used, "
397  	                "use 'new option' instead"
398  	            ),
399  	            reports.DeprecatedOption(
400  	                "option name", ["new option"], "option type"
401  	            ),
402  	        )
403  	
404  	    def test_empty_hint(self):
405  	        self.assert_message_from_report(
406  	            (
407  	                "option 'option name' is deprecated and might be removed in a "
408  	                "future release, therefore it should not be used"
409  	            ),
410  	            reports.DeprecatedOption("option name", [], ""),
411  	        )
412  	
413  	
414  	class DeprecatedOptionValue(NameBuildTest):
415  	    def test_replaced_by(self):
416  	        self.assert_message_from_report(
417  	            (
418  	                "Value 'deprecatedValue' of option optionA is deprecated and "
419  	                "might be removed in a future release, therefore it should not "
420  	                "be used, use 'newValue' value instead"
421  	            ),
422  	            reports.DeprecatedOptionValue(
423  	                "optionA", "deprecatedValue", "newValue"
424  	            ),
425  	        )
426  	
427  	    def test_no_replacement(self):
428  	        self.assert_message_from_report(
429  	            (
430  	                "Value 'deprecatedValue' of option optionA is deprecated and "
431  	                "might be removed in a future release, therefore it should not "
432  	                "be used"
433  	            ),
434  	            reports.DeprecatedOptionValue("optionA", "deprecatedValue"),
435  	        )
436  	
437  	
438  	class MutuallyExclusiveOptions(NameBuildTest):
439  	    def test_build_message(self):
440  	        self.assert_message_from_report(
441  	            "Only one of some options 'a' and 'b' can be used",
442  	            reports.MutuallyExclusiveOptions(["b", "a"], "some"),
443  	        )
444  	
445  	
446  	class InvalidCibContent(NameBuildTest):
447  	    def test_message_can_be_more_verbose(self):
448  	        report = "no verbose\noutput\n"
449  	        self.assert_message_from_report(
450  	            "invalid cib:\n{0}".format(report),
451  	            reports.InvalidCibContent(report, True),
452  	        )
453  	
454  	    def test_message_cannot_be_more_verbose(self):
455  	        report = "some verbose\noutput"
456  	        self.assert_message_from_report(
457  	            "invalid cib:\n{0}".format(report),
458  	            reports.InvalidCibContent(report, False),
459  	        )
460  	
461  	
462  	class InvalidIdIsEmpty(NameBuildTest):
463  	    def test_all(self):
464  	        self.assert_message_from_report(
465  	            "description cannot be empty",
466  	            reports.InvalidIdIsEmpty("description"),
467  	        )
468  	
469  	
470  	class InvalidIdBadChar(NameBuildTest):
471  	    def test_build_message_with_first_char_invalid(self):
472  	        self.assert_message_from_report(
473  	            (
474  	                "invalid ID_DESCRIPTION 'ID', 'INVALID_CHARACTER' is not a"
475  	                " valid first character for a ID_DESCRIPTION"
476  	            ),
477  	            reports.InvalidIdBadChar(
478  	                "ID", "ID_DESCRIPTION", "INVALID_CHARACTER", is_first_char=True
479  	            ),
480  	        )
481  	
482  	    def test_build_message_with_non_first_char_invalid(self):
483  	        self.assert_message_from_report(
484  	            (
485  	                "invalid ID_DESCRIPTION 'ID', 'INVALID_CHARACTER' is not a"
486  	                " valid character for a ID_DESCRIPTION"
487  	            ),
488  	            reports.InvalidIdBadChar(
489  	                "ID", "ID_DESCRIPTION", "INVALID_CHARACTER", is_first_char=False
490  	            ),
491  	        )
492  	
493  	
494  	class InvalidIdType(NameBuildTest):
495  	    def test_success(self):
496  	        self.assert_message_from_report(
497  	            (
498  	                "'entered' is not a valid type of ID specification, "
499  	                "use 'expected1', 'expected2'"
500  	            ),
501  	            reports.InvalidIdType("entered", ["expected1", "expected2"]),
502  	        )
503  	
504  	
505  	class InvalidTimeoutValue(NameBuildTest):
506  	    def test_all(self):
507  	        self.assert_message_from_report(
508  	            "'24h' is not a valid number of seconds to wait",
509  	            reports.InvalidTimeoutValue("24h"),
510  	        )
511  	
512  	
513  	class InvalidScore(NameBuildTest):
514  	    def test_all(self):
515  	        self.assert_message_from_report(
516  	            "invalid score '1M', use integer or INFINITY or -INFINITY",
517  	            reports.InvalidScore("1M"),
518  	        )
519  	
520  	
521  	class RunExternalProcessStarted(NameBuildTest):
522  	    def test_build_message_minimal(self):
523  	        self.assert_message_from_report(
524  	            "Running: COMMAND\nEnvironment:\n",
525  	            reports.RunExternalProcessStarted("COMMAND", "", {}),
526  	        )
527  	
528  	    def test_build_message_with_stdin(self):
529  	        self.assert_message_from_report(
530  	            (
531  	                "Running: COMMAND\nEnvironment:\n"
532  	                "--Debug Input Start--\n"
533  	                "STDIN\n"
534  	                "--Debug Input End--\n"
535  	            ),
536  	            reports.RunExternalProcessStarted("COMMAND", "STDIN", {}),
537  	        )
538  	
539  	    def test_build_message_with_env(self):
540  	        self.assert_message_from_report(
541  	            ("Running: COMMAND\nEnvironment:\n  env_a=A\n  env_b=B\n"),
542  	            reports.RunExternalProcessStarted(
543  	                "COMMAND",
544  	                "",
545  	                {
546  	                    "env_a": "A",
547  	                    "env_b": "B",
548  	                },
549  	            ),
550  	        )
551  	
552  	    def test_build_message_maximal(self):
553  	        self.assert_message_from_report(
554  	            (
555  	                "Running: COMMAND\nEnvironment:\n"
556  	                "  env_a=A\n"
557  	                "  env_b=B\n"
558  	                "--Debug Input Start--\n"
559  	                "STDIN\n"
560  	                "--Debug Input End--\n"
561  	            ),
562  	            reports.RunExternalProcessStarted(
563  	                "COMMAND",
564  	                "STDIN",
565  	                {
566  	                    "env_a": "A",
567  	                    "env_b": "B",
568  	                },
569  	            ),
570  	        )
571  	
572  	    def test_insidious_environment(self):
573  	        self.assert_message_from_report(
574  	            (
575  	                "Running: COMMAND\nEnvironment:\n"
576  	                "  test=a:{green},b:{red}\n"
577  	                "--Debug Input Start--\n"
578  	                "STDIN\n"
579  	                "--Debug Input End--\n"
580  	            ),
581  	            reports.RunExternalProcessStarted(
582  	                "COMMAND",
583  	                "STDIN",
584  	                {
585  	                    "test": "a:{green},b:{red}",
586  	                },
587  	            ),
588  	        )
589  	
590  	
591  	class RunExternalProcessFinished(NameBuildTest):
592  	    def test_all(self):
593  	        self.assert_message_from_report(
594  	            (
595  	                "Finished running: com-mand\n"
596  	                "Return value: 0\n"
597  	                "--Debug Stdout Start--\n"
598  	                "STDOUT\n"
599  	                "--Debug Stdout End--\n"
600  	                "--Debug Stderr Start--\n"
601  	                "STDERR\n"
602  	                "--Debug Stderr End--\n"
603  	            ),
604  	            reports.RunExternalProcessFinished(
605  	                "com-mand", 0, "STDOUT", "STDERR"
606  	            ),
607  	        )
608  	
609  	
610  	class RunExternalProcessError(NameBuildTest):
611  	    def test_all(self):
612  	        self.assert_message_from_report(
613  	            "unable to run command com-mand: reason",
614  	            reports.RunExternalProcessError("com-mand", "reason"),
615  	        )
616  	
617  	
618  	class NoActionNecessary(NameBuildTest):
619  	    def test_all(self):
620  	        self.assert_message_from_report(
621  	            "No action necessary, requested change would have no effect",
622  	            reports.NoActionNecessary(),
623  	        )
624  	
625  	
626  	class NodeCommunicationStarted(NameBuildTest):
627  	    def test_build_message_with_data(self):
628  	        self.assert_message_from_report(
629  	            (
630  	                "Sending HTTP Request to: TARGET\n"
631  	                "--Debug Input Start--\n"
632  	                "DATA\n"
633  	                "--Debug Input End--\n"
634  	            ),
635  	            reports.NodeCommunicationStarted("TARGET", "DATA"),
636  	        )
637  	
638  	    def test_build_message_without_data(self):
639  	        self.assert_message_from_report(
640  	            "Sending HTTP Request to: TARGET",
641  	            reports.NodeCommunicationStarted("TARGET", ""),
642  	        )
643  	
644  	
645  	class NodeCommunicationFinished(NameBuildTest):
646  	    def test_all(self):
647  	        self.assert_message_from_report(
648  	            (
649  	                "Finished calling: node1\n"
650  	                "Response Code: 0\n"
651  	                "--Debug Response Start--\n"
652  	                "DATA\n"
653  	                "--Debug Response End--\n"
654  	            ),
655  	            reports.NodeCommunicationFinished("node1", 0, "DATA"),
656  	        )
657  	
658  	
659  	class NodeCommunicationDebugInfo(NameBuildTest):
660  	    def test_all(self):
661  	        self.assert_message_from_report(
662  	            (
663  	                "Communication debug info for calling: node1\n"
664  	                "--Debug Communication Info Start--\n"
665  	                "DATA\n"
666  	                "--Debug Communication Info End--\n"
667  	            ),
668  	            reports.NodeCommunicationDebugInfo("node1", "DATA"),
669  	        )
670  	
671  	
672  	class NodeCommunicationNotConnected(NameBuildTest):
673  	    def test_all(self):
674  	        self.assert_message_from_report(
675  	            "Unable to connect to node2 (this is reason)",
676  	            reports.NodeCommunicationNotConnected("node2", "this is reason"),
677  	        )
678  	
679  	
680  	class NodeCommunicationNoMoreAddresses(NameBuildTest):
681  	    def test_success(self):
682  	        self.assert_message_from_report(
683  	            "Unable to connect to 'node_name' via any of its addresses",
684  	            reports.NodeCommunicationNoMoreAddresses(
685  	                "node_name",
686  	                "my/request",
687  	            ),
688  	        )
689  	
690  	
691  	class NodeCommunicationErrorNotAuthorized(NameBuildTest):
692  	    def test_success(self):
693  	        self.assert_message_from_report(
694  	            "Unable to authenticate to node1 (some error)",
695  	            reports.NodeCommunicationErrorNotAuthorized(
696  	                "node1", "some-command", "some error"
697  	            ),
698  	        )
699  	
700  	
701  	class NodeCommunicationErrorPermissionDenied(NameBuildTest):
702  	    def test_all(self):
703  	        self.assert_message_from_report(
704  	            "node3: Permission denied (reason)",
705  	            reports.NodeCommunicationErrorPermissionDenied(
706  	                "node3", "com-mand", "reason"
707  	            ),
708  	        )
709  	
710  	
711  	class NodeCommunicationErrorUnsupportedCommand(NameBuildTest):
712  	    def test_all(self):
713  	        self.assert_message_from_report(
714  	            "node1: Unsupported command (reason), try upgrading pcsd",
715  	            reports.NodeCommunicationErrorUnsupportedCommand(
716  	                "node1", "com-mand", "reason"
717  	            ),
718  	        )
719  	
720  	
721  	class NodeCommunicationCommandUnsuccessful(NameBuildTest):
722  	    def test_all(self):
723  	        self.assert_message_from_report(
724  	            "node1: reason",
725  	            reports.NodeCommunicationCommandUnsuccessful(
726  	                "node1", "com-mand", "reason"
727  	            ),
728  	        )
729  	
730  	
731  	class NodeCommunicationError(NameBuildTest):
732  	    def test_all(self):
733  	        self.assert_message_from_report(
734  	            "Error connecting to node1 (reason)",
735  	            reports.NodeCommunicationError("node1", "com-mand", "reason"),
736  	        )
737  	
738  	
739  	class NodeCommunicationErrorUnableToConnect(NameBuildTest):
740  	    def test_all(self):
741  	        self.assert_message_from_report(
742  	            "Unable to connect to node1 (reason)",
743  	            reports.NodeCommunicationErrorUnableToConnect(
744  	                "node1", "com-mand", "reason"
745  	            ),
746  	        )
747  	
748  	
749  	class NodeCommunicationErrorTimedOut(NameBuildTest):
750  	    def test_success(self):
751  	        self.assert_message_from_report(
752  	            (
753  	                "node-1: Connection timeout (Connection timed out after 60049 "
754  	                "milliseconds)"
755  	            ),
756  	            reports.NodeCommunicationErrorTimedOut(
757  	                "node-1",
758  	                "/remote/command",
759  	                "Connection timed out after 60049 milliseconds",
760  	            ),
761  	        )
762  	
763  	
764  	class NodeCommunicationProxyIsSet(NameBuildTest):
765  	    def test_minimal(self):
766  	        self.assert_message_from_report(
767  	            "Proxy is set in environment variables, try disabling it",
768  	            reports.NodeCommunicationProxyIsSet(),
769  	        )
770  	
771  	    def test_with_node(self):
772  	        self.assert_message_from_report(
773  	            "Proxy is set in environment variables, try disabling it",
774  	            reports.NodeCommunicationProxyIsSet(node="node1"),
775  	        )
776  	
777  	    def test_with_address(self):
778  	        self.assert_message_from_report(
779  	            "Proxy is set in environment variables, try disabling it",
780  	            reports.NodeCommunicationProxyIsSet(address="aaa"),
781  	        )
782  	
783  	    def test_all(self):
784  	        self.assert_message_from_report(
785  	            "Proxy is set in environment variables, try disabling it",
786  	            reports.NodeCommunicationProxyIsSet(node="node1", address="aaa"),
787  	        )
788  	
789  	
790  	class NodeCommunicationRetrying(NameBuildTest):
791  	    def test_success(self):
792  	        self.assert_message_from_report(
793  	            (
794  	                "Unable to connect to 'node_name' via address 'failed.address' "
795  	                "and port '2224'. Retrying request 'my/request' via address "
796  	                "'next.address' and port '2225'"
797  	            ),
798  	            reports.NodeCommunicationRetrying(
799  	                "node_name",
800  	                "failed.address",
801  	                "2224",
802  	                "next.address",
803  	                "2225",
804  	                "my/request",
805  	            ),
806  	        )
807  	
808  	
809  	class DefaultsCanBeOverridden(NameBuildTest):
810  	    def test_message(self):
811  	        self.assert_message_from_report(
812  	            (
813  	                "Defaults do not apply to resources which override them with "
814  	                "their own defined values"
815  	            ),
816  	            reports.DefaultsCanBeOverridden(),
817  	        )
818  	
819  	
820  	class CorosyncAuthkeyWrongLength(NameBuildTest):
821  	    def test_at_most_allowed_singular_provided_plural(self):
822  	        self.assert_message_from_report(
823  	            (
824  	                "At least 0 and at most 1 byte key must be provided for "
825  	                "a corosync authkey, 2 bytes key provided"
826  	            ),
827  	            reports.CorosyncAuthkeyWrongLength(2, 0, 1),
828  	        )
829  	
830  	    def test_at_most_allowed_plural_provided_singular(self):
831  	        self.assert_message_from_report(
832  	            (
833  	                "At least 2 and at most 3 bytes key must be provided for "
834  	                "a corosync authkey, 1 byte key provided"
835  	            ),
836  	            reports.CorosyncAuthkeyWrongLength(1, 2, 3),
837  	        )
838  	
839  	    def test_exactly_allowed_singular_provided_plural(self):
840  	        self.assert_message_from_report(
841  	            (
842  	                "1 byte key must be provided for a corosync authkey, 2 bytes "
843  	                "key provided"
844  	            ),
845  	            reports.CorosyncAuthkeyWrongLength(2, 1, 1),
846  	        )
847  	
848  	    def test_exactly_allowed_plural_provided_singular(self):
849  	        self.assert_message_from_report(
850  	            (
851  	                "2 bytes key must be provided for a corosync authkey, 1 byte "
852  	                "key provided"
853  	            ),
854  	            reports.CorosyncAuthkeyWrongLength(1, 2, 2),
855  	        )
856  	
857  	
858  	class CorosyncConfigDistributionStarted(NameBuildTest):
859  	    def test_all(self):
860  	        self.assert_message_from_report(
861  	            "Sending updated corosync.conf to nodes...",
862  	            reports.CorosyncConfigDistributionStarted(),
863  	        )
864  	
865  	
866  	# TODO: consider generalizing
867  	class CorosyncConfigAcceptedByNode(NameBuildTest):
868  	    def test_all(self):
869  	        self.assert_message_from_report(
870  	            "node1: Succeeded", reports.CorosyncConfigAcceptedByNode("node1")
871  	        )
872  	
873  	
874  	class CorosyncConfigDistributionNodeError(NameBuildTest):
875  	    def test_all(self):
876  	        self.assert_message_from_report(
877  	            "node1: Unable to set corosync config",
878  	            reports.CorosyncConfigDistributionNodeError("node1"),
879  	        )
880  	
881  	
882  	class CorosyncNotRunningCheckStarted(NameBuildTest):
883  	    def test_all(self):
884  	        self.assert_message_from_report(
885  	            "Checking that corosync is not running on nodes...",
886  	            reports.CorosyncNotRunningCheckStarted(),
887  	        )
888  	
889  	
890  	class CorosyncNotRunningCheckFinishedRunning(NameBuildTest):
891  	    def test_one_node(self):
892  	        self.assert_message_from_report(
893  	            (
894  	                "Corosync is running on node 'node1'. Requested change can "
895  	                "only be made if the cluster is stopped. In order to proceed, "
896  	                "stop the cluster."
897  	            ),
898  	            reports.CorosyncNotRunningCheckFinishedRunning(["node1"]),
899  	        )
900  	
901  	    def test_more_nodes(self):
902  	        self.assert_message_from_report(
903  	            (
904  	                "Corosync is running on nodes 'node1', 'node2', 'node3'. "
905  	                "Requested change can only be made if the cluster is stopped. "
906  	                "In order to proceed, stop the cluster."
907  	            ),
908  	            reports.CorosyncNotRunningCheckFinishedRunning(
909  	                ["node2", "node1", "node3"]
910  	            ),
911  	        )
912  	
913  	
914  	class CorosyncNotRunningCheckNodeError(NameBuildTest):
915  	    def test_all(self):
916  	        self.assert_message_from_report(
917  	            "Unable to check if corosync is not running on node 'node1'",
918  	            reports.CorosyncNotRunningCheckNodeError("node1"),
919  	        )
920  	
921  	
922  	class CorosyncNotRunningCheckNodeStopped(NameBuildTest):
923  	    def test_all(self):
924  	        self.assert_message_from_report(
925  	            "Corosync is not running on node 'node2'",
926  	            reports.CorosyncNotRunningCheckNodeStopped("node2"),
927  	        )
928  	
929  	
930  	class CorosyncNotRunningCheckNodeRunning(NameBuildTest):
931  	    def test_all(self):
932  	        self.assert_message_from_report(
933  	            "Corosync is running on node 'node3'",
934  	            reports.CorosyncNotRunningCheckNodeRunning("node3"),
935  	        )
936  	
937  	
938  	class CorosyncQuorumGetStatusError(NameBuildTest):
939  	    def test_success(self):
940  	        self.assert_message_from_report(
941  	            "Unable to get quorum status: a reason",
942  	            reports.CorosyncQuorumGetStatusError("a reason"),
943  	        )
944  	
945  	    def test_success_with_node(self):
946  	        self.assert_message_from_report(
947  	            "node1: Unable to get quorum status: a reason",
948  	            reports.CorosyncQuorumGetStatusError("a reason", "node1"),
949  	        )
950  	
951  	
952  	class CorosyncQuorumHeuristicsEnabledWithNoExec(NameBuildTest):
953  	    def test_message(self):
954  	        self.assert_message_from_report(
955  	            (
956  	                "No exec_NAME options are specified, so heuristics are "
957  	                "effectively disabled"
958  	            ),
959  	            reports.CorosyncQuorumHeuristicsEnabledWithNoExec(),
960  	        )
961  	
962  	
963  	class CorosyncQuorumSetExpectedVotesError(NameBuildTest):
964  	    def test_all(self):
965  	        self.assert_message_from_report(
966  	            "Unable to set expected votes: reason",
967  	            reports.CorosyncQuorumSetExpectedVotesError("reason"),
968  	        )
969  	
970  	
971  	class CorosyncConfigReloaded(NameBuildTest):
972  	    def test_with_node(self):
973  	        self.assert_message_from_report(
974  	            "node1: Corosync configuration reloaded",
975  	            reports.CorosyncConfigReloaded("node1"),
976  	        )
977  	
978  	    def test_without_node(self):
979  	        self.assert_message_from_report(
980  	            "Corosync configuration reloaded",
981  	            reports.CorosyncConfigReloaded(),
982  	        )
983  	
984  	
985  	class CorosyncConfigReloadError(NameBuildTest):
986  	    def test_with_node(self):
987  	        self.assert_message_from_report(
988  	            "node1: Unable to reload corosync configuration: a reason",
989  	            reports.CorosyncConfigReloadError("a reason", "node1"),
990  	        )
991  	
992  	    def test_without_node(self):
993  	        self.assert_message_from_report(
994  	            "Unable to reload corosync configuration: different reason",
995  	            reports.CorosyncConfigReloadError("different reason"),
996  	        )
997  	
998  	
999  	class CorosyncConfigReloadNotPossible(NameBuildTest):
1000 	    def test_success(self):
1001 	        self.assert_message_from_report(
1002 	            (
1003 	                "node1: Corosync is not running, therefore reload of the "
1004 	                "corosync configuration is not possible"
1005 	            ),
1006 	            reports.CorosyncConfigReloadNotPossible("node1"),
1007 	        )
1008 	
1009 	
1010 	class CorosyncConfigInvalidPreventsClusterJoin(NameBuildTest):
1011 	    def test_success(self):
1012 	        self.assert_message_from_report(
1013 	            (
1014 	                "One or more nodes failed to reload the Corosync configuration "
1015 	                "and are currently running with the previous configuration. If "
1016 	                "these nodes are restarted or fenced, they will fail to rejoin "
1017 	                "the cluster. Update the configuration and fix the issues as "
1018 	                "soon as possible."
1019 	            ),
1020 	            reports.CorosyncConfigInvalidPreventsClusterJoin(),
1021 	        )
1022 	
1023 	
1024 	class CorosyncConfigUnsupportedTransport(NameBuildTest):
1025 	    def test_success(self):
1026 	        self.assert_message_from_report(
1027 	            (
1028 	                "Transport 'netk' currently configured in corosync.conf is "
1029 	                "unsupported. Supported transport types are: 'knet', 'udp', "
1030 	                "'udpu'"
1031 	            ),
1032 	            reports.CorosyncConfigUnsupportedTransport(
1033 	                "netk", ["udp", "knet", "udpu"]
1034 	            ),
1035 	        )
1036 	
1037 	
1038 	class ParseErrorCorosyncConfMissingClosingBrace(NameBuildTest):
1039 	    def test_all(self):
1040 	        self.assert_message_from_report(
1041 	            "Unable to parse corosync config: missing closing brace",
1042 	            reports.ParseErrorCorosyncConfMissingClosingBrace(),
1043 	        )
1044 	
1045 	
1046 	class ParseErrorCorosyncConfUnexpectedClosingBrace(NameBuildTest):
1047 	    def test_all(self):
1048 	        self.assert_message_from_report(
1049 	            "Unable to parse corosync config: unexpected closing brace",
1050 	            reports.ParseErrorCorosyncConfUnexpectedClosingBrace(),
1051 	        )
1052 	
1053 	
1054 	class ParseErrorCorosyncConfMissingSectionNameBeforeOpeningBrace(NameBuildTest):
1055 	    def test_all(self):
1056 	        self.assert_message_from_report(
1057 	            "Unable to parse corosync config: missing a section name before {",
1058 	            reports.ParseErrorCorosyncConfMissingSectionNameBeforeOpeningBrace(),
1059 	        )
1060 	
1061 	
1062 	class ParseErrorCorosyncConfExtraCharactersAfterOpeningBrace(NameBuildTest):
1063 	    def test_all(self):
1064 	        self.assert_message_from_report(
1065 	            "Unable to parse corosync config: extra characters after {",
1066 	            reports.ParseErrorCorosyncConfExtraCharactersAfterOpeningBrace(),
1067 	        )
1068 	
1069 	
1070 	class ParseErrorCorosyncConfExtraCharactersBeforeOrAfterClosingBrace(
1071 	    NameBuildTest
1072 	):
1073 	    def test_all(self):
1074 	        self.assert_message_from_report(
1075 	            (
1076 	                "Unable to parse corosync config: extra characters before "
1077 	                "or after }"
1078 	            ),
1079 	            reports.ParseErrorCorosyncConfExtraCharactersBeforeOrAfterClosingBrace(),
1080 	        )
1081 	
1082 	
1083 	class ParseErrorCorosyncConfLineIsNotSectionNorKeyValue(NameBuildTest):
1084 	    def test_all(self):
1085 	        self.assert_message_from_report(
1086 	            "Unable to parse corosync config: a line is not opening or closing "
1087 	            "a section or key: value",
1088 	            reports.ParseErrorCorosyncConfLineIsNotSectionNorKeyValue(),
1089 	        )
1090 	
1091 	
1092 	class ParseErrorCorosyncConf(NameBuildTest):
1093 	    def test_all(self):
1094 	        self.assert_message_from_report(
1095 	            "Unable to parse corosync config", reports.ParseErrorCorosyncConf()
1096 	        )
1097 	
1098 	
1099 	class CorosyncConfigCannotSaveInvalidNamesValues(NameBuildTest):
1100 	    def test_empty(self):
1101 	        self.assert_message_from_report(
1102 	            "Cannot save corosync.conf containing invalid section names, "
1103 	            "option names or option values",
1104 	            reports.CorosyncConfigCannotSaveInvalidNamesValues([], [], []),
1105 	        )
1106 	
1107 	    def test_one_section(self):
1108 	        self.assert_message_from_report(
1109 	            "Cannot save corosync.conf containing "
1110 	            "invalid section name(s): 'SECTION'",
1111 	            reports.CorosyncConfigCannotSaveInvalidNamesValues(
1112 	                ["SECTION"], [], []
1113 	            ),
1114 	        )
1115 	
1116 	    def test_more_sections(self):
1117 	        self.assert_message_from_report(
1118 	            "Cannot save corosync.conf containing "
1119 	            "invalid section name(s): 'SECTION1', 'SECTION2'",
1120 	            reports.CorosyncConfigCannotSaveInvalidNamesValues(
1121 	                ["SECTION1", "SECTION2"], [], []
1122 	            ),
1123 	        )
1124 	
1125 	    def test_one_attr_name(self):
1126 	        self.assert_message_from_report(
1127 	            "Cannot save corosync.conf containing "
1128 	            "invalid option name(s): 'ATTR'",
1129 	            reports.CorosyncConfigCannotSaveInvalidNamesValues(
1130 	                [], ["ATTR"], []
1131 	            ),
1132 	        )
1133 	
1134 	    def test_more_attr_names(self):
1135 	        self.assert_message_from_report(
1136 	            "Cannot save corosync.conf containing "
1137 	            "invalid option name(s): 'ATTR1', 'ATTR2'",
1138 	            reports.CorosyncConfigCannotSaveInvalidNamesValues(
1139 	                [], ["ATTR1", "ATTR2"], []
1140 	            ),
1141 	        )
1142 	
1143 	    def test_one_attr_value(self):
1144 	        self.assert_message_from_report(
1145 	            "Cannot save corosync.conf containing "
1146 	            "invalid option value(s): 'VALUE' (option 'ATTR')",
1147 	            reports.CorosyncConfigCannotSaveInvalidNamesValues(
1148 	                [], [], [("ATTR", "VALUE")]
1149 	            ),
1150 	        )
1151 	
1152 	    def test_more_attr_values(self):
1153 	        self.assert_message_from_report(
1154 	            "Cannot save corosync.conf containing "
1155 	            "invalid option value(s): 'VALUE1' (option 'ATTR1'), "
1156 	            "'VALUE2' (option 'ATTR2')",
1157 	            reports.CorosyncConfigCannotSaveInvalidNamesValues(
1158 	                [], [], [("ATTR1", "VALUE1"), ("ATTR2", "VALUE2")]
1159 	            ),
1160 	        )
1161 	
1162 	    def test_all(self):
1163 	        self.assert_message_from_report(
1164 	            "Cannot save corosync.conf containing "
1165 	            "invalid section name(s): 'SECTION1', 'SECTION2'; "
1166 	            "invalid option name(s): 'ATTR1', 'ATTR2'; "
1167 	            "invalid option value(s): 'VALUE3' (option 'ATTR3'), "
1168 	            "'VALUE4' (option 'ATTR4')",
1169 	            reports.CorosyncConfigCannotSaveInvalidNamesValues(
1170 	                ["SECTION1", "SECTION2"],
1171 	                ["ATTR1", "ATTR2"],
1172 	                [("ATTR3", "VALUE3"), ("ATTR4", "VALUE4")],
1173 	            ),
1174 	        )
1175 	
1176 	
1177 	class CorosyncConfigMissingNamesOfNodes(NameBuildTest):
1178 	    def test_non_fatal(self):
1179 	        self.assert_message_from_report(
1180 	            "Some nodes are missing names in corosync.conf, "
1181 	            "those nodes were omitted. "
1182 	            "Edit corosync.conf and make sure all nodes have their name set.",
1183 	            reports.CorosyncConfigMissingNamesOfNodes(),
1184 	        )
1185 	
1186 	    def test_fatal(self):
1187 	        self.assert_message_from_report(
1188 	            "Some nodes are missing names in corosync.conf, "
1189 	            "unable to continue. "
1190 	            "Edit corosync.conf and make sure all nodes have their name set.",
1191 	            reports.CorosyncConfigMissingNamesOfNodes(fatal=True),
1192 	        )
1193 	
1194 	
1195 	class CorosyncConfigMissingIdsOfNodes(NameBuildTest):
1196 	    def test_success(self):
1197 	        self.assert_message_from_report(
1198 	            "Some nodes are missing IDs in corosync.conf. "
1199 	            "Edit corosync.conf and make sure all nodes have their nodeid set.",
1200 	            reports.CorosyncConfigMissingIdsOfNodes(),
1201 	        )
1202 	
1203 	
1204 	class CorosyncConfigNoNodesDefined(NameBuildTest):
1205 	    def test_success(self):
1206 	        self.assert_message_from_report(
1207 	            "No nodes found in corosync.conf",
1208 	            reports.CorosyncConfigNoNodesDefined(),
1209 	        )
1210 	
1211 	
1212 	class CorosyncOptionsIncompatibleWithQdevice(NameBuildTest):
1213 	    def test_single_option(self):
1214 	        self.assert_message_from_report(
1215 	            "These options cannot be set when the cluster uses a quorum "
1216 	            "device: 'option1'",
1217 	            reports.CorosyncOptionsIncompatibleWithQdevice(["option1"]),
1218 	        )
1219 	
1220 	    def test_multiple_options(self):
1221 	        self.assert_message_from_report(
1222 	            "These options cannot be set when the cluster uses a quorum "
1223 	            "device: 'option1', 'option2', 'option3'",
1224 	            reports.CorosyncOptionsIncompatibleWithQdevice(
1225 	                ["option3", "option1", "option2"]
1226 	            ),
1227 	        )
1228 	
1229 	
1230 	class CorosyncClusterNameInvalidForGfs2(NameBuildTest):
1231 	    def test_success(self):
1232 	        self.assert_message_from_report(
1233 	            "Chosen cluster name 'cluster name' will prevent mounting GFS2 "
1234 	            "volumes in the cluster, use at most 16 of a-z A-Z characters; "
1235 	            "you may safely override this if you do not intend to use GFS2",
1236 	            reports.CorosyncClusterNameInvalidForGfs2(
1237 	                cluster_name="cluster name",
1238 	                max_length=16,
1239 	                allowed_characters="a-z A-Z",
1240 	            ),
1241 	        )
1242 	
1243 	
1244 	class CorosyncBadNodeAddressesCount(NameBuildTest):
1245 	    def test_no_node_info(self):
1246 	        self.assert_message_from_report(
1247 	            "At least 1 and at most 4 addresses must be specified for a node, "
1248 	            "5 addresses specified",
1249 	            reports.CorosyncBadNodeAddressesCount(5, 1, 4),
1250 	        )
1251 	
1252 	    def test_node_name(self):
1253 	        self.assert_message_from_report(
1254 	            "At least 1 and at most 4 addresses must be specified for a node, "
1255 	            "5 addresses specified for node 'node1'",
1256 	            reports.CorosyncBadNodeAddressesCount(5, 1, 4, "node1"),
1257 	        )
1258 	
1259 	    def test_node_id(self):
1260 	        self.assert_message_from_report(
1261 	            "At least 1 and at most 4 addresses must be specified for a node, "
1262 	            "5 addresses specified for node '2'",
1263 	            reports.CorosyncBadNodeAddressesCount(5, 1, 4, node_index=2),
1264 	        )
1265 	
1266 	    def test_node_name_and_id(self):
1267 	        self.assert_message_from_report(
1268 	            "At least 1 and at most 4 addresses must be specified for a node, "
1269 	            "5 addresses specified for node 'node2'",
1270 	            reports.CorosyncBadNodeAddressesCount(5, 1, 4, "node2", 2),
1271 	        )
1272 	
1273 	    def test_one_address_allowed(self):
1274 	        self.assert_message_from_report(
1275 	            "At least 0 and at most 1 address must be specified for a node, "
1276 	            "2 addresses specified for node 'node2'",
1277 	            reports.CorosyncBadNodeAddressesCount(2, 0, 1, "node2", 2),
1278 	        )
1279 	
1280 	    def test_one_address_specified(self):
1281 	        self.assert_message_from_report(
1282 	            "At least 2 and at most 4 addresses must be specified for a node, "
1283 	            "1 address specified for node 'node2'",
1284 	            reports.CorosyncBadNodeAddressesCount(1, 2, 4, "node2", 2),
1285 	        )
1286 	
1287 	    def test_exactly_one_address_allowed(self):
1288 	        self.assert_message_from_report(
1289 	            "1 address must be specified for a node, "
1290 	            "2 addresses specified for node 'node2'",
1291 	            reports.CorosyncBadNodeAddressesCount(2, 1, 1, "node2", 2),
1292 	        )
1293 	
1294 	    def test_exactly_two_addresses_allowed(self):
1295 	        self.assert_message_from_report(
1296 	            "2 addresses must be specified for a node, "
1297 	            "1 address specified for node 'node2'",
1298 	            reports.CorosyncBadNodeAddressesCount(1, 2, 2, "node2", 2),
1299 	        )
1300 	
1301 	
1302 	class CorosyncIpVersionMismatchInLinks(NameBuildTest):
1303 	    def test_without_links(self):
1304 	        self.assert_message_from_report(
1305 	            "Using both IPv4 and IPv6 on one link is not allowed; please, use "
1306 	            "either IPv4 or IPv6",
1307 	            reports.CorosyncIpVersionMismatchInLinks(),
1308 	        )
1309 	
1310 	    def test_with_single_link(self):
1311 	        self.assert_message_from_report(
1312 	            "Using both IPv4 and IPv6 on one link is not allowed; please, use "
1313 	            "either IPv4 or IPv6 on link(s): '3'",
1314 	            reports.CorosyncIpVersionMismatchInLinks(["3"]),
1315 	        )
1316 	
1317 	    def test_with_links(self):
1318 	        self.assert_message_from_report(
1319 	            "Using both IPv4 and IPv6 on one link is not allowed; please, use "
1320 	            "either IPv4 or IPv6 on link(s): '0', '3', '4'",
1321 	            reports.CorosyncIpVersionMismatchInLinks(["3", "0", "4"]),
1322 	        )
1323 	
1324 	
1325 	class CorosyncAddressIpVersionWrongForLink(NameBuildTest):
1326 	    def test_without_links(self):
1327 	        self.assert_message_from_report(
1328 	            "Address '192.168.100.42' cannot be used in the link because "
1329 	            "the link uses IPv6 addresses",
1330 	            reports.CorosyncAddressIpVersionWrongForLink(
1331 	                "192.168.100.42",
1332 	                "IPv6",
1333 	            ),
1334 	        )
1335 	
1336 	    def test_with_links(self):
1337 	        self.assert_message_from_report(
1338 	            "Address '192.168.100.42' cannot be used in link '3' because "
1339 	            "the link uses IPv6 addresses",
1340 	            reports.CorosyncAddressIpVersionWrongForLink(
1341 	                "192.168.100.42",
1342 	                "IPv6",
1343 	                3,
1344 	            ),
1345 	        )
1346 	
1347 	
1348 	class CorosyncLinkNumberDuplication(NameBuildTest):
1349 	    _template = "Link numbers must be unique, duplicate link numbers: {values}"
1350 	
1351 	    def test_message(self):
1352 	        self.assert_message_from_report(
1353 	            self._template.format(values="'1', '3'"),
1354 	            reports.CorosyncLinkNumberDuplication(["1", "3"]),
1355 	        )
1356 	
1357 	    def test_sort(self):
1358 	        self.assert_message_from_report(
1359 	            self._template.format(values="'1', '3'"),
1360 	            reports.CorosyncLinkNumberDuplication(["3", "1"]),
1361 	        )
1362 	
1363 	    def test_sort_not_int(self):
1364 	        self.assert_message_from_report(
1365 	            self._template.format(values="'-5', 'x3', '1', '3'"),
1366 	            reports.CorosyncLinkNumberDuplication(["3", "1", "x3", "-5"]),
1367 	        )
1368 	
1369 	
1370 	class CorosyncNodeAddressCountMismatch(NameBuildTest):
1371 	    def test_message(self):
1372 	        self.assert_message_from_report(
1373 	            "All nodes must have the same number of addresses; "
1374 	            "nodes 'node3', 'node4', 'node6' have 1 address; "
1375 	            "nodes 'node2', 'node5' have 3 addresses; "
1376 	            "node 'node1' has 2 addresses",
1377 	            reports.CorosyncNodeAddressCountMismatch(
1378 	                {
1379 	                    "node1": 2,
1380 	                    "node2": 3,
1381 	                    "node3": 1,
1382 	                    "node4": 1,
1383 	                    "node5": 3,
1384 	                    "node6": 1,
1385 	                }
1386 	            ),
1387 	        )
1388 	
1389 	
1390 	class NodeAddressesAlreadyExist(NameBuildTest):
1391 	    def test_one_address(self):
1392 	        self.assert_message_from_report(
1393 	            "Node address 'node1' is already used by existing nodes; please, "
1394 	            "use other address",
1395 	            reports.NodeAddressesAlreadyExist(["node1"]),
1396 	        )
1397 	
1398 	    def test_more_addresses(self):
1399 	        self.assert_message_from_report(
1400 	            "Node addresses 'node1', 'node3' are already used by existing "
1401 	            "nodes; please, use other addresses",
1402 	            reports.NodeAddressesAlreadyExist(["node1", "node3"]),
1403 	        )
1404 	
1405 	
1406 	class NodeAddressesCannotBeEmpty(NameBuildTest):
1407 	    def test_one_node(self):
1408 	        self.assert_message_from_report(
1409 	            ("Empty address set for node 'node2', an address cannot be empty"),
1410 	            reports.NodeAddressesCannotBeEmpty(["node2"]),
1411 	        )
1412 	
1413 	    def test_more_nodes(self):
1414 	        self.assert_message_from_report(
1415 	            (
1416 	                "Empty address set for nodes 'node1', 'node2', "
1417 	                "an address cannot be empty"
1418 	            ),
1419 	            reports.NodeAddressesCannotBeEmpty(["node2", "node1"]),
1420 	        )
1421 	
1422 	
1423 	class NodeAddressesDuplication(NameBuildTest):
1424 	    def test_message(self):
1425 	        self.assert_message_from_report(
1426 	            "Node addresses must be unique, duplicate addresses: "
1427 	            "'node1', 'node3'",
1428 	            reports.NodeAddressesDuplication(["node1", "node3"]),
1429 	        )
1430 	
1431 	
1432 	class NodeNamesAlreadyExist(NameBuildTest):
1433 	    def test_one_address(self):
1434 	        self.assert_message_from_report(
1435 	            "Node name 'node1' is already used by existing nodes; please, "
1436 	            "use other name",
1437 	            reports.NodeNamesAlreadyExist(["node1"]),
1438 	        )
1439 	
1440 	    def test_more_addresses(self):
1441 	        self.assert_message_from_report(
1442 	            "Node names 'node1', 'node3' are already used by existing "
1443 	            "nodes; please, use other names",
1444 	            reports.NodeNamesAlreadyExist(["node1", "node3"]),
1445 	        )
1446 	
1447 	
1448 	class NodeNamesDuplication(NameBuildTest):
1449 	    def test_message(self):
1450 	        self.assert_message_from_report(
1451 	            "Node names must be unique, duplicate names: 'node1', 'node3'",
1452 	            reports.NodeNamesDuplication(["node1", "node3"]),
1453 	        )
1454 	
1455 	
1456 	class CorosyncNodesMissing(NameBuildTest):
1457 	    def test_message(self):
1458 	        self.assert_message_from_report(
1459 	            "No nodes have been specified", reports.CorosyncNodesMissing()
1460 	        )
1461 	
1462 	
1463 	class CorosyncNodeRenameOldNodeNotFound(NameBuildTest):
1464 	    def test_message(self):
1465 	        self.assert_message_from_report(
1466 	            ("Node 'node1' was not found in corosync.conf, unable to rename"),
1467 	            reports.CorosyncNodeRenameOldNodeNotFound("node1"),
1468 	        )
1469 	
1470 	
1471 	class CorosyncNodeRenameNewNodeAlreadyExists(NameBuildTest):
1472 	    def test_message(self):
1473 	        self.assert_message_from_report(
1474 	            ("Node 'node2' already exists in corosync.conf, unable to rename"),
1475 	            reports.CorosyncNodeRenameNewNodeAlreadyExists("node2"),
1476 	        )
1477 	
1478 	
1479 	class CorosyncNodeRenameAddrsMatchOldName(NameBuildTest):
1480 	    def test_message(self):
1481 	        self.assert_message_from_report(
1482 	            (
1483 	                "Node 'node1' has been renamed to 'node1-new', but the"
1484 	                " following addresses still reference the old name:"
1485 	                " node1-new: ring1_addr; node2: ring0_addr"
1486 	            ),
1487 	            reports.CorosyncNodeRenameAddrsMatchOldName(
1488 	                "node1",
1489 	                "node1-new",
1490 	                {"node1-new": ["ring1_addr"], "node2": ["ring0_addr"]},
1491 	            ),
1492 	        )
1493 	
1494 	
1495 	class CorosyncTooManyLinksOptions(NameBuildTest):
1496 	    def test_message(self):
1497 	        self.assert_message_from_report(
1498 	            (
1499 	                "Cannot specify options for more links (7) than how many is "
1500 	                "defined by number of addresses per node (3)"
1501 	            ),
1502 	            reports.CorosyncTooManyLinksOptions(7, 3),
1503 	        )
1504 	
1505 	
1506 	class CorosyncCannotAddRemoveLinksBadTransport(NameBuildTest):
1507 	    def test_add(self):
1508 	        self.assert_message_from_report(
1509 	            (
1510 	                "Cluster is using udp transport which does not support "
1511 	                "adding links"
1512 	            ),
1513 	            reports.CorosyncCannotAddRemoveLinksBadTransport(
1514 	                "udp", ["knet1", "knet2"], add_or_not_remove=True
1515 	            ),
1516 	        )
1517 	
1518 	    def test_remove(self):
1519 	        self.assert_message_from_report(
1520 	            (
1521 	                "Cluster is using udpu transport which does not support "
1522 	                "removing links"
1523 	            ),
1524 	            reports.CorosyncCannotAddRemoveLinksBadTransport(
1525 	                "udpu", ["knet"], add_or_not_remove=False
1526 	            ),
1527 	        )
1528 	
1529 	
1530 	class CorosyncCannotAddRemoveLinksNoLinksSpecified(NameBuildTest):
1531 	    def test_add(self):
1532 	        self.assert_message_from_report(
1533 	            "Cannot add links, no links to add specified",
1534 	            reports.CorosyncCannotAddRemoveLinksNoLinksSpecified(
1535 	                add_or_not_remove=True
1536 	            ),
1537 	        )
1538 	
1539 	    def test_remove(self):
1540 	        self.assert_message_from_report(
1541 	            "Cannot remove links, no links to remove specified",
1542 	            reports.CorosyncCannotAddRemoveLinksNoLinksSpecified(
1543 	                add_or_not_remove=False
1544 	            ),
1545 	        )
1546 	
1547 	
1548 	class CorosyncCannotAddRemoveLinksTooManyFewLinks(NameBuildTest):
1549 	    def test_add(self):
1550 	        self.assert_message_from_report(
1551 	            (
1552 	                "Cannot add 1 link, there would be 1 link defined which is "
1553 	                "more than allowed number of 1 link"
1554 	            ),
1555 	            reports.CorosyncCannotAddRemoveLinksTooManyFewLinks(
1556 	                1, 1, 1, add_or_not_remove=True
1557 	            ),
1558 	        )
1559 	
1560 	    def test_add_s(self):
1561 	        self.assert_message_from_report(
1562 	            (
1563 	                "Cannot add 2 links, there would be 4 links defined which is "
1564 	                "more than allowed number of 3 links"
1565 	            ),
1566 	            reports.CorosyncCannotAddRemoveLinksTooManyFewLinks(
1567 	                2, 4, 3, add_or_not_remove=True
1568 	            ),
1569 	        )
1570 	
1571 	    def test_remove(self):
1572 	        self.assert_message_from_report(
1573 	            (
1574 	                "Cannot remove 1 link, there would be 1 link defined which is "
1575 	                "less than allowed number of 1 link"
1576 	            ),
1577 	            reports.CorosyncCannotAddRemoveLinksTooManyFewLinks(
1578 	                1, 1, 1, add_or_not_remove=False
1579 	            ),
1580 	        )
1581 	
1582 	    def test_remove_s(self):
1583 	        self.assert_message_from_report(
1584 	            (
1585 	                "Cannot remove 3 links, there would be 0 links defined which "
1586 	                "is less than allowed number of 2 links"
1587 	            ),
1588 	            reports.CorosyncCannotAddRemoveLinksTooManyFewLinks(
1589 	                3, 0, 2, add_or_not_remove=False
1590 	            ),
1591 	        )
1592 	
1593 	
1594 	class CorosyncLinkAlreadyExistsCannotAdd(NameBuildTest):
1595 	    def test_message(self):
1596 	        self.assert_message_from_report(
1597 	            "Cannot add link '2', it already exists",
1598 	            reports.CorosyncLinkAlreadyExistsCannotAdd("2"),
1599 	        )
1600 	
1601 	
1602 	class CorosyncLinkDoesNotExistCannotRemove(NameBuildTest):
1603 	    def test_single_link(self):
1604 	        self.assert_message_from_report(
1605 	            ("Cannot remove non-existent link 'abc', existing links: '5'"),
1606 	            reports.CorosyncLinkDoesNotExistCannotRemove(["abc"], ["5"]),
1607 	        )
1608 	
1609 	    def test_multiple_links(self):
1610 	        self.assert_message_from_report(
1611 	            (
1612 	                "Cannot remove non-existent links '0', '1', 'abc', existing "
1613 	                "links: '2', '3', '5'"
1614 	            ),
1615 	            reports.CorosyncLinkDoesNotExistCannotRemove(
1616 	                ["1", "0", "abc"], ["3", "2", "5"]
1617 	            ),
1618 	        )
1619 	
1620 	
1621 	class CorosyncLinkDoesNotExistCannotUpdate(NameBuildTest):
1622 	    def test_link_list_several(self):
1623 	        self.assert_message_from_report(
1624 	            (
1625 	                "Cannot set options for non-existent link '3'"
1626 	                ", existing links: '0', '1', '2', '6', '7'"
1627 	            ),
1628 	            reports.CorosyncLinkDoesNotExistCannotUpdate(
1629 	                3, ["6", "7", "0", "1", "2"]
1630 	            ),
1631 	        )
1632 	
1633 	    def test_link_list_one(self):
1634 	        self.assert_message_from_report(
1635 	            (
1636 	                "Cannot set options for non-existent link '3'"
1637 	                ", existing links: '0'"
1638 	            ),
1639 	            reports.CorosyncLinkDoesNotExistCannotUpdate(3, ["0"]),
1640 	        )
1641 	
1642 	
1643 	class CorosyncTransportUnsupportedOptions(NameBuildTest):
1644 	    def test_udp(self):
1645 	        self.assert_message_from_report(
1646 	            "The udp/udpu transport does not support 'crypto' options, use "
1647 	            "'knet' transport",
1648 	            reports.CorosyncTransportUnsupportedOptions(
1649 	                "crypto", "udp/udpu", ["knet"]
1650 	            ),
1651 	        )
1652 	
1653 	    def test_multiple_supported_transports(self):
1654 	        self.assert_message_from_report(
1655 	            "The udp/udpu transport does not support 'crypto' options, use "
1656 	            "'knet', 'knet2' transport",
1657 	            reports.CorosyncTransportUnsupportedOptions(
1658 	                "crypto", "udp/udpu", ["knet", "knet2"]
1659 	            ),
1660 	        )
1661 	
1662 	
1663 	class ClusterUuidAlreadySet(NameBuildTest):
1664 	    def test_all(self):
1665 	        self.assert_message_from_report(
1666 	            "Cluster UUID has already been set", reports.ClusterUuidAlreadySet()
1667 	        )
1668 	
1669 	
1670 	class QdeviceAlreadyDefined(NameBuildTest):
1671 	    def test_all(self):
1672 	        self.assert_message_from_report(
1673 	            "quorum device is already defined", reports.QdeviceAlreadyDefined()
1674 	        )
1675 	
1676 	
1677 	class QdeviceNotDefined(NameBuildTest):
1678 	    def test_all(self):
1679 	        self.assert_message_from_report(
1680 	            "no quorum device is defined in this cluster",
1681 	            reports.QdeviceNotDefined(),
1682 	        )
1683 	
1684 	
1685 	class QdeviceClientReloadStarted(NameBuildTest):
1686 	    def test_all(self):
1687 	        self.assert_message_from_report(
1688 	            "Reloading qdevice configuration on nodes...",
1689 	            reports.QdeviceClientReloadStarted(),
1690 	        )
1691 	
1692 	
1693 	class QdeviceAlreadyInitialized(NameBuildTest):
1694 	    def test_all(self):
1695 	        self.assert_message_from_report(
1696 	            "Quorum device 'model' has been already initialized",
1697 	            reports.QdeviceAlreadyInitialized("model"),
1698 	        )
1699 	
1700 	
1701 	class QdeviceNotInitialized(NameBuildTest):
1702 	    def test_all(self):
1703 	        self.assert_message_from_report(
1704 	            "Quorum device 'model' has not been initialized yet",
1705 	            reports.QdeviceNotInitialized("model"),
1706 	        )
1707 	
1708 	
1709 	class QdeviceInitializationSuccess(NameBuildTest):
1710 	    def test_all(self):
1711 	        self.assert_message_from_report(
1712 	            "Quorum device 'model' initialized",
1713 	            reports.QdeviceInitializationSuccess("model"),
1714 	        )
1715 	
1716 	
1717 	class QdeviceInitializationError(NameBuildTest):
1718 	    def test_all(self):
1719 	        self.assert_message_from_report(
1720 	            "Unable to initialize quorum device 'model': reason",
1721 	            reports.QdeviceInitializationError("model", "reason"),
1722 	        )
1723 	
1724 	
1725 	class QdeviceCertificateDistributionStarted(NameBuildTest):
1726 	    def test_all(self):
1727 	        self.assert_message_from_report(
1728 	            "Setting up qdevice certificates on nodes...",
1729 	            reports.QdeviceCertificateDistributionStarted(),
1730 	        )
1731 	
1732 	
1733 	class QdeviceCertificateAcceptedByNode(NameBuildTest):
1734 	    def test_all(self):
1735 	        self.assert_message_from_report(
1736 	            "node1: Succeeded",
1737 	            reports.QdeviceCertificateAcceptedByNode("node1"),
1738 	        )
1739 	
1740 	
1741 	class QdeviceCertificateRemovalStarted(NameBuildTest):
1742 	    def test_all(self):
1743 	        self.assert_message_from_report(
1744 	            "Removing qdevice certificates from nodes...",
1745 	            reports.QdeviceCertificateRemovalStarted(),
1746 	        )
1747 	
1748 	
1749 	class QdeviceCertificateRemovedFromNode(NameBuildTest):
1750 	    def test_all(self):
1751 	        self.assert_message_from_report(
1752 	            "node2: Succeeded",
1753 	            reports.QdeviceCertificateRemovedFromNode("node2"),
1754 	        )
1755 	
1756 	
1757 	class QdeviceCertificateImportError(NameBuildTest):
1758 	    def test_all(self):
1759 	        self.assert_message_from_report(
1760 	            "Unable to import quorum device certificate: reason",
1761 	            reports.QdeviceCertificateImportError("reason"),
1762 	        )
1763 	
1764 	
1765 	class QdeviceCertificateSignError(NameBuildTest):
1766 	    def test_all(self):
1767 	        self.assert_message_from_report(
1768 	            "Unable to sign quorum device certificate: reason",
1769 	            reports.QdeviceCertificateSignError("reason"),
1770 	        )
1771 	
1772 	
1773 	class QdeviceCertificateBadFormat(NameBuildTest):
1774 	    def test_all(self):
1775 	        self.assert_message_from_report(
1776 	            "Unable to parse quorum device certificate",
1777 	            reports.QdeviceCertificateBadFormat(),
1778 	        )
1779 	
1780 	
1781 	class QdeviceCertificateReadError(NameBuildTest):
1782 	    def test_all(self):
1783 	        self.assert_message_from_report(
1784 	            "Unable to read quorum device certificate: reason",
1785 	            reports.QdeviceCertificateReadError("reason"),
1786 	        )
1787 	
1788 	
1789 	class QdeviceDestroySuccess(NameBuildTest):
1790 	    def test_all(self):
1791 	        self.assert_message_from_report(
1792 	            "Quorum device 'model' configuration files removed",
1793 	            reports.QdeviceDestroySuccess("model"),
1794 	        )
1795 	
1796 	
1797 	class QdeviceDestroyError(NameBuildTest):
1798 	    def test_all(self):
1799 	        self.assert_message_from_report(
1800 	            "Unable to destroy quorum device 'model': reason",
1801 	            reports.QdeviceDestroyError("model", "reason"),
1802 	        )
1803 	
1804 	
1805 	class QdeviceNotRunning(NameBuildTest):
1806 	    def test_all(self):
1807 	        self.assert_message_from_report(
1808 	            "Quorum device 'model' is not running",
1809 	            reports.QdeviceNotRunning("model"),
1810 	        )
1811 	
1812 	
1813 	class QdeviceGetStatusError(NameBuildTest):
1814 	    def test_all(self):
1815 	        self.assert_message_from_report(
1816 	            "Unable to get status of quorum device 'model': reason",
1817 	            reports.QdeviceGetStatusError("model", "reason"),
1818 	        )
1819 	
1820 	
1821 	class QdeviceUsedByClusters(NameBuildTest):
1822 	    def test_single_cluster(self):
1823 	        self.assert_message_from_report(
1824 	            "Quorum device is currently being used by cluster(s): 'c1'",
1825 	            reports.QdeviceUsedByClusters(["c1"]),
1826 	        )
1827 	
1828 	    def test_multiple_clusters(self):
1829 	        self.assert_message_from_report(
1830 	            "Quorum device is currently being used by cluster(s): 'c1', 'c2'",
1831 	            reports.QdeviceUsedByClusters(["c1", "c2"]),
1832 	        )
1833 	
1834 	
1835 	class IdAlreadyExists(NameBuildTest):
1836 	    def test_all(self):
1837 	        self.assert_message_from_report(
1838 	            "'id' already exists", reports.IdAlreadyExists("id")
1839 	        )
1840 	
1841 	
1842 	class IdBelongsToUnexpectedType(NameBuildTest):
1843 	    def test_build_message_with_single_type(self):
1844 	        self.assert_message_from_report(
1845 	            "'ID' is not an ACL permission",
1846 	            reports.IdBelongsToUnexpectedType("ID", ["acl_permission"], "op"),
1847 	        )
1848 	
1849 	    def test_build_message_with_data(self):
1850 	        self.assert_message_from_report(
1851 	            "'ID' is not a clone / resource",
1852 	            reports.IdBelongsToUnexpectedType(
1853 	                "ID", ["primitive", "clone"], "op"
1854 	            ),
1855 	        )
1856 	
1857 	    def test_build_message_with_transformation_and_article(self):
1858 	        self.assert_message_from_report(
1859 	            "'ID' is not an ACL group / ACL user",
1860 	            reports.IdBelongsToUnexpectedType(
1861 	                "ID",
1862 	                ["acl_target", "acl_group"],
1863 	                "op",
1864 	            ),
1865 	        )
1866 	
1867 	
1868 	class IdDoesNotSupportElementDescriptions(NameBuildTest):
1869 	    def test_success(self):
1870 	        self.assert_message_from_report(
1871 	            (
1872 	                "'ID' is a location constraint, descriptions are only "
1873 	                "supported for clone / resource"
1874 	            ),
1875 	            reports.IdDoesNotSupportElementDescriptions(
1876 	                "ID",
1877 	                "rsc_location",
1878 	                ["primitive", "clone"],
1879 	            ),
1880 	        )
1881 	
1882 	
1883 	class ObjectWithIdInUnexpectedContext(NameBuildTest):
1884 	    def test_with_context_id(self):
1885 	        self.assert_message_from_report(
1886 	            "resource 'R' exists but does not belong to group 'G'",
1887 	            reports.ObjectWithIdInUnexpectedContext(
1888 	                "primitive", "R", "group", "G"
1889 	            ),
1890 	        )
1891 	
1892 	    def test_without_context_id(self):
1893 	        self.assert_message_from_report(
1894 	            "group 'G' exists but does not belong to 'resource'",
1895 	            reports.ObjectWithIdInUnexpectedContext(
1896 	                "group", "G", "primitive", ""
1897 	            ),
1898 	        )
1899 	
1900 	
1901 	class IdNotFound(NameBuildTest):
1902 	    def test_id(self):
1903 	        self.assert_message_from_report(
1904 	            "'ID' does not exist", reports.IdNotFound("ID", [])
1905 	        )
1906 	
1907 	    def test_id_and_type(self):
1908 	        self.assert_message_from_report(
1909 	            "clone / resource 'ID' does not exist",
1910 	            reports.IdNotFound("ID", ["primitive", "clone"]),
1911 	        )
1912 	
1913 	    def test_context(self):
1914 	        self.assert_message_from_report(
1915 	            "there is no 'ID' in the C_TYPE 'C_ID'",
1916 	            reports.IdNotFound(
1917 	                "ID", [], context_type="C_TYPE", context_id="C_ID"
1918 	            ),
1919 	        )
1920 	
1921 	    def test_type_and_context(self):
1922 	        self.assert_message_from_report(
1923 	            "there is no ACL user 'ID' in the C_TYPE 'C_ID'",
1924 	            reports.IdNotFound(
1925 	                "ID", ["acl_target"], context_type="C_TYPE", context_id="C_ID"
1926 	            ),
1927 	        )
1928 	
1929 	
1930 	class ResourceBundleAlreadyContainsAResource(NameBuildTest):
1931 	    def test_build_message_with_data(self):
1932 	        self.assert_message_from_report(
1933 	            (
1934 	                "bundle 'test_bundle' already contains resource "
1935 	                "'test_resource', a bundle may contain at most one resource"
1936 	            ),
1937 	            reports.ResourceBundleAlreadyContainsAResource(
1938 	                "test_bundle", "test_resource"
1939 	            ),
1940 	        )
1941 	
1942 	
1943 	class CannotGroupResourceWrongType(NameBuildTest):
1944 	    def test_without_parent(self):
1945 	        self.assert_message_from_report(
1946 	            (
1947 	                "'R' is a clone resource, clone resources cannot be put into "
1948 	                "a group"
1949 	            ),
1950 	            reports.CannotGroupResourceWrongType("R", "master", None, None),
1951 	        )
1952 	
1953 	    def test_with_parent(self):
1954 	        self.assert_message_from_report(
1955 	            (
1956 	                "'R' cannot be put into a group because its parent 'B' "
1957 	                "is a bundle resource"
1958 	            ),
1959 	            reports.CannotGroupResourceWrongType(
1960 	                "R", "primitive", "B", "bundle"
1961 	            ),
1962 	        )
1963 	
1964 	
1965 	class UnableToGetResourceOperationDigests(NameBuildTest):
1966 	    def test_success(self):
1967 	        self.assert_message_from_report(
1968 	            "unable to get resource operation digests:\ncrm_resource output",
1969 	            reports.UnableToGetResourceOperationDigests("crm_resource output"),
1970 	        )
1971 	
1972 	
1973 	class StonithResourcesDoNotExist(NameBuildTest):
1974 	    def test_success(self):
1975 	        self.assert_message_from_report(
1976 	            "Stonith resource(s) 'device1', 'device2' do not exist",
1977 	            reports.StonithResourcesDoNotExist(["device2", "device1"]),
1978 	        )
1979 	
1980 	
1981 	class StonithRestartlessUpdateOfScsiDevicesNotSupported(NameBuildTest):
1982 	    def test_success(self):
1983 	        self.assert_message_from_report(
1984 	            (
1985 	                "Restartless update of scsi devices is not supported, please "
1986 	                "upgrade pacemaker"
1987 	            ),
1988 	            reports.StonithRestartlessUpdateOfScsiDevicesNotSupported(),
1989 	        )
1990 	
1991 	
1992 	class StonithRestartlessUpdateUnsupportedAgent(NameBuildTest):
1993 	    def test_plural(self):
1994 	        self.assert_message_from_report(
1995 	            (
1996 	                "Resource 'fence_sbd' is not a stonith resource or its type "
1997 	                "'wrong_type' is not supported for devices update. Supported "
1998 	                "types: 'fence_mpath', 'fence_scsi'"
1999 	            ),
2000 	            reports.StonithRestartlessUpdateUnsupportedAgent(
2001 	                "fence_sbd", "wrong_type", ["fence_scsi", "fence_mpath"]
2002 	            ),
2003 	        )
2004 	
2005 	    def test_singular(self):
2006 	        self.assert_message_from_report(
2007 	            (
2008 	                "Resource 'fence_sbd' is not a stonith resource or its type "
2009 	                "'wrong_type' is not supported for devices update. Supported "
2010 	                "type: 'fence_scsi'"
2011 	            ),
2012 	            reports.StonithRestartlessUpdateUnsupportedAgent(
2013 	                "fence_sbd", "wrong_type", ["fence_scsi"]
2014 	            ),
2015 	        )
2016 	
2017 	
2018 	class StonithUnfencingFailed(NameBuildTest):
2019 	    def test_build_message(self):
2020 	        self.assert_message_from_report(
2021 	            ("Unfencing failed:\nreason"),
2022 	            reports.StonithUnfencingFailed("reason"),
2023 	        )
2024 	
2025 	
2026 	class StonithUnfencingDeviceStatusFailed(NameBuildTest):
2027 	    def test_build_message(self):
2028 	        self.assert_message_from_report(
2029 	            "Unfencing failed, unable to check status of device 'dev1': reason",
2030 	            reports.StonithUnfencingDeviceStatusFailed("dev1", "reason"),
2031 	        )
2032 	
2033 	
2034 	class StonithUnfencingSkippedDevicesFenced(NameBuildTest):
2035 	    def test_one_device(self):
2036 	        self.assert_message_from_report(
2037 	            "Unfencing skipped, device 'dev1' is fenced",
2038 	            reports.StonithUnfencingSkippedDevicesFenced(["dev1"]),
2039 	        )
2040 	
2041 	    def test_multiple_devices(self):
2042 	        self.assert_message_from_report(
2043 	            "Unfencing skipped, devices 'dev1', 'dev2', 'dev3' are fenced",
2044 	            reports.StonithUnfencingSkippedDevicesFenced(
2045 	                ["dev2", "dev1", "dev3"]
2046 	            ),
2047 	        )
2048 	
2049 	
2050 	class StonithRestartlessUpdateUnableToPerform(NameBuildTest):
2051 	    def test_build_message(self):
2052 	        self.assert_message_from_report(
2053 	            "Unable to perform restartless update of scsi devices: reason",
2054 	            reports.StonithRestartlessUpdateUnableToPerform("reason"),
2055 	        )
2056 	
2057 	    def test_build_message_reason_type_specified(self):
2058 	        self.assert_message_from_report(
2059 	            "Unable to perform restartless update of scsi devices: reason",
2060 	            reports.StonithRestartlessUpdateUnableToPerform(
2061 	                "reason",
2062 	                const.STONITH_RESTARTLESS_UPDATE_UNABLE_TO_PERFORM_REASON_NOT_RUNNING,
2063 	            ),
2064 	        )
2065 	
2066 	
2067 	class StonithRestartlessUpdateMissingMpathKeys(NameBuildTest):
2068 	    def test_plural(self):
2069 	        self.assert_message_from_report(
2070 	            (
2071 	                "Missing mpath reservation keys for nodes: 'rh9-2', 'rh9-3', "
2072 	                "in 'pcmk_host_map' value: 'rh9-1:1'"
2073 	            ),
2074 	            reports.StonithRestartlessUpdateMissingMpathKeys(
2075 	                "rh9-1:1", ["rh9-2", "rh9-3"]
2076 	            ),
2077 	        )
2078 	
2079 	    def test_singular(self):
2080 	        self.assert_message_from_report(
2081 	            (
2082 	                "Missing mpath reservation key for node: 'rh9-2', "
2083 	                "in 'pcmk_host_map' value: 'rh9-1:1'"
2084 	            ),
2085 	            reports.StonithRestartlessUpdateMissingMpathKeys(
2086 	                "rh9-1:1", ["rh9-2"]
2087 	            ),
2088 	        )
2089 	
2090 	    def test_missing_map_and_empty_nodes(self):
2091 	        self.assert_message_from_report(
2092 	            "Missing mpath reservation keys, 'pcmk_host_map' not set",
2093 	            reports.StonithRestartlessUpdateMissingMpathKeys(None, []),
2094 	        )
2095 	
2096 	    def test_missing_map_non_empty_nodes(self):
2097 	        self.assert_message_from_report(
2098 	            "Missing mpath reservation keys, 'pcmk_host_map' not set",
2099 	            reports.StonithRestartlessUpdateMissingMpathKeys(
2100 	                None, ["rh9-1", "rh9-2"]
2101 	            ),
2102 	        )
2103 	
2104 	    def test_non_empty_map_empty_nodes(self):
2105 	        self.assert_message_from_report(
2106 	            (
2107 	                "Missing mpath reservation keys for nodes in 'pcmk_host_map' "
2108 	                "value: 'rh-1:1'"
2109 	            ),
2110 	            reports.StonithRestartlessUpdateMissingMpathKeys("rh-1:1", []),
2111 	        )
2112 	
2113 	
2114 	class ResourceRunningOnNodes(NameBuildTest):
2115 	    def test_one_node(self):
2116 	        self.assert_message_from_report(
2117 	            "resource 'R' is running on node 'node1'",
2118 	            reports.ResourceRunningOnNodes("R", {"Started": ["node1"]}),
2119 	        )
2120 	
2121 	    def test_multiple_nodes(self):
2122 	        self.assert_message_from_report(
2123 	            "resource 'R' is running on nodes 'node1', 'node2'",
2124 	            reports.ResourceRunningOnNodes(
2125 	                "R", {"Started": ["node1", "node2"]}
2126 	            ),
2127 	        )
2128 	
2129 	    def test_multiple_role_multiple_nodes(self):
2130 	        self.assert_message_from_report(
2131 	            "resource 'R' is promoted on node 'node3'"
2132 	            "; running on nodes 'node1', 'node2'",
2133 	            reports.ResourceRunningOnNodes(
2134 	                "R",
2135 	                {
2136 	                    "Started": ["node1", "node2"],
2137 	                    "Promoted": ["node3"],
2138 	                },
2139 	            ),
2140 	        )
2141 	
2142 	
2143 	class ResourceDoesNotRun(NameBuildTest):
2144 	    def test_build_message(self):
2145 	        self.assert_message_from_report(
2146 	            "resource 'R' is not running on any node",
2147 	            reports.ResourceDoesNotRun("R"),
2148 	        )
2149 	
2150 	
2151 	class ResourceIsGuestNodeAlready(NameBuildTest):
2152 	    def test_build_messages(self):
2153 	        self.assert_message_from_report(
2154 	            "the resource 'some-resource' is already a guest node",
2155 	            reports.ResourceIsGuestNodeAlready("some-resource"),
2156 	        )
2157 	
2158 	
2159 	class ResourceIsUnmanaged(NameBuildTest):
2160 	    def test_build_message(self):
2161 	        self.assert_message_from_report(
2162 	            "'R' is unmanaged", reports.ResourceIsUnmanaged("R")
2163 	        )
2164 	
2165 	
2166 	class ResourceManagedNoMonitorEnabled(NameBuildTest):
2167 	    def test_build_message(self):
2168 	        self.assert_message_from_report(
2169 	            "Resource 'R' has no enabled monitor operations",
2170 	            reports.ResourceManagedNoMonitorEnabled("R"),
2171 	        )
2172 	
2173 	
2174 	class CibLoadError(NameBuildTest):
2175 	    def test_all(self):
2176 	        self.assert_message_from_report(
2177 	            "unable to get cib", reports.CibLoadError("reason")
2178 	        )
2179 	
2180 	
2181 	class CibLoadErrorGetNodesForValidation(NameBuildTest):
2182 	    def test_all(self):
2183 	        self.assert_message_from_report(
2184 	            (
2185 	                "Unable to load CIB to get guest and remote nodes from it, "
2186 	                "those nodes cannot be considered in configuration validation"
2187 	            ),
2188 	            reports.CibLoadErrorGetNodesForValidation(),
2189 	        )
2190 	
2191 	
2192 	class CibLoadErrorScopeMissing(NameBuildTest):
2193 	    def test_all(self):
2194 	        self.assert_message_from_report(
2195 	            "unable to get cib, scope 'scope-name' not present in cib",
2196 	            reports.CibLoadErrorScopeMissing("scope-name", "reason"),
2197 	        )
2198 	
2199 	
2200 	class CibLoadErrorBadFormat(NameBuildTest):
2201 	    def test_message(self):
2202 	        self.assert_message_from_report(
2203 	            "unable to get cib, something wrong",
2204 	            reports.CibLoadErrorBadFormat("something wrong"),
2205 	        )
2206 	
2207 	
2208 	class CibCannotFindMandatorySection(NameBuildTest):
2209 	    def test_all(self):
2210 	        self.assert_message_from_report(
2211 	            "Unable to get 'section-name' section of cib",
2212 	            reports.CibCannotFindMandatorySection("section-name"),
2213 	        )
2214 	
2215 	
2216 	class CibPushError(NameBuildTest):
2217 	    def test_all(self):
2218 	        self.assert_message_from_report(
2219 	            "Unable to update cib\nreason\npushed-cib",
2220 	            reports.CibPushError("reason", "pushed-cib"),
2221 	        )
2222 	
2223 	
2224 	class CibSaveTmpError(NameBuildTest):
2225 	    def test_all(self):
2226 	        self.assert_message_from_report(
2227 	            "Unable to save CIB to a temporary file: reason",
2228 	            reports.CibSaveTmpError("reason"),
2229 	        )
2230 	
2231 	
2232 	class CibDiffError(NameBuildTest):
2233 	    def test_success(self):
2234 	        self.assert_message_from_report(
2235 	            "Unable to diff CIB: error message\n<cib-new />",
2236 	            reports.CibDiffError("error message", "<cib-old />", "<cib-new />"),
2237 	        )
2238 	
2239 	
2240 	class CibSimulateError(NameBuildTest):
2241 	    def test_success(self):
2242 	        self.assert_message_from_report(
2243 	            "Unable to simulate changes in CIB: error message",
2244 	            reports.CibSimulateError("error message"),
2245 	        )
2246 	
2247 	    def test_empty_reason(self):
2248 	        self.assert_message_from_report(
2249 	            "Unable to simulate changes in CIB",
2250 	            reports.CibSimulateError(""),
2251 	        )
2252 	
2253 	
2254 	class CrmMonError(NameBuildTest):
2255 	    def test_without_reason(self):
2256 	        self.assert_message_from_report(
2257 	            "error running crm_mon, is pacemaker running?",
2258 	            reports.CrmMonError(""),
2259 	        )
2260 	
2261 	    def test_with_reason(self):
2262 	        self.assert_message_from_report(
2263 	            (
2264 	                "error running crm_mon, is pacemaker running?"
2265 	                "\n  reason\n  spans several lines"
2266 	            ),
2267 	            reports.CrmMonError("reason\nspans several lines"),
2268 	        )
2269 	
2270 	
2271 	class BadPcmkApiResponseFormat(NameBuildTest):
2272 	    def test_all(self):
2273 	        self.assert_message_from_report(
2274 	            (
2275 	                "Cannot process pacemaker response due to a parse error: "
2276 	                "detailed parse or xml error\n"
2277 	                "pacemaker tool output"
2278 	            ),
2279 	            reports.BadPcmkApiResponseFormat(
2280 	                "detailed parse or xml error", "pacemaker tool output"
2281 	            ),
2282 	        )
2283 	
2284 	
2285 	class BadClusterStateFormat(NameBuildTest):
2286 	    def test_all(self):
2287 	        self.assert_message_from_report(
2288 	            "cannot load cluster status, xml does not conform to the schema",
2289 	            reports.BadClusterStateFormat(),
2290 	        )
2291 	
2292 	
2293 	class BadClusterStateData(NameBuildTest):
2294 	    def test_no_reason(self):
2295 	        self.assert_message_from_report(
2296 	            (
2297 	                "Cannot load cluster status, xml does not describe "
2298 	                "valid cluster status"
2299 	            ),
2300 	            reports.BadClusterStateData(),
2301 	        )
2302 	
2303 	    def test_reason(self):
2304 	        self.assert_message_from_report(
2305 	            (
2306 	                "Cannot load cluster status, xml does not describe "
2307 	                "valid cluster status: sample reason"
2308 	            ),
2309 	            reports.BadClusterStateData("sample reason"),
2310 	        )
2311 	
2312 	
2313 	class WaitForIdleStarted(NameBuildTest):
2314 	    def test_timeout(self):
2315 	        timeout = 20
2316 	        self.assert_message_from_report(
2317 	            (
2318 	                "Waiting for the cluster to apply configuration changes "
2319 	                f"(timeout: {timeout} seconds)..."
2320 	            ),
2321 	            reports.WaitForIdleStarted(timeout),
2322 	        )
2323 	
2324 	    def test_timeout_singular(self):
2325 	        timeout = 1
2326 	        self.assert_message_from_report(
2327 	            (
2328 	                "Waiting for the cluster to apply configuration changes "
2329 	                f"(timeout: {timeout} second)..."
2330 	            ),
2331 	            reports.WaitForIdleStarted(timeout),
2332 	        )
2333 	
2334 	    def test_timeout_0(self):
2335 	        self.assert_message_from_report(
2336 	            "Waiting for the cluster to apply configuration changes...",
2337 	            reports.WaitForIdleStarted(0),
2338 	        )
2339 	
2340 	    def test_timeout_negative(self):
2341 	        self.assert_message_from_report(
2342 	            "Waiting for the cluster to apply configuration changes...",
2343 	            reports.WaitForIdleStarted(-1),
2344 	        )
2345 	
2346 	
2347 	class WaitForIdleTimedOut(NameBuildTest):
2348 	    def test_all(self):
2349 	        self.assert_message_from_report(
2350 	            "waiting timeout\n\nreason", reports.WaitForIdleTimedOut("reason")
2351 	        )
2352 	
2353 	
2354 	class WaitForIdleError(NameBuildTest):
2355 	    def test_all(self):
2356 	        self.assert_message_from_report(
2357 	            "reason", reports.WaitForIdleError("reason")
2358 	        )
2359 	
2360 	
2361 	class WaitForIdleNotLiveCluster(NameBuildTest):
2362 	    def test_all(self):
2363 	        self.assert_message_from_report(
2364 	            "Cannot pass CIB together with 'wait'",
2365 	            reports.WaitForIdleNotLiveCluster(),
2366 	        )
2367 	
2368 	
2369 	class ResourceCleanupError(NameBuildTest):
2370 	    def test_minimal(self):
2371 	        self.assert_message_from_report(
2372 	            "Unable to forget failed operations of resources\nsomething wrong",
2373 	            reports.ResourceCleanupError("something wrong"),
2374 	        )
2375 	
2376 	    def test_node(self):
2377 	        self.assert_message_from_report(
2378 	            "Unable to forget failed operations of resources\nsomething wrong",
2379 	            reports.ResourceCleanupError("something wrong", node="N1"),
2380 	        )
2381 	
2382 	    def test_resource(self):
2383 	        self.assert_message_from_report(
2384 	            "Unable to forget failed operations of resource: R1\n"
2385 	            "something wrong",
2386 	            reports.ResourceCleanupError("something wrong", "R1"),
2387 	        )
2388 	
2389 	    def test_resource_and_node(self):
2390 	        self.assert_message_from_report(
2391 	            "Unable to forget failed operations of resource: R1\n"
2392 	            "something wrong",
2393 	            reports.ResourceCleanupError("something wrong", "R1", "N1"),
2394 	        )
2395 	
2396 	
2397 	class ResourceRefreshError(NameBuildTest):
2398 	    def test_minimal(self):
2399 	        self.assert_message_from_report(
2400 	            "Unable to delete history of resources\nsomething wrong",
2401 	            reports.ResourceRefreshError("something wrong"),
2402 	        )
2403 	
2404 	    def test_node(self):
2405 	        self.assert_message_from_report(
2406 	            "Unable to delete history of resources\nsomething wrong",
2407 	            reports.ResourceRefreshError(
2408 	                "something wrong",
2409 	                node="N1",
2410 	            ),
2411 	        )
2412 	
2413 	    def test_resource(self):
2414 	        self.assert_message_from_report(
2415 	            "Unable to delete history of resource: R1\nsomething wrong",
2416 	            reports.ResourceRefreshError("something wrong", "R1"),
2417 	        )
2418 	
2419 	    def test_resource_and_node(self):
2420 	        self.assert_message_from_report(
2421 	            "Unable to delete history of resource: R1\nsomething wrong",
2422 	            reports.ResourceRefreshError("something wrong", "R1", "N1"),
2423 	        )
2424 	
2425 	
2426 	class ResourceRefreshTooTimeConsuming(NameBuildTest):
2427 	    def test_success(self):
2428 	        self.assert_message_from_report(
2429 	            "Deleting history of all resources on all nodes will execute more "
2430 	            "than 25 operations in the cluster, which may negatively "
2431 	            "impact the responsiveness of the cluster. Consider specifying "
2432 	            "resource and/or node",
2433 	            reports.ResourceRefreshTooTimeConsuming(25),
2434 	        )
2435 	
2436 	
2437 	class ResourceOperationIntervalDuplication(NameBuildTest):
2438 	    def test_build_message_with_data(self):
2439 	        self.assert_message_from_report(
2440 	            "multiple specification of the same operation with the same"
2441 	            " interval:"
2442 	            "\nmonitor with intervals 3600s, 60m, 1h"
2443 	            "\nmonitor with intervals 60s, 1m",
2444 	            reports.ResourceOperationIntervalDuplication(
2445 	                {
2446 	                    "monitor": [
2447 	                        ["3600s", "60m", "1h"],
2448 	                        ["60s", "1m"],
2449 	                    ],
2450 	                }
2451 	            ),
2452 	        )
2453 	
2454 	
2455 	class ResourceOperationIntervalAdapted(NameBuildTest):
2456 	    def test_build_message_with_data(self):
2457 	        self.assert_message_from_report(
2458 	            "changing a monitor operation interval from 10 to 11 to make the"
2459 	            " operation unique",
2460 	            reports.ResourceOperationIntervalAdapted("monitor", "10", "11"),
2461 	        )
2462 	
2463 	
2464 	class NodeNotFound(NameBuildTest):
2465 	    def test_build_messages(self):
2466 	        self.assert_message_from_report(
2467 	            "Node 'SOME_NODE' does not appear to exist in configuration",
2468 	            reports.NodeNotFound("SOME_NODE"),
2469 	        )
2470 	
2471 	    def test_build_messages_with_one_search_types(self):
2472 	        self.assert_message_from_report(
2473 	            "remote node 'SOME_NODE' does not appear to exist in configuration",
2474 	            reports.NodeNotFound("SOME_NODE", ["remote"]),
2475 	        )
2476 	
2477 	    def test_build_messages_with_multiple_search_types(self):
2478 	        self.assert_message_from_report(
2479 	            "nor remote node or guest node 'SOME_NODE' does not appear to exist"
2480 	            " in configuration",
2481 	            reports.NodeNotFound("SOME_NODE", ["remote", "guest"]),
2482 	        )
2483 	
2484 	
2485 	class NodeRenameNamesEqual(NameBuildTest):
2486 	    def test_message(self):
2487 	        self.assert_message_from_report(
2488 	            (
2489 	                "Unable to rename node 'node1': "
2490 	                "new name is the same as the current name"
2491 	            ),
2492 	            reports.NodeRenameNamesEqual("node1"),
2493 	        )
2494 	
2495 	
2496 	class NodeToClearIsStillInCluster(NameBuildTest):
2497 	    def test_build_messages(self):
2498 	        self.assert_message_from_report(
2499 	            "node 'node1' seems to be still in the cluster"
2500 	            "; this command should be used only with nodes that have been"
2501 	            " removed from the cluster",
2502 	            reports.NodeToClearIsStillInCluster("node1"),
2503 	        )
2504 	
2505 	
2506 	class NodeRemoveInPacemakerFailed(NameBuildTest):
2507 	    def test_minimal(self):
2508 	        self.assert_message_from_report(
2509 	            ("Unable to remove node(s) 'NODE1', 'NODE2' from pacemaker"),
2510 	            reports.NodeRemoveInPacemakerFailed(["NODE2", "NODE1"]),
2511 	        )
2512 	
2513 	    def test_without_node(self):
2514 	        self.assert_message_from_report(
2515 	            "Unable to remove node(s) 'NODE' from pacemaker: reason",
2516 	            reports.NodeRemoveInPacemakerFailed(["NODE"], reason="reason"),
2517 	        )
2518 	
2519 	    def test_with_node(self):
2520 	        self.assert_message_from_report(
2521 	            (
2522 	                "node-a: Unable to remove node(s) 'NODE1', 'NODE2' from "
2523 	                "pacemaker: reason"
2524 	            ),
2525 	            reports.NodeRemoveInPacemakerFailed(
2526 	                ["NODE1", "NODE2"], node="node-a", reason="reason"
2527 	            ),
2528 	        )
2529 	
2530 	
2531 	class NodeRemoveInPacemakerSkipped(NameBuildTest):
2532 	    def test_one_node(self):
2533 	        self.assert_message_from_report(
2534 	            (
2535 	                "Skipping removal of node 'NODE1' from pacemaker because the "
2536 	                "command does not run on a live cluster"
2537 	            ),
2538 	            reports.NodeRemoveInPacemakerSkipped(
2539 	                const.REASON_NOT_LIVE_CIB, ["NODE1"]
2540 	            ),
2541 	        )
2542 	
2543 	    def test_multiple_nodes(self):
2544 	        self.assert_message_from_report(
2545 	            (
2546 	                "Skipping removal of nodes 'NODE1', 'NODE2' from pacemaker "
2547 	                "because the command does not run on a live cluster"
2548 	            ),
2549 	            reports.NodeRemoveInPacemakerSkipped(
2550 	                const.REASON_NOT_LIVE_CIB, ["NODE2", "NODE1"]
2551 	            ),
2552 	        )
2553 	
2554 	    def test_with_node(self):
2555 	        self.assert_message_from_report(
2556 	            (
2557 	                "node-a: Unable to remove node(s) 'NODE1', 'NODE2' from "
2558 	                "pacemaker: reason"
2559 	            ),
2560 	            reports.NodeRemoveInPacemakerFailed(
2561 	                ["NODE1", "NODE2"], node="node-a", reason="reason"
2562 	            ),
2563 	        )
2564 	
2565 	
2566 	class MultipleResultsFound(NameBuildTest):
2567 	    def test_minimal(self):
2568 	        self.assert_message_from_report(
2569 	            "more than one resource found: 'ID1', 'ID2'",
2570 	            reports.MultipleResultsFound("resource", ["ID2", "ID1"]),
2571 	        )
2572 	
2573 	    def test_build_messages(self):
2574 	        self.assert_message_from_report(
2575 	            "more than one resource for 'NODE-NAME' found: 'ID1', 'ID2'",
2576 	            reports.MultipleResultsFound(
2577 	                "resource", ["ID2", "ID1"], "NODE-NAME"
2578 	            ),
2579 	        )
2580 	
2581 	
2582 	class PacemakerSimulationResult(NameBuildTest):
2583 	    def test_default(self):
2584 	        self.assert_message_from_report(
2585 	            "\nSimulation result:\ncrm_simulate output",
2586 	            reports.PacemakerSimulationResult("crm_simulate output"),
2587 	        )
2588 	
2589 	
2590 	class PacemakerLocalNodeNameNotFound(NameBuildTest):
2591 	    def test_all(self):
2592 	        self.assert_message_from_report(
2593 	            "unable to get local node name from pacemaker: reason",
2594 	            reports.PacemakerLocalNodeNameNotFound("reason"),
2595 	        )
2596 	
2597 	
2598 	class ServiceActionStarted(NameBuildTest):
2599 	    def test_start(self):
2600 	        self.assert_message_from_report(
2601 	            "Starting a_service...",
2602 	            reports.ServiceActionStarted(
2603 	                const.SERVICE_ACTION_START, "a_service"
2604 	            ),
2605 	        )
2606 	
2607 	    def test_start_instance(self):
2608 	        self.assert_message_from_report(
2609 	            "Starting a_service@an_instance...",
2610 	            reports.ServiceActionStarted(
2611 	                const.SERVICE_ACTION_START, "a_service", "an_instance"
2612 	            ),
2613 	        )
2614 	
2615 	    def test_stop(self):
2616 	        self.assert_message_from_report(
2617 	            "Stopping a_service...",
2618 	            reports.ServiceActionStarted(
2619 	                const.SERVICE_ACTION_STOP, "a_service"
2620 	            ),
2621 	        )
2622 	
2623 	    def test_stop_instance(self):
2624 	        self.assert_message_from_report(
2625 	            "Stopping a_service@an_instance...",
2626 	            reports.ServiceActionStarted(
2627 	                const.SERVICE_ACTION_STOP, "a_service", "an_instance"
2628 	            ),
2629 	        )
2630 	
2631 	    def test_enable(self):
2632 	        self.assert_message_from_report(
2633 	            "Enabling a_service...",
2634 	            reports.ServiceActionStarted(
2635 	                const.SERVICE_ACTION_ENABLE, "a_service"
2636 	            ),
2637 	        )
2638 	
2639 	    def test_enable_instance(self):
2640 	        self.assert_message_from_report(
2641 	            "Enabling a_service@an_instance...",
2642 	            reports.ServiceActionStarted(
2643 	                const.SERVICE_ACTION_ENABLE, "a_service", "an_instance"
2644 	            ),
2645 	        )
2646 	
2647 	    def test_disable(self):
2648 	        self.assert_message_from_report(
2649 	            "Disabling a_service...",
2650 	            reports.ServiceActionStarted(
2651 	                const.SERVICE_ACTION_DISABLE, "a_service"
2652 	            ),
2653 	        )
2654 	
2655 	    def test_disable_instance(self):
2656 	        self.assert_message_from_report(
2657 	            "Disabling a_service@an_instance...",
2658 	            reports.ServiceActionStarted(
2659 	                const.SERVICE_ACTION_DISABLE, "a_service", "an_instance"
2660 	            ),
2661 	        )
2662 	
2663 	    def test_kill(self):
2664 	        self.assert_message_from_report(
2665 	            "Killing a_service...",
2666 	            reports.ServiceActionStarted(
2667 	                const.SERVICE_ACTION_KILL, "a_service"
2668 	            ),
2669 	        )
2670 	
2671 	    def test_kill_instance(self):
2672 	        self.assert_message_from_report(
2673 	            "Killing a_service@an_instance...",
2674 	            reports.ServiceActionStarted(
2675 	                const.SERVICE_ACTION_KILL, "a_service", "an_instance"
2676 	            ),
2677 	        )
2678 	
2679 	
2680 	# TODO: add tests for node if needed
2681 	class ServiceActionFailed(NameBuildTest):
2682 	    def test_start(self):
2683 	        self.assert_message_from_report(
2684 	            "Unable to start a_service: a_reason",
2685 	            reports.ServiceActionFailed(
2686 	                const.SERVICE_ACTION_START, "a_service", "a_reason"
2687 	            ),
2688 	        )
2689 	
2690 	    def test_start_instance(self):
2691 	        self.assert_message_from_report(
2692 	            "Unable to start a_service@an_instance: a_reason",
2693 	            reports.ServiceActionFailed(
2694 	                const.SERVICE_ACTION_START,
2695 	                "a_service",
2696 	                "a_reason",
2697 	                instance="an_instance",
2698 	            ),
2699 	        )
2700 	
2701 	    def test_stop(self):
2702 	        self.assert_message_from_report(
2703 	            "Unable to stop a_service: a_reason",
2704 	            reports.ServiceActionFailed(
2705 	                const.SERVICE_ACTION_STOP, "a_service", "a_reason"
2706 	            ),
2707 	        )
2708 	
2709 	    def test_stop_instance(self):
2710 	        self.assert_message_from_report(
2711 	            "Unable to stop a_service@an_instance: a_reason",
2712 	            reports.ServiceActionFailed(
2713 	                const.SERVICE_ACTION_STOP,
2714 	                "a_service",
2715 	                "a_reason",
2716 	                instance="an_instance",
2717 	            ),
2718 	        )
2719 	
2720 	    def test_enable(self):
2721 	        self.assert_message_from_report(
2722 	            "Unable to enable a_service: a_reason",
2723 	            reports.ServiceActionFailed(
2724 	                const.SERVICE_ACTION_ENABLE, "a_service", "a_reason"
2725 	            ),
2726 	        )
2727 	
2728 	    def test_enable_instance(self):
2729 	        self.assert_message_from_report(
2730 	            "Unable to enable a_service@an_instance: a_reason",
2731 	            reports.ServiceActionFailed(
2732 	                const.SERVICE_ACTION_ENABLE,
2733 	                "a_service",
2734 	                "a_reason",
2735 	                instance="an_instance",
2736 	            ),
2737 	        )
2738 	
2739 	    def test_disable(self):
2740 	        self.assert_message_from_report(
2741 	            "Unable to disable a_service: a_reason",
2742 	            reports.ServiceActionFailed(
2743 	                const.SERVICE_ACTION_DISABLE, "a_service", "a_reason"
2744 	            ),
2745 	        )
2746 	
2747 	    def test_disable_instance(self):
2748 	        self.assert_message_from_report(
2749 	            "Unable to disable a_service@an_instance: a_reason",
2750 	            reports.ServiceActionFailed(
2751 	                const.SERVICE_ACTION_DISABLE,
2752 	                "a_service",
2753 	                "a_reason",
2754 	                instance="an_instance",
2755 	            ),
2756 	        )
2757 	
2758 	    def test_kill(self):
2759 	        self.assert_message_from_report(
2760 	            "Unable to kill a_service: a_reason",
2761 	            reports.ServiceActionFailed(
2762 	                const.SERVICE_ACTION_KILL, "a_service", "a_reason"
2763 	            ),
2764 	        )
2765 	
2766 	    def test_kill_instance(self):
2767 	        self.assert_message_from_report(
2768 	            "Unable to kill a_service@an_instance: a_reason",
2769 	            reports.ServiceActionFailed(
2770 	                const.SERVICE_ACTION_KILL,
2771 	                "a_service",
2772 	                "a_reason",
2773 	                instance="an_instance",
2774 	            ),
2775 	        )
2776 	
2777 	
2778 	# TODO: add tests for node if needed
2779 	class ServiceActionSucceeded(NameBuildTest):
2780 	    def test_start(self):
2781 	        self.assert_message_from_report(
2782 	            "a_service started",
2783 	            reports.ServiceActionSucceeded(
2784 	                const.SERVICE_ACTION_START, "a_service"
2785 	            ),
2786 	        )
2787 	
2788 	    def test_start_instance(self):
2789 	        self.assert_message_from_report(
2790 	            "a_service@an_instance started",
2791 	            reports.ServiceActionSucceeded(
2792 	                const.SERVICE_ACTION_START, "a_service", instance="an_instance"
2793 	            ),
2794 	        )
2795 	
2796 	    def test_stop(self):
2797 	        self.assert_message_from_report(
2798 	            "a_service stopped",
2799 	            reports.ServiceActionSucceeded(
2800 	                const.SERVICE_ACTION_STOP, "a_service"
2801 	            ),
2802 	        )
2803 	
2804 	    def test_stop_instance(self):
2805 	        self.assert_message_from_report(
2806 	            "a_service@an_instance stopped",
2807 	            reports.ServiceActionSucceeded(
2808 	                const.SERVICE_ACTION_STOP, "a_service", instance="an_instance"
2809 	            ),
2810 	        )
2811 	
2812 	    def test_enable(self):
2813 	        self.assert_message_from_report(
2814 	            "a_service enabled",
2815 	            reports.ServiceActionSucceeded(
2816 	                const.SERVICE_ACTION_ENABLE, "a_service"
2817 	            ),
2818 	        )
2819 	
2820 	    def test_enable_instance(self):
2821 	        self.assert_message_from_report(
2822 	            "a_service@an_instance enabled",
2823 	            reports.ServiceActionSucceeded(
2824 	                const.SERVICE_ACTION_ENABLE, "a_service", instance="an_instance"
2825 	            ),
2826 	        )
2827 	
2828 	    def test_disable(self):
2829 	        self.assert_message_from_report(
2830 	            "a_service disabled",
2831 	            reports.ServiceActionSucceeded(
2832 	                const.SERVICE_ACTION_DISABLE, "a_service"
2833 	            ),
2834 	        )
2835 	
2836 	    def test_disable_instance(self):
2837 	        self.assert_message_from_report(
2838 	            "a_service@an_instance disabled",
2839 	            reports.ServiceActionSucceeded(
2840 	                const.SERVICE_ACTION_DISABLE,
2841 	                "a_service",
2842 	                instance="an_instance",
2843 	            ),
2844 	        )
2845 	
2846 	    def test_kill(self):
2847 	        self.assert_message_from_report(
2848 	            "a_service killed",
2849 	            reports.ServiceActionSucceeded(
2850 	                const.SERVICE_ACTION_KILL, "a_service"
2851 	            ),
2852 	        )
2853 	
2854 	    def test_kill_instance(self):
2855 	        self.assert_message_from_report(
2856 	            "a_service@an_instance killed",
2857 	            reports.ServiceActionSucceeded(
2858 	                const.SERVICE_ACTION_KILL, "a_service", instance="an_instance"
2859 	            ),
2860 	        )
2861 	
2862 	
2863 	class ServiceActionSkipped(NameBuildTest):
2864 	    def test_start(self):
2865 	        self.assert_message_from_report(
2866 	            "not starting a_service: a_reason",
2867 	            reports.ServiceActionSkipped(
2868 	                const.SERVICE_ACTION_START, "a_service", "a_reason"
2869 	            ),
2870 	        )
2871 	
2872 	    def test_start_instance(self):
2873 	        self.assert_message_from_report(
2874 	            "not starting a_service@an_instance: a_reason",
2875 	            reports.ServiceActionSkipped(
2876 	                const.SERVICE_ACTION_START,
2877 	                "a_service",
2878 	                "a_reason",
2879 	                instance="an_instance",
2880 	            ),
2881 	        )
2882 	
2883 	    def test_stop(self):
2884 	        self.assert_message_from_report(
2885 	            "not stopping a_service: a_reason",
2886 	            reports.ServiceActionSkipped(
2887 	                const.SERVICE_ACTION_STOP, "a_service", "a_reason"
2888 	            ),
2889 	        )
2890 	
2891 	    def test_stop_instance(self):
2892 	        self.assert_message_from_report(
2893 	            "not stopping a_service@an_instance: a_reason",
2894 	            reports.ServiceActionSkipped(
2895 	                const.SERVICE_ACTION_STOP,
2896 	                "a_service",
2897 	                "a_reason",
2898 	                instance="an_instance",
2899 	            ),
2900 	        )
2901 	
2902 	    def test_enable(self):
2903 	        self.assert_message_from_report(
2904 	            "not enabling a_service: a_reason",
2905 	            reports.ServiceActionSkipped(
2906 	                const.SERVICE_ACTION_ENABLE, "a_service", "a_reason"
2907 	            ),
2908 	        )
2909 	
2910 	    def test_enable_instance(self):
2911 	        self.assert_message_from_report(
2912 	            "not enabling a_service@an_instance: a_reason",
2913 	            reports.ServiceActionSkipped(
2914 	                const.SERVICE_ACTION_ENABLE,
2915 	                "a_service",
2916 	                "a_reason",
2917 	                instance="an_instance",
2918 	            ),
2919 	        )
2920 	
2921 	    def test_disable(self):
2922 	        self.assert_message_from_report(
2923 	            "not disabling a_service: a_reason",
2924 	            reports.ServiceActionSkipped(
2925 	                const.SERVICE_ACTION_DISABLE, "a_service", "a_reason"
2926 	            ),
2927 	        )
2928 	
2929 	    def test_disable_instance(self):
2930 	        self.assert_message_from_report(
2931 	            "not disabling a_service@an_instance: a_reason",
2932 	            reports.ServiceActionSkipped(
2933 	                const.SERVICE_ACTION_DISABLE,
2934 	                "a_service",
2935 	                "a_reason",
2936 	                instance="an_instance",
2937 	            ),
2938 	        )
2939 	
2940 	    def test_kill(self):
2941 	        self.assert_message_from_report(
2942 	            "not killing a_service: a_reason",
2943 	            reports.ServiceActionSkipped(
2944 	                const.SERVICE_ACTION_KILL, "a_service", "a_reason"
2945 	            ),
2946 	        )
2947 	
2948 	    def test_kill_instance(self):
2949 	        self.assert_message_from_report(
2950 	            "not killing a_service@an_instance: a_reason",
2951 	            reports.ServiceActionSkipped(
2952 	                const.SERVICE_ACTION_KILL,
2953 	                "a_service",
2954 	                "a_reason",
2955 	                instance="an_instance",
2956 	            ),
2957 	        )
2958 	
2959 	
2960 	class ServiceUnableToDetectInitSystem(NameBuildTest):
2961 	    def test_success(self):
2962 	        self.assert_message_from_report(
2963 	            (
2964 	                "Unable to detect init system. All actions related to system "
2965 	                "services will be skipped."
2966 	            ),
2967 	            reports.ServiceUnableToDetectInitSystem(),
2968 	        )
2969 	
2970 	
2971 	class UnableToGetAgentMetadata(NameBuildTest):
2972 	    def test_all(self):
2973 	        self.assert_message_from_report(
2974 	            (
2975 	                "Agent 'agent-name' is not installed or does not provide valid "
2976 	                "metadata: reason"
2977 	            ),
2978 	            reports.UnableToGetAgentMetadata("agent-name", "reason"),
2979 	        )
2980 	
2981 	
2982 	class InvalidResourceAgentName(NameBuildTest):
2983 	    def test_build_message_with_data(self):
2984 	        self.assert_message_from_report(
2985 	            "Invalid resource agent name ':name'. Use standard:provider:type "
2986 	            "when standard is 'ocf' or standard:type otherwise.",
2987 	            reports.InvalidResourceAgentName(":name"),
2988 	        )
2989 	
2990 	
2991 	class InvalidStonithAgentName(NameBuildTest):
2992 	    def test_build_message_with_data(self):
2993 	        self.assert_message_from_report(
2994 	            "Invalid stonith agent name 'fence:name'. Agent name cannot contain "
2995 	            "the ':' character, do not use the 'stonith:' prefix.",
2996 	            reports.InvalidStonithAgentName("fence:name"),
2997 	        )
2998 	
2999 	
3000 	class AgentNameGuessed(NameBuildTest):
3001 	    def test_build_message_with_data(self):
3002 	        self.assert_message_from_report(
3003 	            "Assumed agent name 'ocf:heartbeat:Delay' (deduced from 'Delay')",
3004 	            reports.AgentNameGuessed("Delay", "ocf:heartbeat:Delay"),
3005 	        )
3006 	
3007 	
3008 	class AgentNameGuessFoundMoreThanOne(NameBuildTest):
3009 	    def test_all(self):
3010 	        self.assert_message_from_report(
3011 	            (
3012 	                "Multiple agents match 'agent', please specify full name: "
3013 	                "'agent1', 'agent2' or 'agent3'"
3014 	            ),
3015 	            reports.AgentNameGuessFoundMoreThanOne(
3016 	                "agent", ["agent2", "agent1", "agent3"]
3017 	            ),
3018 	        )
3019 	
3020 	
3021 	class AgentNameGuessFoundNone(NameBuildTest):
3022 	    def test_all(self):
3023 	        self.assert_message_from_report(
3024 	            "Unable to find agent 'agent-name', try specifying its full name",
3025 	            reports.AgentNameGuessFoundNone("agent-name"),
3026 	        )
3027 	
3028 	
3029 	class AgentImplementsUnsupportedOcfVersion(NameBuildTest):
3030 	    def test_singular(self):
3031 	        self.assert_message_from_report(
3032 	            "Unable to process agent 'agent-name' as it implements unsupported "
3033 	            "OCF version 'ocf-2.3', supported version is: 'v1'",
3034 	            reports.AgentImplementsUnsupportedOcfVersion(
3035 	                "agent-name", "ocf-2.3", ["v1"]
3036 	            ),
3037 	        )
3038 	
3039 	    def test_plural(self):
3040 	        self.assert_message_from_report(
3041 	            "Unable to process agent 'agent-name' as it implements unsupported "
3042 	            "OCF version 'ocf-2.3', supported versions are: 'v1', 'v2', 'v3'",
3043 	            reports.AgentImplementsUnsupportedOcfVersion(
3044 	                "agent-name", "ocf-2.3", ["v1", "v2", "v3"]
3045 	            ),
3046 	        )
3047 	
3048 	
3049 	class AgentGenericError(NameBuildTest):
3050 	    def test_success(self):
3051 	        self.assert_message_from_report(
3052 	            "Unable to load agent 'agent-name'",
3053 	            reports.AgentGenericError("agent-name"),
3054 	        )
3055 	
3056 	
3057 	class OmittingNode(NameBuildTest):
3058 	    def test_all(self):
3059 	        self.assert_message_from_report(
3060 	            "Omitting node 'node1'", reports.OmittingNode("node1")
3061 	        )
3062 	
3063 	
3064 	class SbdCheckStarted(NameBuildTest):
3065 	    def test_all(self):
3066 	        self.assert_message_from_report(
3067 	            "Running SBD pre-enabling checks...", reports.SbdCheckStarted()
3068 	        )
3069 	
3070 	
3071 	class SbdCheckSuccess(NameBuildTest):
3072 	    def test_all(self):
3073 	        self.assert_message_from_report(
3074 	            "node1: SBD pre-enabling checks done",
3075 	            reports.SbdCheckSuccess("node1"),
3076 	        )
3077 	
3078 	
3079 	class SbdConfigDistributionStarted(NameBuildTest):
3080 	    def test_all(self):
3081 	        self.assert_message_from_report(
3082 	            "Distributing SBD config...", reports.SbdConfigDistributionStarted()
3083 	        )
3084 	
3085 	
3086 	class SbdConfigAcceptedByNode(NameBuildTest):
3087 	    def test_all(self):
3088 	        self.assert_message_from_report(
3089 	            "node1: SBD config saved", reports.SbdConfigAcceptedByNode("node1")
3090 	        )
3091 	
3092 	
3093 	class UnableToGetSbdConfig(NameBuildTest):
3094 	    def test_no_reason(self):
3095 	        self.assert_message_from_report(
3096 	            "Unable to get SBD configuration from node 'node1'",
3097 	            reports.UnableToGetSbdConfig("node1", ""),
3098 	        )
3099 	
3100 	    def test_all(self):
3101 	        self.assert_message_from_report(
3102 	            "Unable to get SBD configuration from node 'node2': reason",
3103 	            reports.UnableToGetSbdConfig("node2", "reason"),
3104 	        )
3105 	
3106 	
3107 	class SbdDeviceInitializationStarted(NameBuildTest):
3108 	    def test_more_devices(self):
3109 	        self.assert_message_from_report(
3110 	            "Initializing devices '/dev1', '/dev2', '/dev3'...",
3111 	            reports.SbdDeviceInitializationStarted(["/dev3", "/dev2", "/dev1"]),
3112 	        )
3113 	
3114 	    def test_one_device(self):
3115 	        self.assert_message_from_report(
3116 	            "Initializing device '/dev1'...",
3117 	            reports.SbdDeviceInitializationStarted(["/dev1"]),
3118 	        )
3119 	
3120 	
3121 	class SbdDeviceInitializationSuccess(NameBuildTest):
3122 	    def test_more_devices(self):
3123 	        self.assert_message_from_report(
3124 	            "Devices initialized successfully",
3125 	            reports.SbdDeviceInitializationSuccess(["/dev2", "/dev1"]),
3126 	        )
3127 	
3128 	    def test_one_device(self):
3129 	        self.assert_message_from_report(
3130 	            "Device initialized successfully",
3131 	            reports.SbdDeviceInitializationSuccess(["/dev1"]),
3132 	        )
3133 	
3134 	
3135 	class SbdDeviceInitializationError(NameBuildTest):
3136 	    def test_more_devices(self):
3137 	        self.assert_message_from_report(
3138 	            "Initialization of devices '/dev1', '/dev2' failed: this is reason",
3139 	            reports.SbdDeviceInitializationError(
3140 	                ["/dev2", "/dev1"], "this is reason"
3141 	            ),
3142 	        )
3143 	
3144 	    def test_one_device(self):
3145 	        self.assert_message_from_report(
3146 	            "Initialization of device '/dev2' failed: this is reason",
3147 	            reports.SbdDeviceInitializationError(["/dev2"], "this is reason"),
3148 	        )
3149 	
3150 	
3151 	class SbdDeviceListError(NameBuildTest):
3152 	    def test_build_message(self):
3153 	        self.assert_message_from_report(
3154 	            "Unable to get list of messages from device '/dev': this is reason",
3155 	            reports.SbdDeviceListError("/dev", "this is reason"),
3156 	        )
3157 	
3158 	
3159 	class SbdDeviceMessageError(NameBuildTest):
3160 	    def test_build_message(self):
3161 	        self.assert_message_from_report(
3162 	            (
3163 	                "Unable to set message 'test' for node 'node1' on device "
3164 	                "'/dev1': this is reason"
3165 	            ),
3166 	            reports.SbdDeviceMessageError(
3167 	                "/dev1", "node1", "test", "this is reason"
3168 	            ),
3169 	        )
3170 	
3171 	
3172 	class SbdDeviceDumpError(NameBuildTest):
3173 	    def test_build_message(self):
3174 	        self.assert_message_from_report(
3175 	            "Unable to get SBD headers from device '/dev1': this is reason",
3176 	            reports.SbdDeviceDumpError("/dev1", "this is reason"),
3177 	        )
3178 	
3179 	
3180 	class FilesDistributionStarted(NameBuildTest):
3181 	    def test_build_messages(self):
3182 	        self.assert_message_from_report(
3183 	            "Sending 'first', 'second'",
3184 	            reports.FilesDistributionStarted(["first", "second"]),
3185 	        )
3186 	
3187 	    def test_build_messages_with_single_node(self):
3188 	        self.assert_message_from_report(
3189 	            "Sending 'first' to 'node1'",
3190 	            reports.FilesDistributionStarted(["first"], ["node1"]),
3191 	        )
3192 	
3193 	    def test_build_messages_with_nodes(self):
3194 	        self.assert_message_from_report(
3195 	            "Sending 'first', 'second' to 'node1', 'node2'",
3196 	            reports.FilesDistributionStarted(
3197 	                ["first", "second"], ["node1", "node2"]
3198 	            ),
3199 	        )
3200 	
3201 	
3202 	class FilesDistributionSkipped(NameBuildTest):
3203 	    def test_not_live(self):
3204 	        self.assert_message_from_report(
3205 	            "Distribution of 'file1' to 'nodeA', 'nodeB' was skipped because "
3206 	            "the command does not run on a live cluster. "
3207 	            "Please, distribute the file(s) manually.",
3208 	            reports.FilesDistributionSkipped(
3209 	                const.REASON_NOT_LIVE_CIB, ["file1"], ["nodeA", "nodeB"]
3210 	            ),
3211 	        )
3212 	
3213 	    def test_unreachable(self):
3214 	        self.assert_message_from_report(
3215 	            "Distribution of 'file1', 'file2' to 'nodeA' was skipped because "
3216 	            "pcs is unable to connect to the node(s). Please, distribute "
3217 	            "the file(s) manually.",
3218 	            reports.FilesDistributionSkipped(
3219 	                const.REASON_UNREACHABLE, ["file1", "file2"], ["nodeA"]
3220 	            ),
3221 	        )
3222 	
3223 	    def test_unknown_reason(self):
3224 	        self.assert_message_from_report(
3225 	            "Distribution of 'file1', 'file2' to 'nodeA', 'nodeB' was skipped "
3226 	            "because some undefined reason. Please, distribute the file(s) "
3227 	            "manually.",
3228 	            reports.FilesDistributionSkipped(
3229 	                "some undefined reason", ["file1", "file2"], ["nodeA", "nodeB"]
3230 	            ),
3231 	        )
3232 	
3233 	
3234 	class FileDistributionSuccess(NameBuildTest):
3235 	    def test_build_messages(self):
3236 	        self.assert_message_from_report(
3237 	            "node1: successful distribution of the file 'some authfile'",
3238 	            reports.FileDistributionSuccess("node1", "some authfile"),
3239 	        )
3240 	
3241 	
3242 	class FileDistributionError(NameBuildTest):
3243 	    def test_build_messages(self):
3244 	        self.assert_message_from_report(
3245 	            "node1: unable to distribute file 'file1': permission denied",
3246 	            reports.FileDistributionError(
3247 	                "node1", "file1", "permission denied"
3248 	            ),
3249 	        )
3250 	
3251 	
3252 	class FilesRemoveFromNodesStarted(NameBuildTest):
3253 	    def test_minimal(self):
3254 	        self.assert_message_from_report(
3255 	            "Requesting remove 'file'",
3256 	            reports.FilesRemoveFromNodesStarted(["file"]),
3257 	        )
3258 	
3259 	    def test_with_single_node(self):
3260 	        self.assert_message_from_report(
3261 	            "Requesting remove 'first' from 'node1'",
3262 	            reports.FilesRemoveFromNodesStarted(["first"], ["node1"]),
3263 	        )
3264 	
3265 	    def test_with_multiple_nodes(self):
3266 	        self.assert_message_from_report(
3267 	            "Requesting remove 'first', 'second' from 'node1', 'node2'",
3268 	            reports.FilesRemoveFromNodesStarted(
3269 	                ["first", "second"],
3270 	                ["node1", "node2"],
3271 	            ),
3272 	        )
3273 	
3274 	
3275 	class FilesRemoveFromNodesSkipped(NameBuildTest):
3276 	    def test_not_live(self):
3277 	        self.assert_message_from_report(
3278 	            "Removing 'file1' from 'nodeA', 'nodeB' was skipped because the "
3279 	            "command does not run on a live cluster. "
3280 	            "Please, remove the file(s) manually.",
3281 	            reports.FilesRemoveFromNodesSkipped(
3282 	                const.REASON_NOT_LIVE_CIB, ["file1"], ["nodeA", "nodeB"]
3283 	            ),
3284 	        )
3285 	
3286 	    def test_unreachable(self):
3287 	        self.assert_message_from_report(
3288 	            "Removing 'file1', 'file2' from 'nodeA' was skipped because pcs is "
3289 	            "unable to connect to the node(s). Please, remove the file(s) "
3290 	            "manually.",
3291 	            reports.FilesRemoveFromNodesSkipped(
3292 	                const.REASON_UNREACHABLE, ["file1", "file2"], ["nodeA"]
3293 	            ),
3294 	        )
3295 	
3296 	    def test_unknown_reason(self):
3297 	        self.assert_message_from_report(
3298 	            "Removing 'file1', 'file2' from 'nodeA', 'nodeB' was skipped "
3299 	            "because some undefined reason. Please, remove the file(s) "
3300 	            "manually.",
3301 	            reports.FilesRemoveFromNodesSkipped(
3302 	                "some undefined reason", ["file1", "file2"], ["nodeA", "nodeB"]
3303 	            ),
3304 	        )
3305 	
3306 	
3307 	class FileRemoveFromNodeSuccess(NameBuildTest):
3308 	    def test_build_messages(self):
3309 	        self.assert_message_from_report(
3310 	            "node1: successful removal of the file 'some authfile'",
3311 	            reports.FileRemoveFromNodeSuccess("node1", "some authfile"),
3312 	        )
3313 	
3314 	
3315 	class FileRemoveFromNodeError(NameBuildTest):
3316 	    def test_build_messages(self):
3317 	        self.assert_message_from_report(
3318 	            "node1: unable to remove file 'file1': permission denied",
3319 	            reports.FileRemoveFromNodeError(
3320 	                "node1", "file1", "permission denied"
3321 	            ),
3322 	        )
3323 	
3324 	
3325 	class ServiceCommandsOnNodesStarted(NameBuildTest):
3326 	    def test_build_messages(self):
3327 	        self.assert_message_from_report(
3328 	            "Requesting 'action1', 'action2'",
3329 	            reports.ServiceCommandsOnNodesStarted(["action1", "action2"]),
3330 	        )
3331 	
3332 	    def test_build_messages_with_single_node(self):
3333 	        self.assert_message_from_report(
3334 	            "Requesting 'action1' on 'node1'",
3335 	            reports.ServiceCommandsOnNodesStarted(
3336 	                ["action1"],
3337 	                ["node1"],
3338 	            ),
3339 	        )
3340 	
3341 	    def test_build_messages_with_nodes(self):
3342 	        self.assert_message_from_report(
3343 	            "Requesting 'action1', 'action2' on 'node1', 'node2'",
3344 	            reports.ServiceCommandsOnNodesStarted(
3345 	                ["action1", "action2"],
3346 	                ["node1", "node2"],
3347 	            ),
3348 	        )
3349 	
3350 	
3351 	class ServiceCommandsOnNodesSkipped(NameBuildTest):
3352 	    def test_not_live(self):
3353 	        self.assert_message_from_report(
3354 	            "Running action(s) 'pacemaker_remote enable', 'pacemaker_remote "
3355 	            "start' on 'nodeA', 'nodeB' was skipped because the command "
3356 	            "does not run on a live cluster. Please, "
3357 	            "run the action(s) manually.",
3358 	            reports.ServiceCommandsOnNodesSkipped(
3359 	                const.REASON_NOT_LIVE_CIB,
3360 	                ["pacemaker_remote enable", "pacemaker_remote start"],
3361 	                ["nodeA", "nodeB"],
3362 	            ),
3363 	        )
3364 	
3365 	    def test_unreachable(self):
3366 	        self.assert_message_from_report(
3367 	            "Running action(s) 'pacemaker_remote enable', 'pacemaker_remote "
3368 	            "start' on 'nodeA', 'nodeB' was skipped because pcs is unable "
3369 	            "to connect to the node(s). Please, run the action(s) manually.",
3370 	            reports.ServiceCommandsOnNodesSkipped(
3371 	                const.REASON_UNREACHABLE,
3372 	                ["pacemaker_remote enable", "pacemaker_remote start"],
3373 	                ["nodeA", "nodeB"],
3374 	            ),
3375 	        )
3376 	
3377 	    def test_unknown_reason(self):
3378 	        self.assert_message_from_report(
3379 	            "Running action(s) 'pacemaker_remote enable', 'pacemaker_remote "
3380 	            "start' on 'nodeA', 'nodeB' was skipped because some undefined "
3381 	            "reason. Please, run the action(s) manually.",
3382 	            reports.ServiceCommandsOnNodesSkipped(
3383 	                "some undefined reason",
3384 	                ["pacemaker_remote enable", "pacemaker_remote start"],
3385 	                ["nodeA", "nodeB"],
3386 	            ),
3387 	        )
3388 	
3389 	
3390 	class ServiceCommandOnNodeSuccess(NameBuildTest):
3391 	    def test_build_messages(self):
3392 	        self.assert_message_from_report(
3393 	            "node1: successful run of 'service enable'",
3394 	            reports.ServiceCommandOnNodeSuccess("node1", "service enable"),
3395 	        )
3396 	
3397 	
3398 	class ServiceCommandOnNodeError(NameBuildTest):
3399 	    def test_build_messages(self):
3400 	        self.assert_message_from_report(
3401 	            "node1: service command failed: service1 start: permission denied",
3402 	            reports.ServiceCommandOnNodeError(
3403 	                "node1", "service1 start", "permission denied"
3404 	            ),
3405 	        )
3406 	
3407 	
3408 	class InvalidResponseFormat(NameBuildTest):
3409 	    def test_all(self):
3410 	        self.assert_message_from_report(
3411 	            "node1: Invalid format of response",
3412 	            reports.InvalidResponseFormat("node1"),
3413 	        )
3414 	
3415 	
3416 	class SbdNotUsedCannotSetSbdOptions(NameBuildTest):
3417 	    def test_single_option(self):
3418 	        self.assert_message_from_report(
3419 	            "Cluster is not configured to use SBD, cannot specify SBD option(s)"
3420 	            " 'device' for node 'node1'",
3421 	            reports.SbdNotUsedCannotSetSbdOptions(["device"], "node1"),
3422 	        )
3423 	
3424 	    def test_multiple_options(self):
3425 	        self.assert_message_from_report(
3426 	            "Cluster is not configured to use SBD, cannot specify SBD option(s)"
3427 	            " 'device', 'watchdog' for node 'node1'",
3428 	            reports.SbdNotUsedCannotSetSbdOptions(
3429 	                ["device", "watchdog"], "node1"
3430 	            ),
3431 	        )
3432 	
3433 	
3434 	class SbdWithDevicesNotUsedCannotSetDevice(NameBuildTest):
3435 	    def test_success(self):
3436 	        self.assert_message_from_report(
3437 	            "Cluster is not configured to use SBD with shared storage, cannot "
3438 	            "specify SBD devices for node 'node1'",
3439 	            reports.SbdWithDevicesNotUsedCannotSetDevice("node1"),
3440 	        )
3441 	
3442 	
3443 	class SbdNoDeviceForNode(NameBuildTest):
3444 	    def test_not_enabled(self):
3445 	        self.assert_message_from_report(
3446 	            "No SBD device specified for node 'node1'",
3447 	            reports.SbdNoDeviceForNode("node1"),
3448 	        )
3449 	
3450 	    def test_enabled(self):
3451 	        self.assert_message_from_report(
3452 	            "Cluster uses SBD with shared storage so SBD devices must be "
3453 	            "specified for all nodes, no device specified for node 'node1'",
3454 	            reports.SbdNoDeviceForNode("node1", sbd_enabled_in_cluster=True),
3455 	        )
3456 	
3457 	
3458 	class SbdTooManyDevicesForNode(NameBuildTest):
3459 	    def test_build_messages(self):
3460 	        self.assert_message_from_report(
3461 	            "At most 3 SBD devices can be specified for a node, '/dev1', "
3462 	            "'/dev2', '/dev3' specified for node 'node1'",
3463 	            reports.SbdTooManyDevicesForNode(
3464 	                "node1", ["/dev1", "/dev3", "/dev2"], 3
3465 	            ),
3466 	        )
3467 	
3468 	
3469 	class SbdDevicePathNotAbsolute(NameBuildTest):
3470 	    def test_build_message(self):
3471 	        self.assert_message_from_report(
3472 	            "Device path '/dev' on node 'node1' is not absolute",
3473 	            reports.SbdDevicePathNotAbsolute("/dev", "node1"),
3474 	        )
3475 	
3476 	
3477 	class SbdDeviceDoesNotExist(NameBuildTest):
3478 	    def test_build_message(self):
3479 	        self.assert_message_from_report(
3480 	            "node1: device '/dev' not found",
3481 	            reports.SbdDeviceDoesNotExist("/dev", "node1"),
3482 	        )
3483 	
3484 	
3485 	class SbdDeviceIsNotBlockDevice(NameBuildTest):
3486 	    def test_build_message(self):
3487 	        self.assert_message_from_report(
3488 	            "node1: device '/dev' is not a block device",
3489 	            reports.SbdDeviceIsNotBlockDevice("/dev", "node1"),
3490 	        )
3491 	
3492 	
3493 	class StonithWatchdogTimeoutCannotBeSet(NameBuildTest):
3494 	    def test_sbd_not_enabled(self):
3495 	        self.assert_message_from_report(
3496 	            "fencing-watchdog-timeout / stonith-watchdog-timeout can only be "
3497 	            "unset or set to 0 while SBD is disabled",
3498 	            reports.StonithWatchdogTimeoutCannotBeSet(
3499 	                reports.const.SBD_NOT_SET_UP
3500 	            ),
3501 	        )
3502 	
3503 	    def test_sbd_with_devices(self):
3504 	        self.assert_message_from_report(
3505 	            "fencing-watchdog-timeout / stonith-watchdog-timeout can only be "
3506 	            "unset or set to 0 while SBD is enabled with devices",
3507 	            reports.StonithWatchdogTimeoutCannotBeSet(
3508 	                reports.const.SBD_SET_UP_WITH_DEVICES
3509 	            ),
3510 	        )
3511 	
3512 	
3513 	class StonithWatchdogTimeoutCannotBeUnset(NameBuildTest):
3514 	    def test_sbd_without_devices(self):
3515 	        self.assert_message_from_report(
3516 	            "fencing-watchdog-timeout / stonith-watchdog-timeout cannot be "
3517 	            "unset or set to 0 while SBD is enabled without devices",
3518 	            reports.StonithWatchdogTimeoutCannotBeUnset(
3519 	                reports.const.SBD_SET_UP_WITHOUT_DEVICES
3520 	            ),
3521 	        )
3522 	
3523 	
3524 	class StonithWatchdogTimeoutTooSmall(NameBuildTest):
3525 	    def test_all(self):
3526 	        self.assert_message_from_report(
3527 	            "The fencing-watchdog-timeout / stonith-watchdog-timeout must be "
3528 	            "greater than SBD watchdog timeout '5', entered '4'",
3529 	            reports.StonithWatchdogTimeoutTooSmall(5, "4"),
3530 	        )
3531 	
3532 	
3533 	class WatchdogNotFound(NameBuildTest):
3534 	    def test_all(self):
3535 	        self.assert_message_from_report(
3536 	            "Watchdog 'watchdog-name' does not exist on node 'node1'",
3537 	            reports.WatchdogNotFound("node1", "watchdog-name"),
3538 	        )
3539 	
3540 	
3541 	class WatchdogInvalid(NameBuildTest):
3542 	    def test_all(self):
3543 	        self.assert_message_from_report(
3544 	            "Watchdog path '/dev/wdog' is invalid.",
3545 	            reports.WatchdogInvalid("/dev/wdog"),
3546 	        )
3547 	
3548 	
3549 	class UnableToGetSbdStatus(NameBuildTest):
3550 	    def test_no_reason(self):
3551 	        self.assert_message_from_report(
3552 	            "Unable to get status of SBD from node 'node1'",
3553 	            reports.UnableToGetSbdStatus("node1", ""),
3554 	        )
3555 	
3556 	    def test_all(self):
3557 	        self.assert_message_from_report(
3558 	            "Unable to get status of SBD from node 'node2': reason",
3559 	            reports.UnableToGetSbdStatus("node2", "reason"),
3560 	        )
3561 	
3562 	
3563 	class ClusterRestartRequiredToApplyChanges(NameBuildTest):
3564 	    def test_all(self):
3565 	        self.assert_message_from_report(
3566 	            "Cluster restart is required in order to apply these changes.",
3567 	            reports.ClusterRestartRequiredToApplyChanges(),
3568 	        )
3569 	
3570 	
3571 	class CibAlertRecipientAlreadyExists(NameBuildTest):
3572 	    def test_all(self):
3573 	        self.assert_message_from_report(
3574 	            "Recipient 'recipient' in alert 'alert-id' already exists",
3575 	            reports.CibAlertRecipientAlreadyExists("alert-id", "recipient"),
3576 	        )
3577 	
3578 	
3579 	class CibAlertRecipientValueInvalid(NameBuildTest):
3580 	    def test_all(self):
3581 	        self.assert_message_from_report(
3582 	            "Recipient value 'recipient' is not valid.",
3583 	            reports.CibAlertRecipientValueInvalid("recipient"),
3584 	        )
3585 	
3586 	
3587 	class CibUpgradeSuccessful(NameBuildTest):
3588 	    def test_all(self):
3589 	        self.assert_message_from_report(
3590 	            "CIB has been upgraded to the latest schema version.",
3591 	            reports.CibUpgradeSuccessful(),
3592 	        )
3593 	
3594 	
3595 	class CibUpgradeFailed(NameBuildTest):
3596 	    def test_all(self):
3597 	        self.assert_message_from_report(
3598 	            "Upgrading of CIB to the latest schema failed: reason",
3599 	            reports.CibUpgradeFailed("reason"),
3600 	        )
3601 	
3602 	
3603 	class CibUpgradeFailedToMinimalRequiredVersion(NameBuildTest):
3604 	    def test_all(self):
3605 	        self.assert_message_from_report(
3606 	            (
3607 	                "Unable to upgrade CIB to required schema version"
3608 	                " 1.1 or higher. Current version is"
3609 	                " 0.8. Newer version of pacemaker is needed."
3610 	            ),
3611 	            reports.CibUpgradeFailedToMinimalRequiredVersion("0.8", "1.1"),
3612 	        )
3613 	
3614 	
3615 	class FileAlreadyExists(NameBuildTest):
3616 	    def test_minimal(self):
3617 	        self.assert_message_from_report(
3618 	            "Corosync authkey file '/corosync_conf/path' already exists",
3619 	            reports.FileAlreadyExists(
3620 	                "COROSYNC_AUTHKEY", "/corosync_conf/path"
3621 	            ),
3622 	        )
3623 	
3624 	    def test_with_node(self):
3625 	        self.assert_message_from_report(
3626 	            "node1: pcs configuration file '/pcs/conf/file' already exists",
3627 	            reports.FileAlreadyExists(
3628 	                "PCS_SETTINGS_CONF", "/pcs/conf/file", node="node1"
3629 	            ),
3630 	        )
3631 	
3632 	
3633 	class FileIoError(NameBuildTest):
3634 	    def test_minimal(self):
3635 	        self.assert_message_from_report(
3636 	            "Unable to read Booth configuration: ",
3637 	            reports.FileIoError(
3638 	                file_type_codes.BOOTH_CONFIG, RawFileError.ACTION_READ, ""
3639 	            ),
3640 	        )
3641 	
3642 	    def test_all(self):
3643 	        self.assert_message_from_report(
3644 	            "Unable to read pcsd SSL certificate '/ssl/cert/path': Failed",
3645 	            reports.FileIoError(
3646 	                file_type_codes.PCSD_SSL_CERT,
3647 	                RawFileError.ACTION_READ,
3648 	                "Failed",
3649 	                file_path="/ssl/cert/path",
3650 	            ),
3651 	        )
3652 	
3653 	    def test_role_translation_a(self):
3654 	        self.assert_message_from_report(
3655 	            "Unable to write pcsd SSL key '/ssl/key/path': Failed",
3656 	            reports.FileIoError(
3657 	                file_type_codes.PCSD_SSL_KEY,
3658 	                RawFileError.ACTION_WRITE,
3659 	                "Failed",
3660 	                file_path="/ssl/key/path",
3661 	            ),
3662 	        )
3663 	
3664 	    def test_role_translation_b(self):
3665 	        self.assert_message_from_report(
3666 	            (
3667 	                "Unable to change ownership of pcsd configuration "
3668 	                "'/pcsd/conf/path': Failed"
3669 	            ),
3670 	            reports.FileIoError(
3671 	                file_type_codes.PCSD_ENVIRONMENT_CONFIG,
3672 	                RawFileError.ACTION_CHOWN,
3673 	                "Failed",
3674 	                file_path="/pcsd/conf/path",
3675 	            ),
3676 	        )
3677 	
3678 	    def test_role_translation_c(self):
3679 	        self.assert_message_from_report(
3680 	            "Unable to change permissions of Corosync authkey: Failed",
3681 	            reports.FileIoError(
3682 	                file_type_codes.COROSYNC_AUTHKEY,
3683 	                RawFileError.ACTION_CHMOD,
3684 	                "Failed",
3685 	            ),
3686 	        )
3687 	
3688 	    def test_role_translation_d(self):
3689 	        self.assert_message_from_report(
3690 	            (
3691 	                "Unable to change ownership of pcs configuration: "
3692 	                "Permission denied"
3693 	            ),
3694 	            reports.FileIoError(
3695 	                file_type_codes.PCS_SETTINGS_CONF,
3696 	                RawFileError.ACTION_CHOWN,
3697 	                "Permission denied",
3698 	            ),
3699 	        )
3700 	
3701 	
3702 	class FileDoesNotExistUsingDefault(NameBuildTest):
3703 	    def test_success(self):
3704 	        self.assert_message_from_report(
3705 	            (
3706 	                "Corosync authkey file '/corosync_conf/path' does not exist, "
3707 	                "using default configuration"
3708 	            ),
3709 	            reports.FileDoesNotExistUsingDefault(
3710 	                "COROSYNC_AUTHKEY", "/corosync_conf/path"
3711 	            ),
3712 	        )
3713 	
3714 	
3715 	class InitSystemDoesNotSupportServiceInstances(NameBuildTest):
3716 	    def test_all(self):
3717 	        self.assert_message_from_report(
3718 	            "service instances are not supported on your system",
3719 	            reports.InitSystemDoesNotSupportServiceInstances(),
3720 	        )
3721 	
3722 	
3723 	class LiveEnvironmentRequired(NameBuildTest):
3724 	    def test_build_messages_transformable_codes(self):
3725 	        self.assert_message_from_report(
3726 	            "This command does not support passing '{}', '{}'".format(
3727 	                str(file_type_codes.CIB),
3728 	                str(file_type_codes.COROSYNC_CONF),
3729 	            ),
3730 	            reports.LiveEnvironmentRequired(
3731 	                [file_type_codes.COROSYNC_CONF, file_type_codes.CIB]
3732 	            ),
3733 	        )
3734 	
3735 	
3736 	class LiveEnvironmentRequiredForLocalNode(NameBuildTest):
3737 	    def test_all(self):
3738 	        self.assert_message_from_report(
3739 	            "Node(s) must be specified if mocked CIB is used",
3740 	            reports.LiveEnvironmentRequiredForLocalNode(),
3741 	        )
3742 	
3743 	
3744 	class LiveEnvironmentNotConsistent(NameBuildTest):
3745 	    def test_one_one(self):
3746 	        self.assert_message_from_report(
3747 	            "When '{}' is specified, '{}' must be specified as well".format(
3748 	                str(file_type_codes.BOOTH_CONFIG),
3749 	                str(file_type_codes.BOOTH_KEY),
3750 	            ),
3751 	            reports.LiveEnvironmentNotConsistent(
3752 	                [file_type_codes.BOOTH_CONFIG],
3753 	                [file_type_codes.BOOTH_KEY],
3754 	            ),
3755 	        )
3756 	
3757 	    def test_many_many(self):
3758 	        self.assert_message_from_report(
3759 	            (
3760 	                "When '{}', '{}' are specified, '{}', '{}' must be specified "
3761 	                "as well"
3762 	            ).format(
3763 	                str(file_type_codes.BOOTH_CONFIG),
3764 	                str(file_type_codes.CIB),
3765 	                str(file_type_codes.BOOTH_KEY),
3766 	                str(file_type_codes.COROSYNC_CONF),
3767 	            ),
3768 	            reports.LiveEnvironmentNotConsistent(
3769 	                [file_type_codes.CIB, file_type_codes.BOOTH_CONFIG],
3770 	                [file_type_codes.COROSYNC_CONF, file_type_codes.BOOTH_KEY],
3771 	            ),
3772 	        )
3773 	
3774 	
3775 	class CorosyncNodeConflictCheckSkipped(NameBuildTest):
3776 	    def test_success(self):
3777 	        self.assert_message_from_report(
3778 	            "Unable to check if there is a conflict with nodes set in corosync "
3779 	            "because the command does not run on a live cluster",
3780 	            reports.CorosyncNodeConflictCheckSkipped(const.REASON_NOT_LIVE_CIB),
3781 	        )
3782 	
3783 	
3784 	class CorosyncQuorumAtbCannotBeDisabledDueToSbd(NameBuildTest):
3785 	    def test_success(self):
3786 	        self.assert_message_from_report(
3787 	            (
3788 	                "Unable to disable auto_tie_breaker, SBD fencing would have no "
3789 	                "effect"
3790 	            ),
3791 	            reports.CorosyncQuorumAtbCannotBeDisabledDueToSbd(),
3792 	        )
3793 	
3794 	
3795 	class CorosyncQuorumAtbWillBeEnabledDueToSbd(NameBuildTest):
3796 	    def test_success(self):
3797 	        self.assert_message_from_report(
3798 	            (
3799 	                "SBD fencing is enabled in the cluster. To keep it effective, "
3800 	                "auto_tie_breaker quorum option will be enabled."
3801 	            ),
3802 	            reports.CorosyncQuorumAtbWillBeEnabledDueToSbd(),
3803 	        )
3804 	
3805 	
3806 	class CorosyncQuorumAtbWillBeEnabledDueToSbdClusterIsRunning(NameBuildTest):
3807 	    def test_success(self):
3808 	        self.assert_message_from_report(
3809 	            (
3810 	                "SBD fencing is enabled in the cluster. To keep it effective, "
3811 	                "auto_tie_breaker quorum option needs to be enabled. This can "
3812 	                "only be done when the cluster is stopped. To proceed, stop the "
3813 	                "cluster, enable auto_tie_breaker, and start the cluster. Then, "
3814 	                "repeat the requested action."
3815 	            ),
3816 	            reports.CorosyncQuorumAtbWillBeEnabledDueToSbdClusterIsRunning(),
3817 	        )
3818 	
3819 	
3820 	class CibAclRoleIsAlreadyAssignedToTarget(NameBuildTest):
3821 	    def test_all(self):
3822 	        self.assert_message_from_report(
3823 	            "Role 'role_id' is already assigned to 'target_id'",
3824 	            reports.CibAclRoleIsAlreadyAssignedToTarget("role_id", "target_id"),
3825 	        )
3826 	
3827 	
3828 	class CibAclRoleIsNotAssignedToTarget(NameBuildTest):
3829 	    def test_all(self):
3830 	        self.assert_message_from_report(
3831 	            "Role 'role_id' is not assigned to 'target_id'",
3832 	            reports.CibAclRoleIsNotAssignedToTarget("role_id", "target_id"),
3833 	        )
3834 	
3835 	
3836 	class CibAclTargetAlreadyExists(NameBuildTest):
3837 	    def test_all(self):
3838 	        self.assert_message_from_report(
3839 	            "'target_id' already exists",
3840 	            reports.CibAclTargetAlreadyExists("target_id"),
3841 	        )
3842 	
3843 	
3844 	class CibFencingLevelAlreadyExists(NameBuildTest):
3845 	    def test_target_node(self):
3846 	        self.assert_message_from_report(
3847 	            "Fencing level for 'nodeA' at level '1' with device(s) "
3848 	            "'device1', 'device2' already exists",
3849 	            reports.CibFencingLevelAlreadyExists(
3850 	                "1", TARGET_TYPE_NODE, "nodeA", ["device2", "device1"]
3851 	            ),
3852 	        )
3853 	
3854 	    def test_target_pattern(self):
3855 	        self.assert_message_from_report(
3856 	            "Fencing level for 'node-\\d+' at level '1' with device(s) "
3857 	            "'device1', 'device2' already exists",
3858 	            reports.CibFencingLevelAlreadyExists(
3859 	                "1", TARGET_TYPE_REGEXP, "node-\\d+", ["device1", "device2"]
3860 	            ),
3861 	        )
3862 	
3863 	    def test_target_attribute(self):
3864 	        self.assert_message_from_report(
3865 	            "Fencing level for 'name=value' at level '1' with device(s) "
3866 	            "'device2' already exists",
3867 	            reports.CibFencingLevelAlreadyExists(
3868 	                "1", TARGET_TYPE_ATTRIBUTE, ("name", "value"), ["device2"]
3869 	            ),
3870 	        )
3871 	
3872 	
3873 	class CibFencingLevelDoesNotExist(NameBuildTest):
3874 	    def test_full_info(self):
3875 	        self.assert_message_from_report(
3876 	            "Fencing level for 'nodeA' at level '1' with device(s) "
3877 	            "'device1', 'device2' does not exist",
3878 	            reports.CibFencingLevelDoesNotExist(
3879 	                "1", TARGET_TYPE_NODE, "nodeA", ["device2", "device1"]
3880 	            ),
3881 	        )
3882 	
3883 	    def test_only_level(self):
3884 	        self.assert_message_from_report(
3885 	            "Fencing level at level '1' does not exist",
3886 	            reports.CibFencingLevelDoesNotExist("1"),
3887 	        )
3888 	
3889 	    def test_only_target(self):
3890 	        self.assert_message_from_report(
3891 	            "Fencing level for 'name=value' does not exist",
3892 	            reports.CibFencingLevelDoesNotExist(
3893 	                target_type=TARGET_TYPE_ATTRIBUTE,
3894 	                target_value=("name", "value"),
3895 	            ),
3896 	        )
3897 	
3898 	    def test_only_devices(self):
3899 	        self.assert_message_from_report(
3900 	            "Fencing level with device(s) 'device1' does not exist",
3901 	            reports.CibFencingLevelDoesNotExist(devices=["device1"]),
3902 	        )
3903 	
3904 	    def test_no_info(self):
3905 	        self.assert_message_from_report(
3906 	            "Fencing level does not exist",
3907 	            reports.CibFencingLevelDoesNotExist(),
3908 	        )
3909 	
3910 	
3911 	class CibRemoveResources(NameBuildTest):
3912 	    def test_single_id(self):
3913 	        self.assert_message_from_report(
3914 	            "Removing resource: 'id1'", reports.CibRemoveResources(["id1"])
3915 	        )
3916 	
3917 	    def test_multiple_ids(self):
3918 	        self.assert_message_from_report(
3919 	            "Removing resources: 'id1', 'id2', 'id3'",
3920 	            reports.CibRemoveResources(["id1", "id2", "id3"]),
3921 	        )
3922 	
3923 	
3924 	class CibRemoveDependantElements(NameBuildTest):
3925 	    def test_single_element_type_with_single_id(self):
3926 	        self.assert_message_from_report(
3927 	            "Removing dependant element:\n  Location constraint: 'id1'",
3928 	            reports.CibRemoveDependantElements({"id1": "rsc_location"}),
3929 	        )
3930 	
3931 	    def test_single_element_type_with_multiple_ids(self):
3932 	        self.assert_message_from_report(
3933 	            (
3934 	                "Removing dependant elements:\n"
3935 	                "  Location constraints: 'id1', 'id2'"
3936 	            ),
3937 	            reports.CibRemoveDependantElements(
3938 	                {"id1": "rsc_location", "id2": "rsc_location"}
3939 	            ),
3940 	        )
3941 	
3942 	    def test_multiple_element_types_with_single_id(self):
3943 	        self.assert_message_from_report(
3944 	            (
3945 	                "Removing dependant elements:\n"
3946 	                "  Clone: 'id2'\n"
3947 	                "  Location constraint: 'id1'"
3948 	            ),
3949 	            reports.CibRemoveDependantElements(
3950 	                {"id1": "rsc_location", "id2": "clone"}
3951 	            ),
3952 	        )
3953 	
3954 	    def test_multiple_element_types_with_multiple_ids(self):
3955 	        self.assert_message_from_report(
3956 	            (
3957 	                "Removing dependant elements:\n"
3958 	                "  Another_elements: 'id5', 'id6'\n"
3959 	                "  Clones: 'id3', 'id4'\n"
3960 	                "  Location constraints: 'id1', 'id2'"
3961 	            ),
3962 	            reports.CibRemoveDependantElements(
3963 	                {
3964 	                    "id1": "rsc_location",
3965 	                    "id2": "rsc_location",
3966 	                    "id3": "clone",
3967 	                    "id4": "clone",
3968 	                    "id5": "another_element",
3969 	                    "id6": "another_element",
3970 	                }
3971 	            ),
3972 	        )
3973 	
3974 	
3975 	class CibRemoveReferences(NameBuildTest):
3976 	    def test_one_element_single_reference(self):
3977 	        self.assert_message_from_report(
3978 	            ("Removing references:\n  Resource 'id1' from:\n    Tag: 'id2'"),
3979 	            reports.CibRemoveReferences(
3980 	                {"id1": "primitive", "id2": "tag"}, {"id1": ["id2"]}
3981 	            ),
3982 	        )
3983 	
3984 	    def test_missing_tag_mapping(self):
3985 	        self.assert_message_from_report(
3986 	            ("Removing references:\n  Element 'id1' from:\n    Element: 'id2'"),
3987 	            reports.CibRemoveReferences({}, {"id1": ["id2"]}),
3988 	        )
3989 	
3990 	    def test_one_element_multiple_references_same_type(self):
3991 	        self.assert_message_from_report(
3992 	            (
3993 	                "Removing references:\n"
3994 	                "  Resource 'id1' from:\n"
3995 	                "    Tags: 'id2', 'id3'"
3996 	            ),
3997 	            reports.CibRemoveReferences(
3998 	                {"id1": "primitive", "id2": "tag", "id3": "tag"},
3999 	                {"id1": ["id2", "id3"]},
4000 	            ),
4001 	        )
4002 	
4003 	    def test_one_element_multiple_references_multiple_types(self):
4004 	        self.assert_message_from_report(
4005 	            (
4006 	                "Removing references:\n"
4007 	                "  Resource 'id1' from:\n"
4008 	                "    Group: 'id3'\n"
4009 	                "    Tag: 'id2'"
4010 	            ),
4011 	            reports.CibRemoveReferences(
4012 	                {"id1": "primitive", "id2": "tag", "id3": "group"},
4013 	                {"id1": ["id2", "id3"]},
4014 	            ),
4015 	        )
4016 	
4017 	    def test_multiple_elements_single_reference(self):
4018 	        self.assert_message_from_report(
4019 	            (
4020 	                "Removing references:\n"
4021 	                "  Resource 'id1' from:\n"
4022 	                "    Tag: 'id2'\n"
4023 	                "  Resource 'id3' from:\n"
4024 	                "    Tag: 'id4'"
4025 	            ),
4026 	            reports.CibRemoveReferences(
4027 	                {
4028 	                    "id1": "primitive",
4029 	                    "id2": "tag",
4030 	                    "id3": "primitive",
4031 	                    "id4": "tag",
4032 	                },
4033 	                {"id1": ["id2"], "id3": ["id4"]},
4034 	            ),
4035 	        )
4036 	
4037 	
4038 	class UseCommandNodeAddRemote(NameBuildTest):
4039 	    def test_build_messages(self):
4040 	        self.assert_message_from_report(
4041 	            "this command is not sufficient for creating a remote connection",
4042 	            reports.UseCommandNodeAddRemote(),
4043 	        )
4044 	
4045 	
4046 	class UseCommandNodeAddGuest(NameBuildTest):
4047 	    def test_build_messages(self):
4048 	        self.assert_message_from_report(
4049 	            "this command is not sufficient for creating a guest node",
4050 	            reports.UseCommandNodeAddGuest(),
4051 	        )
4052 	
4053 	
4054 	class UseCommandNodeRemoveRemote(NameBuildTest):
4055 	    def test_build_messages(self):
4056 	        self.assert_message_from_report(
4057 	            "this command is not sufficient for removing a remote node",
4058 	            reports.UseCommandNodeRemoveRemote(),
4059 	        )
4060 	
4061 	
4062 	class UseCommandNodeRemoveGuest(NameBuildTest):
4063 	    def test_build_messages(self):
4064 	        self.assert_message_from_report(
4065 	            "this command is not sufficient for removing a guest node",
4066 	            reports.UseCommandNodeRemoveGuest(),
4067 	        )
4068 	
4069 	
4070 	class UseCommandRemoveAndAddGuestNode(NameBuildTest):
4071 	    def test_message(self):
4072 	        self.assert_message_from_report(
4073 	            "Changing connection parameters of an existing guest node is not "
4074 	            "sufficient for connecting to a different guest node, remove the "
4075 	            "existing guest node and add a new one instead",
4076 	            reports.UseCommandRemoveAndAddGuestNode(),
4077 	        )
4078 	
4079 	
4080 	class GuestNodeNameAlreadyExists(NameBuildTest):
4081 	    def test_message(self):
4082 	        self.assert_message_from_report(
4083 	            "Cannot set name of the guest node to 'N' because that ID already "
4084 	            "exists in the cluster configuration.",
4085 	            reports.GuestNodeNameAlreadyExists("N"),
4086 	        )
4087 	
4088 	
4089 	class TmpFileWrite(NameBuildTest):
4090 	    def test_success(self):
4091 	        self.assert_message_from_report(
4092 	            (
4093 	                "Writing to a temporary file /tmp/pcs/test.tmp:\n"
4094 	                "--Debug Content Start--\n"
4095 	                "test file\ncontent\n\n"
4096 	                "--Debug Content End--\n"
4097 	            ),
4098 	            reports.TmpFileWrite("/tmp/pcs/test.tmp", "test file\ncontent\n"),
4099 	        )
4100 	
4101 	
4102 	class NodeAddressesUnresolvable(NameBuildTest):
4103 	    def test_one_address(self):
4104 	        self.assert_message_from_report(
4105 	            "Unable to resolve addresses: 'node1'",
4106 	            reports.NodeAddressesUnresolvable(["node1"]),
4107 	        )
4108 	
4109 	    def test_more_address(self):
4110 	        self.assert_message_from_report(
4111 	            "Unable to resolve addresses: 'node1', 'node2', 'node3'",
4112 	            reports.NodeAddressesUnresolvable(["node2", "node1", "node3"]),
4113 	        )
4114 	
4115 	
4116 	class UnableToPerformOperationOnAnyNode(NameBuildTest):
4117 	    def test_all(self):
4118 	        self.assert_message_from_report(
4119 	            (
4120 	                "Unable to perform operation on any available node/host, "
4121 	                "therefore it is not possible to continue"
4122 	            ),
4123 	            reports.UnableToPerformOperationOnAnyNode(),
4124 	        )
4125 	
4126 	
4127 	class HostNotFound(NameBuildTest):
4128 	    def test_single_host(self):
4129 	        self.assert_message_from_report(
4130 	            "Host 'unknown_host' is not known to pcs",
4131 	            reports.HostNotFound(["unknown_host"]),
4132 	        )
4133 	
4134 	    def test_multiple_hosts(self):
4135 	        self.assert_message_from_report(
4136 	            "Hosts 'another_one', 'unknown_host' are not known to pcs",
4137 	            reports.HostNotFound(["unknown_host", "another_one"]),
4138 	        )
4139 	
4140 	
4141 	class NoneHostFound(NameBuildTest):
4142 	    def test_all(self):
4143 	        self.assert_message_from_report(
4144 	            "None of hosts is known to pcs.", reports.NoneHostFound()
4145 	        )
4146 	
4147 	
4148 	class HostAlreadyAuthorized(NameBuildTest):
4149 	    def test_success(self):
4150 	        self.assert_message_from_report(
4151 	            "host: Already authorized", reports.HostAlreadyAuthorized("host")
4152 	        )
4153 	
4154 	
4155 	class AuthorizationSuccessful(NameBuildTest):
4156 	    def test_success(self):
4157 	        self.assert_message_from_report(
4158 	            "Authorized", reports.AuthorizationSuccessful()
4159 	        )
4160 	
4161 	
4162 	class IncorrectCredentials(NameBuildTest):
4163 	    def test_success(self):
4164 	        self.assert_message_from_report(
4165 	            "Username and/or password is incorrect",
4166 	            reports.IncorrectCredentials(),
4167 	        )
4168 	
4169 	
4170 	class NoHostSpecified(NameBuildTest):
4171 	    def test_success(self):
4172 	        self.assert_message_from_report(
4173 	            "No host specified", reports.NoHostSpecified()
4174 	        )
4175 	
4176 	
4177 	class ClusterDestroyStarted(NameBuildTest):
4178 	    def test_multiple_hosts(self):
4179 	        self.assert_message_from_report(
4180 	            "Destroying cluster on hosts: 'node1', 'node2', 'node3'...",
4181 	            reports.ClusterDestroyStarted(["node1", "node3", "node2"]),
4182 	        )
4183 	
4184 	    def test_single_host(self):
4185 	        self.assert_message_from_report(
4186 	            "Destroying cluster on hosts: 'node1'...",
4187 	            reports.ClusterDestroyStarted(["node1"]),
4188 	        )
4189 	
4190 	
4191 	class ClusterDestroySuccess(NameBuildTest):
4192 	    def test_success(self):
4193 	        self.assert_message_from_report(
4194 	            "node1: Successfully destroyed cluster",
4195 	            reports.ClusterDestroySuccess("node1"),
4196 	        )
4197 	
4198 	
4199 	class ClusterEnableStarted(NameBuildTest):
4200 	    def test_multiple_hosts(self):
4201 	        self.assert_message_from_report(
4202 	            "Enabling cluster on hosts: 'node1', 'node2', 'node3'...",
4203 	            reports.ClusterEnableStarted(["node1", "node3", "node2"]),
4204 	        )
4205 	
4206 	    def test_single_host(self):
4207 	        self.assert_message_from_report(
4208 	            "Enabling cluster on hosts: 'node1'...",
4209 	            reports.ClusterEnableStarted(["node1"]),
4210 	        )
4211 	
4212 	
4213 	class ClusterEnableSuccess(NameBuildTest):
4214 	    def test_success(self):
4215 	        self.assert_message_from_report(
4216 	            "node1: Cluster enabled", reports.ClusterEnableSuccess("node1")
4217 	        )
4218 	
4219 	
4220 	class ClusterStartStarted(NameBuildTest):
4221 	    def test_multiple_hosts(self):
4222 	        self.assert_message_from_report(
4223 	            "Starting cluster on hosts: 'node1', 'node2', 'node3'...",
4224 	            reports.ClusterStartStarted(["node1", "node3", "node2"]),
4225 	        )
4226 	
4227 	    def test_single_host(self):
4228 	        self.assert_message_from_report(
4229 	            "Starting cluster on hosts: 'node1'...",
4230 	            reports.ClusterStartStarted(["node1"]),
4231 	        )
4232 	
4233 	
4234 	class ClusterStartSuccess(NameBuildTest):
4235 	    def test_all(self):
4236 	        self.assert_message_from_report(
4237 	            "node1: Cluster started", reports.ClusterStartSuccess("node1")
4238 	        )
4239 	
4240 	
4241 	class ServiceNotInstalled(NameBuildTest):
4242 	    def test_multiple_services(self):
4243 	        self.assert_message_from_report(
4244 	            "node1: Required cluster services not installed: 'service1', "
4245 	            "'service2', 'service3'",
4246 	            reports.ServiceNotInstalled(
4247 	                "node1", ["service1", "service3", "service2"]
4248 	            ),
4249 	        )
4250 	
4251 	    def test_single_service(self):
4252 	        self.assert_message_from_report(
4253 	            "node1: Required cluster services not installed: 'service'",
4254 	            reports.ServiceNotInstalled("node1", ["service"]),
4255 	        )
4256 	
4257 	
4258 	class HostAlreadyInClusterConfig(NameBuildTest):
4259 	    def test_success(self):
4260 	        self.assert_message_from_report(
4261 	            "host: The host seems to be in a cluster already as cluster "
4262 	            "configuration files have been found on the host",
4263 	            reports.HostAlreadyInClusterConfig("host"),
4264 	        )
4265 	
4266 	
4267 	class HostAlreadyInClusterServices(NameBuildTest):
4268 	    def test_multiple_services(self):
4269 	        self.assert_message_from_report(
4270 	            "node1: The host seems to be in a cluster already as the following "
4271 	            "services are found to be running: 'service1', 'service2', "
4272 	            "'service3'. If the host is not part of a cluster, stop the "
4273 	            "services and retry",
4274 	            reports.HostAlreadyInClusterServices(
4275 	                "node1", ["service1", "service3", "service2"]
4276 	            ),
4277 	        )
4278 	
4279 	    def test_single_service(self):
4280 	        self.assert_message_from_report(
4281 	            "node1: The host seems to be in a cluster already as the following "
4282 	            "service is found to be running: 'service'. If the host is not "
4283 	            "part of a cluster, stop the service and retry",
4284 	            reports.HostAlreadyInClusterServices("node1", ["service"]),
4285 	        )
4286 	
4287 	
4288 	class ServiceVersionMismatch(NameBuildTest):
4289 	    def test_success(self):
4290 	        self.assert_message_from_report(
4291 	            "Hosts do not have the same version of 'service'; "
4292 	            "hosts 'host4', 'host5', 'host6' have version 2.0; "
4293 	            "hosts 'host1', 'host3' have version 1.0; "
4294 	            "host 'host2' has version 1.2",
4295 	            reports.ServiceVersionMismatch(
4296 	                "service",
4297 	                {
4298 	                    "host1": "1.0",
4299 	                    "host2": "1.2",
4300 	                    "host3": "1.0",
4301 	                    "host4": "2.0",
4302 	                    "host5": "2.0",
4303 	                    "host6": "2.0",
4304 	                },
4305 	            ),
4306 	        )
4307 	
4308 	
4309 	class WaitForNodeStartupStarted(NameBuildTest):
4310 	    def test_single_node(self):
4311 	        self.assert_message_from_report(
4312 	            "Waiting for node(s) to start: 'node1'...",
4313 	            reports.WaitForNodeStartupStarted(["node1"]),
4314 	        )
4315 	
4316 	    def test_multiple_nodes(self):
4317 	        self.assert_message_from_report(
4318 	            "Waiting for node(s) to start: 'node1', 'node2', 'node3'...",
4319 	            reports.WaitForNodeStartupStarted(["node3", "node2", "node1"]),
4320 	        )
4321 	
4322 	
4323 	class WaitForNodeStartupTimedOut(NameBuildTest):
4324 	    def test_all(self):
4325 	        self.assert_message_from_report(
4326 	            "Node(s) startup timed out", reports.WaitForNodeStartupTimedOut()
4327 	        )
4328 	
4329 	
4330 	class WaitForNodeStartupError(NameBuildTest):
4331 	    def test_all(self):
4332 	        self.assert_message_from_report(
4333 	            "Unable to verify all nodes have started",
4334 	            reports.WaitForNodeStartupError(),
4335 	        )
4336 	
4337 	
4338 	class WaitForNodeStartupWithoutStart(NameBuildTest):
4339 	    def test_all(self):
4340 	        self.assert_message_from_report(
4341 	            "Cannot specify 'wait' without specifying 'start'",
4342 	            reports.WaitForNodeStartupWithoutStart(),
4343 	        )
4344 	
4345 	
4346 	class PcsdVersionTooOld(NameBuildTest):
4347 	    def test_success(self):
4348 	        self.assert_message_from_report(
4349 	            (
4350 	                "node1: Old version of pcsd is running on the node, therefore "
4351 	                "it is unable to perform the action"
4352 	            ),
4353 	            reports.PcsdVersionTooOld("node1"),
4354 	        )
4355 	
4356 	
4357 	class PcsdSslCertAndKeyDistributionStarted(NameBuildTest):
4358 	    def test_multiple_nodes(self):
4359 	        self.assert_message_from_report(
4360 	            "Synchronizing pcsd SSL certificates on node(s) 'node1', 'node2', "
4361 	            "'node3'...",
4362 	            reports.PcsdSslCertAndKeyDistributionStarted(
4363 	                ["node1", "node3", "node2"]
4364 	            ),
4365 	        )
4366 	
4367 	    def test_single_node(self):
4368 	        self.assert_message_from_report(
4369 	            "Synchronizing pcsd SSL certificates on node(s) 'node3'...",
4370 	            reports.PcsdSslCertAndKeyDistributionStarted(["node3"]),
4371 	        )
4372 	
4373 	
4374 	class PcsdSslCertAndKeySetSuccess(NameBuildTest):
4375 	    def test_success(self):
4376 	        self.assert_message_from_report(
4377 	            "node1: Success", reports.PcsdSslCertAndKeySetSuccess("node1")
4378 	        )
4379 	
4380 	
4381 	class ClusterWillBeDestroyed(NameBuildTest):
4382 	    def test_all(self):
4383 	        self.assert_message_from_report(
4384 	            (
4385 	                "Some nodes are already in a cluster. Enforcing this will "
4386 	                "destroy existing cluster on those nodes. You should remove "
4387 	                "the nodes from their clusters instead to keep the clusters "
4388 	                "working properly"
4389 	            ),
4390 	            reports.ClusterWillBeDestroyed(),
4391 	        )
4392 	
4393 	
4394 	class ClusterSetupSuccess(NameBuildTest):
4395 	    def test_all(self):
4396 	        self.assert_message_from_report(
4397 	            "Cluster has been successfully set up.",
4398 	            reports.ClusterSetupSuccess(),
4399 	        )
4400 	
4401 	
4402 	class UsingDefaultAddressForHost(NameBuildTest):
4403 	    def test_success(self):
4404 	        self.assert_message_from_report(
4405 	            "No addresses specified for host 'node-name', using 'node-addr'",
4406 	            reports.UsingDefaultAddressForHost(
4407 	                "node-name",
4408 	                "node-addr",
4409 	                const.DEFAULT_ADDRESS_SOURCE_KNOWN_HOSTS,
4410 	            ),
4411 	        )
4412 	
4413 	
4414 	class ResourceInBundleNotAccessible(NameBuildTest):
4415 	    def test_success(self):
4416 	        self.assert_message_from_report(
4417 	            (
4418 	                "Resource 'resourceA' will not be accessible by the cluster "
4419 	                "inside bundle 'bundleA', at least one of bundle options "
4420 	                "'control-port' or 'ip-range-start' has to be specified"
4421 	            ),
4422 	            reports.ResourceInBundleNotAccessible("bundleA", "resourceA"),
4423 	        )
4424 	
4425 	
4426 	class UsingDefaultWatchdog(NameBuildTest):
4427 	    def test_success(self):
4428 	        self.assert_message_from_report(
4429 	            (
4430 	                "No watchdog has been specified for node 'node1'. Using "
4431 	                "default watchdog '/dev/watchdog'"
4432 	            ),
4433 	            reports.UsingDefaultWatchdog("/dev/watchdog", "node1"),
4434 	        )
4435 	
4436 	
4437 	class CannotRemoveAllClusterNodes(NameBuildTest):
4438 	    def test_success(self):
4439 	        self.assert_message_from_report(
4440 	            "No nodes would be left in the cluster",
4441 	            reports.CannotRemoveAllClusterNodes(),
4442 	        )
4443 	
4444 	
4445 	class UnableToConnectToAnyRemainingNode(NameBuildTest):
4446 	    def test_all(self):
4447 	        self.assert_message_from_report(
4448 	            "Unable to connect to any remaining cluster node",
4449 	            reports.UnableToConnectToAnyRemainingNode(),
4450 	        )
4451 	
4452 	
4453 	class UnableToConnectToAllRemainingNodes(NameBuildTest):
4454 	    def test_single_node(self):
4455 	        self.assert_message_from_report(
4456 	            ("Remaining cluster node 'node1' could not be reached"),
4457 	            reports.UnableToConnectToAllRemainingNodes(["node1"]),
4458 	        )
4459 	
4460 	    def test_multiple_nodes(self):
4461 	        self.assert_message_from_report(
4462 	            (
4463 	                "Remaining cluster nodes 'node0', 'node1', 'node2' could not "
4464 	                "be reached"
4465 	            ),
4466 	            reports.UnableToConnectToAllRemainingNodes(
4467 	                ["node1", "node0", "node2"]
4468 	            ),
4469 	        )
4470 	
4471 	
4472 	class NodesToRemoveUnreachable(NameBuildTest):
4473 	    def test_single_node(self):
4474 	        self.assert_message_from_report(
4475 	            (
4476 	                "Removed node 'node0' could not be reached and subsequently "
4477 	                "deconfigured"
4478 	            ),
4479 	            reports.NodesToRemoveUnreachable(["node0"]),
4480 	        )
4481 	
4482 	    def test_multiple_nodes(self):
4483 	        self.assert_message_from_report(
4484 	            (
4485 	                "Removed nodes 'node0', 'node1', 'node2' could not be reached "
4486 	                "and subsequently deconfigured"
4487 	            ),
4488 	            reports.NodesToRemoveUnreachable(["node1", "node0", "node2"]),
4489 	        )
4490 	
4491 	
4492 	class NodeUsedAsTieBreaker(NameBuildTest):
4493 	    def test_success(self):
4494 	        self.assert_message_from_report(
4495 	            (
4496 	                "Node 'node2' with id '2' is used as a tie breaker for a "
4497 	                "qdevice and therefore cannot be removed"
4498 	            ),
4499 	            reports.NodeUsedAsTieBreaker("node2", 2),
4500 	        )
4501 	
4502 	
4503 	class CorosyncQuorumWillBeLost(NameBuildTest):
4504 	    def test_all(self):
4505 	        self.assert_message_from_report(
4506 	            "This action will cause a loss of the quorum",
4507 	            reports.CorosyncQuorumWillBeLost(),
4508 	        )
4509 	
4510 	
4511 	class CorosyncQuorumLossUnableToCheck(NameBuildTest):
4512 	    def test_all(self):
4513 	        self.assert_message_from_report(
4514 	            (
4515 	                "Unable to determine whether this action will cause "
4516 	                "a loss of the quorum"
4517 	            ),
4518 	            reports.CorosyncQuorumLossUnableToCheck(),
4519 	        )
4520 	
4521 	
4522 	class SbdListWatchdogError(NameBuildTest):
4523 	    def test_success(self):
4524 	        self.assert_message_from_report(
4525 	            "Unable to query available watchdogs from sbd: this is a reason",
4526 	            reports.SbdListWatchdogError("this is a reason"),
4527 	        )
4528 	
4529 	
4530 	class SbdWatchdogNotSupported(NameBuildTest):
4531 	    def test_success(self):
4532 	        self.assert_message_from_report(
4533 	            (
4534 	                "node1: Watchdog '/dev/watchdog' is not supported (it may be a "
4535 	                "software watchdog)"
4536 	            ),
4537 	            reports.SbdWatchdogNotSupported("node1", "/dev/watchdog"),
4538 	        )
4539 	
4540 	
4541 	class SbdWatchdogValidationInactive(NameBuildTest):
4542 	    def test_all(self):
4543 	        self.assert_message_from_report(
4544 	            "Not validating the watchdog",
4545 	            reports.SbdWatchdogValidationInactive(),
4546 	        )
4547 	
4548 	
4549 	class SbdWatchdogTestError(NameBuildTest):
4550 	    def test_success(self):
4551 	        self.assert_message_from_report(
4552 	            "Unable to initialize test of the watchdog: some reason",
4553 	            reports.SbdWatchdogTestError("some reason"),
4554 	        )
4555 	
4556 	
4557 	class SbdWatchdogTestMultipleDevices(NameBuildTest):
4558 	    def test_all(self):
4559 	        self.assert_message_from_report(
4560 	            (
4561 	                "Multiple watchdog devices available, therefore, watchdog "
4562 	                "which should be tested has to be specified."
4563 	            ),
4564 	            reports.SbdWatchdogTestMultipleDevices(),
4565 	        )
4566 	
4567 	
4568 	class SbdWatchdogTestFailed(NameBuildTest):
4569 	    def test_all(self):
4570 	        self.assert_message_from_report(
4571 	            "System should have been reset already",
4572 	            reports.SbdWatchdogTestFailed(),
4573 	        )
4574 	
4575 	
4576 	class SystemWillReset(NameBuildTest):
4577 	    def test_all(self):
4578 	        self.assert_message_from_report(
4579 	            "System will reset shortly", reports.SystemWillReset()
4580 	        )
4581 	
4582 	
4583 	class ResourceBundleUnsupportedContainerType(NameBuildTest):
4584 	    def test_single_type(self):
4585 	        self.assert_message_from_report(
4586 	            (
4587 	                "Bundle 'bundle id' uses unsupported container type, therefore "
4588 	                "it is not possible to set its container options. Supported "
4589 	                "container types are: 'b'"
4590 	            ),
4591 	            reports.ResourceBundleUnsupportedContainerType("bundle id", ["b"]),
4592 	        )
4593 	
4594 	    def test_multiple_types(self):
4595 	        self.assert_message_from_report(
4596 	            (
4597 	                "Bundle 'bundle id' uses unsupported container type, therefore "
4598 	                "it is not possible to set its container options. Supported "
4599 	                "container types are: 'a', 'b', 'c'"
4600 	            ),
4601 	            reports.ResourceBundleUnsupportedContainerType(
4602 	                "bundle id", ["b", "a", "c"]
4603 	            ),
4604 	        )
4605 	
4606 	    def test_no_update(self):
4607 	        self.assert_message_from_report(
4608 	            (
4609 	                "Bundle 'bundle id' uses unsupported container type. Supported "
4610 	                "container types are: 'a', 'b', 'c'"
4611 	            ),
4612 	            reports.ResourceBundleUnsupportedContainerType(
4613 	                "bundle id", ["b", "a", "c"], updating_options=False
4614 	            ),
4615 	        )
4616 	
4617 	
4618 	class FenceHistoryCommandError(NameBuildTest):
4619 	    def test_success(self):
4620 	        self.assert_message_from_report(
4621 	            "Unable to show fence history: reason",
4622 	            reports.FenceHistoryCommandError(
4623 	                "reason", reports.const.FENCE_HISTORY_COMMAND_SHOW
4624 	            ),
4625 	        )
4626 	
4627 	
4628 	class FenceHistoryNotSupported(NameBuildTest):
4629 	    def test_success(self):
4630 	        self.assert_message_from_report(
4631 	            "Fence history is not supported, please upgrade pacemaker",
4632 	            reports.FenceHistoryNotSupported(),
4633 	        )
4634 	
4635 	
4636 	class ResourceInstanceAttrValueNotUnique(NameBuildTest):
4637 	    def test_one_resource(self):
4638 	        self.assert_message_from_report(
4639 	            (
4640 	                "Value 'val' of option 'attr' is not unique across 'agent' "
4641 	                "resources. Following resources are configured with the same "
4642 	                "value of the instance attribute: 'A'"
4643 	            ),
4644 	            reports.ResourceInstanceAttrValueNotUnique(
4645 	                "attr", "val", "agent", ["A"]
4646 	            ),
4647 	        )
4648 	
4649 	    def test_multiple_resources(self):
4650 	        self.assert_message_from_report(
4651 	            (
4652 	                "Value 'val' of option 'attr' is not unique across 'agent' "
4653 	                "resources. Following resources are configured with the same "
4654 	                "value of the instance attribute: 'A', 'B', 'C'"
4655 	            ),
4656 	            reports.ResourceInstanceAttrValueNotUnique(
4657 	                "attr", "val", "agent", ["B", "C", "A"]
4658 	            ),
4659 	        )
4660 	
4661 	
4662 	class ResourceInstanceAttrGroupValueNotUnique(NameBuildTest):
4663 	    def test_message(self):
4664 	        self.assert_message_from_report(
4665 	            (
4666 	                "Value '127.0.0.1', '12345' of options 'ip', 'port' (group "
4667 	                "'address') is not unique across 'agent' resources. Following "
4668 	                "resources are configured with the same values of the instance "
4669 	                "attributes: 'A', 'B'"
4670 	            ),
4671 	            reports.ResourceInstanceAttrGroupValueNotUnique(
4672 	                "address",
4673 	                {
4674 	                    "port": "12345",
4675 	                    "ip": "127.0.0.1",
4676 	                },
4677 	                "agent",
4678 	                ["B", "A"],
4679 	            ),
4680 	        )
4681 	
4682 	
4683 	class CannotLeaveGroupEmptyAfterMove(NameBuildTest):
4684 	    def test_single_resource(self):
4685 	        self.assert_message_from_report(
4686 	            "Unable to move resource 'R' as it would leave group 'gr1' empty.",
4687 	            reports.CannotLeaveGroupEmptyAfterMove("gr1", ["R"]),
4688 	        )
4689 	
4690 	    def test_multiple_resources(self):
4691 	        self.assert_message_from_report(
4692 	            "Unable to move resources 'R1', 'R2', 'R3' as it would leave "
4693 	            "group 'gr1' empty.",
4694 	            reports.CannotLeaveGroupEmptyAfterMove("gr1", ["R3", "R1", "R2"]),
4695 	        )
4696 	
4697 	
4698 	class CannotMoveResourceBundleInner(NameBuildTest):
4699 	    def test_success(self):
4700 	        self.assert_message_from_report(
4701 	            (
4702 	                "Resources cannot be moved out of their bundles. If you want "
4703 	                "to move a bundle, use the bundle id (B)"
4704 	            ),
4705 	            reports.CannotMoveResourceBundleInner("R", "B"),
4706 	        )
4707 	
4708 	
4709 	class CannotMoveResourceCloneInner(NameBuildTest):
4710 	    def test_success(self):
4711 	        self.assert_message_from_report(
4712 	            "to move clone resources you must use the clone id (C)",
4713 	            reports.CannotMoveResourceCloneInner("R", "C"),
4714 	        )
4715 	
4716 	
4717 	class CannotMoveResourceMultipleInstances(NameBuildTest):
4718 	    def test_success(self):
4719 	        self.assert_message_from_report(
4720 	            (
4721 	                "more than one instance of resource 'R' is running, "
4722 	                "thus the resource cannot be moved"
4723 	            ),
4724 	            reports.CannotMoveResourceMultipleInstances("R"),
4725 	        )
4726 	
4727 	
4728 	class CannotMoveResourceMultipleInstancesNoNodeSpecified(NameBuildTest):
4729 	    def test_success(self):
4730 	        self.assert_message_from_report(
4731 	            (
4732 	                "more than one instance of resource 'R' is running, "
4733 	                "thus the resource cannot be moved, "
4734 	                "unless a destination node is specified"
4735 	            ),
4736 	            reports.CannotMoveResourceMultipleInstancesNoNodeSpecified("R"),
4737 	        )
4738 	
4739 	
4740 	class CannotMoveResourcePromotableInner(NameBuildTest):
4741 	    def test_success(self):
4742 	        self.assert_message_from_report(
4743 	            (
4744 	                "to move promotable clone resources you must use "
4745 	                "the promotable clone id (P)"
4746 	            ),
4747 	            reports.CannotMoveResourcePromotableInner("R", "P"),
4748 	        )
4749 	
4750 	
4751 	class CannotMoveResourceMasterResourceNotPromotable(NameBuildTest):
4752 	    def test_without_promotable(self):
4753 	        self.assert_message_from_report(
4754 	            "when specifying promoted you must use the promotable clone id",
4755 	            reports.CannotMoveResourceMasterResourceNotPromotable("R"),
4756 	        )
4757 	
4758 	    def test_with_promotable(self):
4759 	        self.assert_message_from_report(
4760 	            "when specifying promoted you must use the promotable clone id (P)",
4761 	            reports.CannotMoveResourceMasterResourceNotPromotable(
4762 	                "R", promotable_id="P"
4763 	            ),
4764 	        )
4765 	
4766 	
4767 	class CannotMoveResourceNotRunning(NameBuildTest):
4768 	    def test_success(self):
4769 	        self.assert_message_from_report(
4770 	            (
4771 	                "It is not possible to move resource 'R' as it is not running "
4772 	                "at the moment"
4773 	            ),
4774 	            reports.CannotMoveResourceNotRunning("R"),
4775 	        )
4776 	
4777 	
4778 	class CannotMoveResourceStoppedNoNodeSpecified(NameBuildTest):
4779 	    def test_success(self):
4780 	        self.assert_message_from_report(
4781 	            "You must specify a node when moving/banning a stopped resource",
4782 	            reports.CannotMoveResourceStoppedNoNodeSpecified("R"),
4783 	        )
4784 	
4785 	
4786 	class ResourceMovePcmkError(NameBuildTest):
4787 	    def test_success(self):
4788 	        self.assert_message_from_report(
4789 	            "cannot move resource 'R'\nstdout1\n  stdout2\nstderr1\n  stderr2",
4790 	            reports.ResourceMovePcmkError(
4791 	                "R", "stdout1\n\n  stdout2\n", "stderr1\n\n  stderr2\n"
4792 	            ),
4793 	        )
4794 	
4795 	
4796 	class ResourceMovePcmkSuccess(NameBuildTest):
4797 	    def test_success(self):
4798 	        self.assert_message_from_report(
4799 	            "stdout1\n  stdout2\nstderr1\n  stderr2",
4800 	            reports.ResourceMovePcmkSuccess(
4801 	                "R", "stdout1\n\n  stdout2\n", "stderr1\n\n  stderr2\n"
4802 	            ),
4803 	        )
4804 	
4805 	    def test_translate(self):
4806 	        self.assert_message_from_report(
4807 	            (
4808 	                "Warning: Creating location constraint "
4809 	                "'cli-ban-dummy-on-node1' with a score of -INFINITY "
4810 	                "for resource dummy on node1.\n"
4811 	                "	This will prevent dummy from running on node1 until the "
4812 	                "constraint is removed\n"
4813 	                "	This will be the case even if node1 is the last node in "
4814 	                "the cluster"
4815 	            ),
4816 	            reports.ResourceMovePcmkSuccess(
4817 	                "dummy",
4818 	                "",
4819 	                (
4820 	                    "WARNING: Creating rsc_location constraint "
4821 	                    "'cli-ban-dummy-on-node1' with a score of -INFINITY "
4822 	                    "for resource dummy on node1.\n"
4823 	                    "	This will prevent dummy from running on node1 until "
4824 	                    "the constraint is removed using the clear option or "
4825 	                    "by editing the CIB with an appropriate tool\n"
4826 	                    "	This will be the case even if node1 is the last node "
4827 	                    "in the cluster\n"
4828 	                ),
4829 	            ),
4830 	        )
4831 	
4832 	
4833 	class CannotBanResourceBundleInner(NameBuildTest):
4834 	    def test_success(self):
4835 	        self.assert_message_from_report(
4836 	            (
4837 	                "Resource 'R' is in a bundle and cannot be banned. If you want "
4838 	                "to ban the bundle, use the bundle id (B)"
4839 	            ),
4840 	            reports.CannotBanResourceBundleInner("R", "B"),
4841 	        )
4842 	
4843 	
4844 	class CannotBanResourceMasterResourceNotPromotable(NameBuildTest):
4845 	    def test_without_promotable(self):
4846 	        self.assert_message_from_report(
4847 	            "when specifying promoted you must use the promotable clone id",
4848 	            reports.CannotBanResourceMasterResourceNotPromotable("R"),
4849 	        )
4850 	
4851 	    def test_with_promotable(self):
4852 	        self.assert_message_from_report(
4853 	            "when specifying promoted you must use the promotable clone id (P)",
4854 	            reports.CannotBanResourceMasterResourceNotPromotable(
4855 	                "R", promotable_id="P"
4856 	            ),
4857 	        )
4858 	
4859 	
4860 	class CannotBanResourceMultipleInstancesNoNodeSpecified(NameBuildTest):
4861 	    def test_success(self):
4862 	        self.assert_message_from_report(
4863 	            (
4864 	                "more than one instance of resource 'R' is running, "
4865 	                "thus the resource cannot be banned, "
4866 	                "unless a destination node is specified"
4867 	            ),
4868 	            reports.CannotBanResourceMultipleInstancesNoNodeSpecified("R"),
4869 	        )
4870 	
4871 	
4872 	class CannotBanResourceStoppedNoNodeSpecified(NameBuildTest):
4873 	    def test_success(self):
4874 	        self.assert_message_from_report(
4875 	            "You must specify a node when moving/banning a stopped resource",
4876 	            reports.CannotBanResourceStoppedNoNodeSpecified("R"),
4877 	        )
4878 	
4879 	
4880 	class ResourceBanPcmkError(NameBuildTest):
4881 	    def test_success(self):
4882 	        self.assert_message_from_report(
4883 	            "cannot ban resource 'R'\nstdout1\n  stdout2\nstderr1\n  stderr2",
4884 	            reports.ResourceBanPcmkError(
4885 	                "R", "stdout1\n\n  stdout2\n", "stderr1\n\n  stderr2\n"
4886 	            ),
4887 	        )
4888 	
4889 	
4890 	class ResourceBanPcmkSuccess(NameBuildTest):
4891 	    def test_success(self):
4892 	        self.assert_message_from_report(
4893 	            "stdout1\n  stdout2\nstderr1\n  stderr2",
4894 	            reports.ResourceBanPcmkSuccess(
4895 	                "R", "stdout1\n\n  stdout2\n", "stderr1\n\n  stderr2\n"
4896 	            ),
4897 	        )
4898 	
4899 	    def test_translate(self):
4900 	        self.assert_message_from_report(
4901 	            (
4902 	                "Warning: Creating location constraint "
4903 	                "'cli-ban-dummy-on-node1' with a score of -INFINITY "
4904 	                "for resource dummy on node1.\n"
4905 	                "	This will prevent dummy from running on node1 until the "
4906 	                "constraint is removed\n"
4907 	                "	This will be the case even if node1 is the last node in "
4908 	                "the cluster"
4909 	            ),
4910 	            reports.ResourceBanPcmkSuccess(
4911 	                "dummy",
4912 	                "",
4913 	                (
4914 	                    "WARNING: Creating rsc_location constraint "
4915 	                    "'cli-ban-dummy-on-node1' with a score of -INFINITY "
4916 	                    "for resource dummy on node1.\n"
4917 	                    "	This will prevent dummy from running on node1 until "
4918 	                    "the constraint is removed using the clear option or "
4919 	                    "by editing the CIB with an appropriate tool\n"
4920 	                    "	This will be the case even if node1 is the last node "
4921 	                    "in the cluster\n"
4922 	                ),
4923 	            ),
4924 	        )
4925 	
4926 	
4927 	class CannotUnmoveUnbanResourceMasterResourceNotPromotable(NameBuildTest):
4928 	    def test_without_promotable(self):
4929 	        self.assert_message_from_report(
4930 	            "when specifying promoted you must use the promotable clone id",
4931 	            reports.CannotUnmoveUnbanResourceMasterResourceNotPromotable("R"),
4932 	        )
4933 	
4934 	    def test_with_promotable(self):
4935 	        self.assert_message_from_report(
4936 	            "when specifying promoted you must use the promotable clone id (P)",
4937 	            reports.CannotUnmoveUnbanResourceMasterResourceNotPromotable(
4938 	                "R", promotable_id="P"
4939 	            ),
4940 	        )
4941 	
4942 	
4943 	class ResourceUnmoveUnbanPcmkExpiredNotSupported(NameBuildTest):
4944 	    def test_success(self):
4945 	        self.assert_message_from_report(
4946 	            "expired is not supported, please upgrade pacemaker",
4947 	            reports.ResourceUnmoveUnbanPcmkExpiredNotSupported(),
4948 	        )
4949 	
4950 	
4951 	class ResourceUnmoveUnbanPcmkError(NameBuildTest):
4952 	    def test_success(self):
4953 	        self.assert_message_from_report(
4954 	            "cannot clear resource 'R'\nstdout1\n  stdout2\nstderr1\n  stderr2",
4955 	            reports.ResourceUnmoveUnbanPcmkError(
4956 	                "R", "stdout1\n\n  stdout2\n", "stderr1\n\n  stderr2\n"
4957 	            ),
4958 	        )
4959 	
4960 	
4961 	class ResourceUnmoveUnbanPcmkSuccess(NameBuildTest):
4962 	    def test_success(self):
4963 	        self.assert_message_from_report(
4964 	            "stdout1\n  stdout2\nstderr1\n  stderr2",
4965 	            reports.ResourceUnmoveUnbanPcmkSuccess(
4966 	                "R", "stdout1\n\n  stdout2\n", "stderr1\n\n  stderr2\n"
4967 	            ),
4968 	        )
4969 	
4970 	
4971 	class ResourceMoveConstraintCreated(NameBuildTest):
4972 	    def test_success(self):
4973 	        self.assert_message_from_report(
4974 	            "Location constraint to move resource 'R1' has been created",
4975 	            reports.ResourceMoveConstraintCreated("R1"),
4976 	        )
4977 	
4978 	
4979 	class ResourceMoveConstraintRemoved(NameBuildTest):
4980 	    def test_success(self):
4981 	        self.assert_message_from_report(
4982 	            (
4983 	                "Location constraint created to move resource 'R1' has "
4984 	                "been removed"
4985 	            ),
4986 	            reports.ResourceMoveConstraintRemoved("R1"),
4987 	        )
4988 	
4989 	
4990 	class ResourceMoveNotAffectingResource(NameBuildTest):
4991 	    def test_success(self):
4992 	        self.assert_message_from_report(
4993 	            (
4994 	                "Unable to move resource 'R1' using a location constraint. "
4995 	                "Current location of the resource may be affected by some "
4996 	                "other constraint."
4997 	            ),
4998 	            reports.ResourceMoveNotAffectingResource("R1"),
4999 	        )
5000 	
5001 	
5002 	class ResourceMoveAffectsOtherResources(NameBuildTest):
5003 	    def test_multiple(self):
5004 	        self.assert_message_from_report(
5005 	            "Moving resource 'R1' affects resources: 'p0', 'p1', 'p2'",
5006 	            reports.ResourceMoveAffectsOtherResources("R1", ["p2", "p0", "p1"]),
5007 	        )
5008 	
5009 	    def test_single(self):
5010 	        self.assert_message_from_report(
5011 	            "Moving resource 'R1' affects resource: 'R2'",
5012 	            reports.ResourceMoveAffectsOtherResources("R1", ["R2"]),
5013 	        )
5014 	
5015 	
5016 	class ResourceMoveAutocleanSimulationFailure(NameBuildTest):
5017 	    def test_simulation(self):
5018 	        self.assert_message_from_report(
5019 	            (
5020 	                "Unable to ensure that moved resource 'R1' will stay on the "
5021 	                "same node after a constraint used for moving it is removed."
5022 	            ),
5023 	            reports.ResourceMoveAutocleanSimulationFailure(
5024 	                "R1", others_affected=False
5025 	            ),
5026 	        )
5027 	
5028 	    def test_simulation_others_affected(self):
5029 	        self.assert_message_from_report(
5030 	            (
5031 	                "Unable to ensure that moved resource 'R1' or other resources "
5032 	                "will stay on the same node after a constraint used for moving "
5033 	                "it is removed."
5034 	            ),
5035 	            reports.ResourceMoveAutocleanSimulationFailure(
5036 	                "R1", others_affected=True
5037 	            ),
5038 	        )
5039 	
5040 	    def test_live(self):
5041 	        self.assert_message_from_report(
5042 	            (
5043 	                "Unable to ensure that moved resource 'R1' will stay on the "
5044 	                "same node after a constraint used for moving it is removed."
5045 	                " The constraint to move the resource has not been removed "
5046 	                "from configuration. Consider removing it manually. Be aware "
5047 	                "that removing the constraint may cause resources to move to "
5048 	                "other nodes."
5049 	            ),
5050 	            reports.ResourceMoveAutocleanSimulationFailure(
5051 	                "R1", others_affected=False, move_constraint_left_in_cib=True
5052 	            ),
5053 	        )
5054 	
5055 	    def test_live_others_affected(self):
5056 	        self.assert_message_from_report(
5057 	            (
5058 	                "Unable to ensure that moved resource 'R1' or other resources "
5059 	                "will stay on the same node after a constraint used for moving "
5060 	                "it is removed."
5061 	                " The constraint to move the resource has not been removed "
5062 	                "from configuration. Consider removing it manually. Be aware "
5063 	                "that removing the constraint may cause resources to move to "
5064 	                "other nodes."
5065 	            ),
5066 	            reports.ResourceMoveAutocleanSimulationFailure(
5067 	                "R1", others_affected=True, move_constraint_left_in_cib=True
5068 	            ),
5069 	        )
5070 	
5071 	
5072 	class ResourceMayOrMayNotMove(NameBuildTest):
5073 	    def test_build_message(self):
5074 	        self.assert_message_from_report(
5075 	            (
5076 	                "A move constraint has been created and the resource 'id' may "
5077 	                "or may not move depending on other configuration"
5078 	            ),
5079 	            reports.ResourceMayOrMayNotMove("id"),
5080 	        )
5081 	
5082 	
5083 	class ParseErrorJsonFile(NameBuildTest):
5084 	    def test_success(self):
5085 	        self.assert_message_from_report(
5086 	            "Unable to parse known-hosts file '/tmp/known-hosts': "
5087 	            "some reason: line 15 column 5 (char 100)",
5088 	            reports.ParseErrorJsonFile(
5089 	                file_type_codes.PCS_KNOWN_HOSTS,
5090 	                15,
5091 	                5,
5092 	                100,
5093 	                "some reason",
5094 	                "some reason: line 15 column 5 (char 100)",
5095 	                file_path="/tmp/known-hosts",
5096 	            ),
5097 	        )
5098 	
5099 	
5100 	class ResourceDisableAffectsOtherResources(NameBuildTest):
5101 	    def test_multiple_disabled(self):
5102 	        self.assert_message_from_report(
5103 	            (
5104 	                "Disabling specified resource would have an effect on these "
5105 	                "resources: 'O1', 'O2'"
5106 	            ),
5107 	            reports.ResourceDisableAffectsOtherResources(
5108 	                ["D1"],
5109 	                ["O2", "O1"],
5110 	            ),
5111 	        )
5112 	
5113 	    def test_multiple_affected(self):
5114 	        self.assert_message_from_report(
5115 	            (
5116 	                "Disabling specified resources would have an effect on this "
5117 	                "resource: 'O1'"
5118 	            ),
5119 	            reports.ResourceDisableAffectsOtherResources(
5120 	                ["D2", "D1"],
5121 	                ["O1"],
5122 	            ),
5123 	        )
5124 	
5125 	
5126 	class DrConfigAlreadyExist(NameBuildTest):
5127 	    def test_success(self):
5128 	        self.assert_message_from_report(
5129 	            "Disaster-recovery already configured",
5130 	            reports.DrConfigAlreadyExist(),
5131 	        )
5132 	
5133 	
5134 	class DrConfigDoesNotExist(NameBuildTest):
5135 	    def test_success(self):
5136 	        self.assert_message_from_report(
5137 	            "Disaster-recovery is not configured",
5138 	            reports.DrConfigDoesNotExist(),
5139 	        )
5140 	
5141 	
5142 	class NodeInLocalCluster(NameBuildTest):
5143 	    def test_success(self):
5144 	        self.assert_message_from_report(
5145 	            "Node 'node-name' is part of local cluster",
5146 	            reports.NodeInLocalCluster("node-name"),
5147 	        )
5148 	
5149 	
5150 	class BoothLackOfSites(NameBuildTest):
5151 	    def test_no_site(self):
5152 	        self.assert_message_from_report(
5153 	            (
5154 	                "lack of sites for booth configuration (need 2 at least): "
5155 	                "sites missing"
5156 	            ),
5157 	            reports.BoothLackOfSites([]),
5158 	        )
5159 	
5160 	    def test_single_site(self):
5161 	        self.assert_message_from_report(
5162 	            (
5163 	                "lack of sites for booth configuration (need 2 at least): "
5164 	                "sites 'site1'"
5165 	            ),
5166 	            reports.BoothLackOfSites(["site1"]),
5167 	        )
5168 	
5169 	    def test_multiple_sites(self):
5170 	        self.assert_message_from_report(
5171 	            (
5172 	                "lack of sites for booth configuration (need 2 at least): "
5173 	                "sites 'site1', 'site2'"
5174 	            ),
5175 	            reports.BoothLackOfSites(["site1", "site2"]),
5176 	        )
5177 	
5178 	
5179 	class BoothEvenPeersNumber(NameBuildTest):
5180 	    def test_success(self):
5181 	        self.assert_message_from_report(
5182 	            "odd number of peers is required (entered 4 peers)",
5183 	            reports.BoothEvenPeersNumber(4),
5184 	        )
5185 	
5186 	
5187 	class BoothAddressDuplication(NameBuildTest):
5188 	    def test_single_address(self):
5189 	        self.assert_message_from_report(
5190 	            "duplicate address for booth configuration: 'addr1'",
5191 	            reports.BoothAddressDuplication(["addr1"]),
5192 	        )
5193 	
5194 	    def test_multiple_addresses(self):
5195 	        self.assert_message_from_report(
5196 	            (
5197 	                "duplicate address for booth configuration: 'addr1', 'addr2', "
5198 	                "'addr3'"
5199 	            ),
5200 	            reports.BoothAddressDuplication(
5201 	                sorted(["addr2", "addr1", "addr3"])
5202 	            ),
5203 	        )
5204 	
5205 	
5206 	class BoothConfigUnexpectedLines(NameBuildTest):
5207 	    def test_single_line(self):
5208 	        self.assert_message_from_report(
5209 	            "unexpected line in booth config:\nline",
5210 	            reports.BoothConfigUnexpectedLines(["line"]),
5211 	        )
5212 	
5213 	    def test_multiple_lines(self):
5214 	        self.assert_message_from_report(
5215 	            "unexpected lines in booth config:\nline\nline2",
5216 	            reports.BoothConfigUnexpectedLines(["line", "line2"]),
5217 	        )
5218 	
5219 	    def test_file_path(self):
5220 	        self.assert_message_from_report(
5221 	            "unexpected line in booth config 'PATH':\nline",
5222 	            reports.BoothConfigUnexpectedLines(["line"], file_path="PATH"),
5223 	        )
5224 	
5225 	
5226 	class BoothInvalidName(NameBuildTest):
5227 	    def test_success(self):
5228 	        self.assert_message_from_report(
5229 	            "booth name '/name' is not valid, it cannot contain /{} characters",
5230 	            reports.BoothInvalidName("/name", "/{}"),
5231 	        )
5232 	
5233 	
5234 	class BoothTicketNameInvalid(NameBuildTest):
5235 	    def test_success(self):
5236 	        self.assert_message_from_report(
5237 	            (
5238 	                "booth ticket name 'ticket&' is not valid, use up to 63 "
5239 	                "alphanumeric characters or dash"
5240 	            ),
5241 	            reports.BoothTicketNameInvalid("ticket&"),
5242 	        )
5243 	
5244 	
5245 	class BoothTicketDuplicate(NameBuildTest):
5246 	    def test_success(self):
5247 	        self.assert_message_from_report(
5248 	            "booth ticket name 'ticket_name' already exists in configuration",
5249 	            reports.BoothTicketDuplicate("ticket_name"),
5250 	        )
5251 	
5252 	
5253 	class BoothTicketDoesNotExist(NameBuildTest):
5254 	    def test_success(self):
5255 	        self.assert_message_from_report(
5256 	            "booth ticket name 'ticket_name' does not exist",
5257 	            reports.BoothTicketDoesNotExist("ticket_name"),
5258 	        )
5259 	
5260 	
5261 	class BoothTicketNotInCib(NameBuildTest):
5262 	    def test_success(self):
5263 	        self.assert_message_from_report(
5264 	            "Unable to find ticket 'name' in CIB",
5265 	            reports.BoothTicketNotInCib("name"),
5266 	        )
5267 	
5268 	
5269 	class BoothAlreadyInCib(NameBuildTest):
5270 	    def test_success(self):
5271 	        self.assert_message_from_report(
5272 	            "booth instance 'name' is already created as cluster resource",
5273 	            reports.BoothAlreadyInCib("name"),
5274 	        )
5275 	
5276 	
5277 	class BoothPathNotExists(NameBuildTest):
5278 	    def test_success(self):
5279 	        self.assert_message_from_report(
5280 	            (
5281 	                "Configuration directory for booth 'path' is missing. Is booth "
5282 	                "installed?"
5283 	            ),
5284 	            reports.BoothPathNotExists("path"),
5285 	        )
5286 	
5287 	
5288 	class BoothNotExistsInCib(NameBuildTest):
5289 	    def test_success(self):
5290 	        self.assert_message_from_report(
5291 	            "booth instance 'name' not found in cib",
5292 	            reports.BoothNotExistsInCib("name"),
5293 	        )
5294 	
5295 	
5296 	class BoothConfigIsUsed(NameBuildTest):
5297 	    def test_cluster(self):
5298 	        self.assert_message_from_report(
5299 	            "booth instance 'name' is used in a cluster resource",
5300 	            reports.BoothConfigIsUsed(
5301 	                "name", reports.const.BOOTH_CONFIG_USED_IN_CLUSTER_RESOURCE
5302 	            ),
5303 	        )
5304 	
5305 	    def test_cluster_resource(self):
5306 	        self.assert_message_from_report(
5307 	            "booth instance 'name' is used in cluster resource 'R'",
5308 	            reports.BoothConfigIsUsed(
5309 	                "name", reports.const.BOOTH_CONFIG_USED_IN_CLUSTER_RESOURCE, "R"
5310 	            ),
5311 	        )
5312 	
5313 	    def test_service_manager_enabled(self):
5314 	        self.assert_message_from_report(
5315 	            "booth instance 'name' is used - it is enabled in service manager",
5316 	            reports.BoothConfigIsUsed(
5317 	                "name",
5318 	                reports.const.BOOTH_CONFIG_USED_ENABLED_IN_SERVICE_MANAGER,
5319 	            ),
5320 	        )
5321 	
5322 	    def test_service_manager_running(self):
5323 	        self.assert_message_from_report(
5324 	            "booth instance 'name' is used - it is running in service manager",
5325 	            reports.BoothConfigIsUsed(
5326 	                "name",
5327 	                reports.const.BOOTH_CONFIG_USED_RUNNING_IN_SERVICE_MANAGER,
5328 	            ),
5329 	        )
5330 	
5331 	    def test_systemd_enabled(self):
5332 	        self.assert_message_from_report(
5333 	            "booth instance 'name' is used - it is enabled in systemd",
5334 	            reports.BoothConfigIsUsed(
5335 	                "name",
5336 	                reports.const.BOOTH_CONFIG_USED_ENABLED_IN_SYSTEMD,
5337 	            ),
5338 	        )
5339 	
5340 	    def test_systemd_running(self):
5341 	        self.assert_message_from_report(
5342 	            "booth instance 'name' is used - it is running in systemd",
5343 	            reports.BoothConfigIsUsed(
5344 	                "name",
5345 	                reports.const.BOOTH_CONFIG_USED_RUNNING_IN_SYSTEMD,
5346 	            ),
5347 	        )
5348 	
5349 	
5350 	class BoothMultipleTimesInCib(NameBuildTest):
5351 	    def test_success(self):
5352 	        self.assert_message_from_report(
5353 	            "found more than one booth instance 'name' in cib",
5354 	            reports.BoothMultipleTimesInCib("name"),
5355 	        )
5356 	
5357 	
5358 	class BoothConfigDistributionStarted(NameBuildTest):
5359 	    def test_success(self):
5360 	        self.assert_message_from_report(
5361 	            "Sending booth configuration to cluster nodes...",
5362 	            reports.BoothConfigDistributionStarted(),
5363 	        )
5364 	
5365 	
5366 	class BoothConfigAcceptedByNode(NameBuildTest):
5367 	    def test_defaults(self):
5368 	        self.assert_message_from_report(
5369 	            "Booth config saved",
5370 	            reports.BoothConfigAcceptedByNode(),
5371 	        )
5372 	
5373 	    def test_empty_name_list(self):
5374 	        self.assert_message_from_report(
5375 	            "Booth config saved",
5376 	            reports.BoothConfigAcceptedByNode(name_list=[]),
5377 	        )
5378 	
5379 	    def test_node_and_empty_name_list(self):
5380 	        self.assert_message_from_report(
5381 	            "node1: Booth config saved",
5382 	            reports.BoothConfigAcceptedByNode(node="node1", name_list=[]),
5383 	        )
5384 	
5385 	    def test_name_booth_only(self):
5386 	        self.assert_message_from_report(
5387 	            "Booth config saved",
5388 	            reports.BoothConfigAcceptedByNode(name_list=["booth"]),
5389 	        )
5390 	
5391 	    def test_name_booth_and_node(self):
5392 	        self.assert_message_from_report(
5393 	            "node1: Booth config saved",
5394 	            reports.BoothConfigAcceptedByNode(
5395 	                node="node1",
5396 	                name_list=["booth"],
5397 	            ),
5398 	        )
5399 	
5400 	    def test_single_name(self):
5401 	        self.assert_message_from_report(
5402 	            "Booth config 'some' saved",
5403 	            reports.BoothConfigAcceptedByNode(name_list=["some"]),
5404 	        )
5405 	
5406 	    def test_multiple_names(self):
5407 	        self.assert_message_from_report(
5408 	            "Booth configs 'another', 'some' saved",
5409 	            reports.BoothConfigAcceptedByNode(name_list=["another", "some"]),
5410 	        )
5411 	
5412 	    def test_node(self):
5413 	        self.assert_message_from_report(
5414 	            "node1: Booth configs 'another', 'some' saved",
5415 	            reports.BoothConfigAcceptedByNode(
5416 	                node="node1",
5417 	                name_list=["some", "another"],
5418 	            ),
5419 	        )
5420 	
5421 	
5422 	class BoothConfigDistributionNodeError(NameBuildTest):
5423 	    def test_empty_name(self):
5424 	        self.assert_message_from_report(
5425 	            "Unable to save booth config on node 'node1': reason1",
5426 	            reports.BoothConfigDistributionNodeError("node1", "reason1"),
5427 	        )
5428 	
5429 	    def test_booth_name(self):
5430 	        self.assert_message_from_report(
5431 	            "Unable to save booth config on node 'node1': reason1",
5432 	            reports.BoothConfigDistributionNodeError(
5433 	                "node1",
5434 	                "reason1",
5435 	                name="booth",
5436 	            ),
5437 	        )
5438 	
5439 	    def test_another_name(self):
5440 	        self.assert_message_from_report(
5441 	            "Unable to save booth config 'another' on node 'node1': reason1",
5442 	            reports.BoothConfigDistributionNodeError(
5443 	                "node1",
5444 	                "reason1",
5445 	                name="another",
5446 	            ),
5447 	        )
5448 	
5449 	
5450 	class BoothFetchingConfigFromNode(NameBuildTest):
5451 	    def test_empty_name(self):
5452 	        self.assert_message_from_report(
5453 	            "Fetching booth config from node 'node1'...",
5454 	            reports.BoothFetchingConfigFromNode("node1"),
5455 	        )
5456 	
5457 	    def test_booth_name(self):
5458 	        self.assert_message_from_report(
5459 	            "Fetching booth config from node 'node1'...",
5460 	            reports.BoothFetchingConfigFromNode("node1", config="booth"),
5461 	        )
5462 	
5463 	    def test_another_name(self):
5464 	        self.assert_message_from_report(
5465 	            "Fetching booth config 'another' from node 'node1'...",
5466 	            reports.BoothFetchingConfigFromNode("node1", config="another"),
5467 	        )
5468 	
5469 	
5470 	class BoothUnsupportedFileLocation(NameBuildTest):
5471 	    def test_success(self):
5472 	        self.assert_message_from_report(
5473 	            (
5474 	                "Booth configuration '/some/file' is outside of supported "
5475 	                "booth config directory '/booth/conf/dir/', ignoring the file"
5476 	            ),
5477 	            reports.BoothUnsupportedFileLocation(
5478 	                "/some/file",
5479 	                "/booth/conf/dir/",
5480 	                file_type_codes.BOOTH_CONFIG,
5481 	            ),
5482 	        )
5483 	
5484 	
5485 	class BoothDaemonStatusError(NameBuildTest):
5486 	    def test_success(self):
5487 	        self.assert_message_from_report(
5488 	            "unable to get status of booth daemon: some reason",
5489 	            reports.BoothDaemonStatusError("some reason"),
5490 	        )
5491 	
5492 	
5493 	class BoothTicketStatusError(NameBuildTest):
5494 	    def test_minimal(self):
5495 	        self.assert_message_from_report(
5496 	            "unable to get status of booth tickets",
5497 	            reports.BoothTicketStatusError(),
5498 	        )
5499 	
5500 	    def test_all(self):
5501 	        self.assert_message_from_report(
5502 	            "unable to get status of booth tickets: some reason",
5503 	            reports.BoothTicketStatusError(reason="some reason"),
5504 	        )
5505 	
5506 	
5507 	class BoothPeersStatusError(NameBuildTest):
5508 	    def test_minimal(self):
5509 	        self.assert_message_from_report(
5510 	            "unable to get status of booth peers",
5511 	            reports.BoothPeersStatusError(),
5512 	        )
5513 	
5514 	    def test_all(self):
5515 	        self.assert_message_from_report(
5516 	            "unable to get status of booth peers: some reason",
5517 	            reports.BoothPeersStatusError(reason="some reason"),
5518 	        )
5519 	
5520 	
5521 	class BoothCannotDetermineLocalSiteIp(NameBuildTest):
5522 	    def test_success(self):
5523 	        self.assert_message_from_report(
5524 	            "cannot determine local site ip, please specify site parameter",
5525 	            reports.BoothCannotDetermineLocalSiteIp(),
5526 	        )
5527 	
5528 	
5529 	class BoothTicketOperationFailed(NameBuildTest):
5530 	    def test_success(self):
5531 	        self.assert_message_from_report(
5532 	            (
5533 	                "unable to operation booth ticket 'ticket_name'"
5534 	                " for site 'site_ip', reason: reason"
5535 	            ),
5536 	            reports.BoothTicketOperationFailed(
5537 	                "operation", "reason", "site_ip", "ticket_name"
5538 	            ),
5539 	        )
5540 	
5541 	    def test_no_site_ip(self):
5542 	        self.assert_message_from_report(
5543 	            ("unable to operation booth ticket 'ticket_name', reason: reason"),
5544 	            reports.BoothTicketOperationFailed(
5545 	                "operation", "reason", None, "ticket_name"
5546 	            ),
5547 	        )
5548 	
5549 	
5550 	class BoothTicketChangingState(NameBuildTest):
5551 	    def test_success(self):
5552 	        self.assert_message_from_report(
5553 	            "Changing state of ticket 'name' to standby",
5554 	            reports.BoothTicketChangingState("name", "standby"),
5555 	        )
5556 	
5557 	
5558 	class BoothTicketCleanup(NameBuildTest):
5559 	    def test_success(self):
5560 	        self.assert_message_from_report(
5561 	            "Cleaning up ticket 'name' from CIB",
5562 	            reports.BoothTicketCleanup("name"),
5563 	        )
5564 	
5565 	
5566 	# TODO: remove, use ADD_REMOVE reports
5567 	class TagAddRemoveIdsDuplication(NameBuildTest):
5568 	    def test_message_add(self):
5569 	        self.assert_message_from_report(
5570 	            "Ids to add must be unique, duplicate ids: 'dup1', 'dup2'",
5571 	            reports.TagAddRemoveIdsDuplication(
5572 	                duplicate_ids_list=["dup2", "dup1"],
5573 	            ),
5574 	        )
5575 	
5576 	    def test_message_remove(self):
5577 	        self.assert_message_from_report(
5578 	            "Ids to remove must be unique, duplicate ids: 'dup1', 'dup2'",
5579 	            reports.TagAddRemoveIdsDuplication(
5580 	                duplicate_ids_list=["dup2", "dup1"],
5581 	                add_or_not_remove=False,
5582 	            ),
5583 	        )
5584 	
5585 	
5586 	# TODO: remove, use ADD_REMOVE reports
5587 	class TagAdjacentReferenceIdNotInTheTag(NameBuildTest):
5588 	    def test_message(self):
5589 	        self.assert_message_from_report(
5590 	            (
5591 	                "There is no reference id 'adj_id' in the tag 'tag_id', cannot "
5592 	                "put reference ids next to it in the tag"
5593 	            ),
5594 	            reports.TagAdjacentReferenceIdNotInTheTag("adj_id", "tag_id"),
5595 	        )
5596 	
5597 	
5598 	# TODO: remove, use ADD_REMOVE reports
5599 	class TagCannotAddAndRemoveIdsAtTheSameTime(NameBuildTest):
5600 	    def test_message_one_item(self):
5601 	        self.assert_message_from_report(
5602 	            "Ids cannot be added and removed at the same time: 'id1'",
5603 	            reports.TagCannotAddAndRemoveIdsAtTheSameTime(["id1"]),
5604 	        )
5605 	
5606 	    def test_message_more_items(self):
5607 	        self.assert_message_from_report(
5608 	            (
5609 	                "Ids cannot be added and removed at the same time: 'id1', "
5610 	                "'id2', 'id3'"
5611 	            ),
5612 	            reports.TagCannotAddAndRemoveIdsAtTheSameTime(
5613 	                ["id3", "id2", "id1"],
5614 	            ),
5615 	        )
5616 	
5617 	
5618 	# TODO: remove, use ADD_REMOVE reports
5619 	class TagCannotAddReferenceIdsAlreadyInTheTag(NameBuildTest):
5620 	    def test_message_singular(self):
5621 	        self.assert_message_from_report(
5622 	            "Cannot add reference id already in the tag 'tag_id': 'id1'",
5623 	            reports.TagCannotAddReferenceIdsAlreadyInTheTag(
5624 	                "tag_id",
5625 	                ["id1"],
5626 	            ),
5627 	        )
5628 	
5629 	    def test_message_plural(self):
5630 	        self.assert_message_from_report(
5631 	            "Cannot add reference ids already in the tag 'TAG': 'id1', 'id2'",
5632 	            reports.TagCannotAddReferenceIdsAlreadyInTheTag(
5633 	                "TAG",
5634 	                ["id2", "id1"],
5635 	            ),
5636 	        )
5637 	
5638 	
5639 	class TagCannotContainItself(NameBuildTest):
5640 	    def test_message(self):
5641 	        self.assert_message_from_report(
5642 	            "Tag cannot contain itself", reports.TagCannotContainItself()
5643 	        )
5644 	
5645 	
5646 	class TagCannotCreateEmptyTagNoIdsSpecified(NameBuildTest):
5647 	    def test_message(self):
5648 	        self.assert_message_from_report(
5649 	            "Cannot create empty tag, no resource ids specified",
5650 	            reports.TagCannotCreateEmptyTagNoIdsSpecified(),
5651 	        )
5652 	
5653 	
5654 	# TODO: remove, use ADD_REMOVE reports
5655 	class TagCannotPutIdNextToItself(NameBuildTest):
5656 	    def test_message(self):
5657 	        self.assert_message_from_report(
5658 	            "Cannot put id 'some_id' next to itself.",
5659 	            reports.TagCannotPutIdNextToItself("some_id"),
5660 	        )
5661 	
5662 	
5663 	# TODO: remove, use ADD_REMOVE reports
5664 	class TagCannotRemoveAdjacentId(NameBuildTest):
5665 	    def test_message(self):
5666 	        self.assert_message_from_report(
5667 	            "Cannot remove id 'some_id' next to which ids are being added",
5668 	            reports.TagCannotRemoveAdjacentId("some_id"),
5669 	        )
5670 	
5671 	
5672 	# TODO: remove, use ADD_REMOVE reports
5673 	class TagCannotRemoveReferencesWithoutRemovingTag(NameBuildTest):
5674 	    def test_message(self):
5675 	        self.assert_message_from_report(
5676 	            "There would be no references left in the tag 'tag-id'",
5677 	            reports.TagCannotRemoveReferencesWithoutRemovingTag("tag-id"),
5678 	        )
5679 	
5680 	
5681 	class TagCannotRemoveTagReferencedInConstraints(NameBuildTest):
5682 	    def test_message_singular(self):
5683 	        self.assert_message_from_report(
5684 	            "Tag 'tag1' cannot be removed because it is referenced in "
5685 	            "constraint 'constraint-id-1'",
5686 	            reports.TagCannotRemoveTagReferencedInConstraints(
5687 	                "tag1",
5688 	                ["constraint-id-1"],
5689 	            ),
5690 	        )
5691 	
5692 	    def test_message_plural(self):
5693 	        self.assert_message_from_report(
5694 	            "Tag 'tag2' cannot be removed because it is referenced in "
5695 	            "constraints 'constraint-id-1', 'constraint-id-2'",
5696 	            reports.TagCannotRemoveTagReferencedInConstraints(
5697 	                "tag2",
5698 	                ["constraint-id-2", "constraint-id-1"],
5699 	            ),
5700 	        )
5701 	
5702 	
5703 	class TagCannotRemoveTagsNoTagsSpecified(NameBuildTest):
5704 	    def test_message(self):
5705 	        self.assert_message_from_report(
5706 	            "Cannot remove tags, no tags to remove specified",
5707 	            reports.TagCannotRemoveTagsNoTagsSpecified(),
5708 	        )
5709 	
5710 	
5711 	# TODO: remove, use ADD_REMOVE reports
5712 	class TagCannotSpecifyAdjacentIdWithoutIdsToAdd(NameBuildTest):
5713 	    def test_message(self):
5714 	        self.assert_message_from_report(
5715 	            "Cannot specify adjacent id 'some-id' without ids to add",
5716 	            reports.TagCannotSpecifyAdjacentIdWithoutIdsToAdd("some-id"),
5717 	        )
5718 	
5719 	
5720 	# TODO: remove, use ADD_REMOVE reports
5721 	class TagCannotUpdateTagNoIdsSpecified(NameBuildTest):
5722 	    def test_message(self):
5723 	        self.assert_message_from_report(
5724 	            "Cannot update tag, no ids to be added or removed specified",
5725 	            reports.TagCannotUpdateTagNoIdsSpecified(),
5726 	        )
5727 	
5728 	
5729 	# TODO: remove, use ADD_REMOVE reports
5730 	class TagIdsNotInTheTag(NameBuildTest):
5731 	    def test_message_singular(self):
5732 	        self.assert_message_from_report(
5733 	            "Tag 'tag-id' does not contain id: 'a'",
5734 	            reports.TagIdsNotInTheTag("tag-id", ["a"]),
5735 	        )
5736 	
5737 	    def test_message_plural(self):
5738 	        self.assert_message_from_report(
5739 	            "Tag 'tag-id' does not contain ids: 'a', 'b'",
5740 	            reports.TagIdsNotInTheTag("tag-id", ["b", "a"]),
5741 	        )
5742 	
5743 	
5744 	class RuleInEffectStatusDetectionNotSupported(NameBuildTest):
5745 	    def test_success(self):
5746 	        self.assert_message_from_report(
5747 	            (
5748 	                "crm_rule is not available, therefore expired parts of "
5749 	                "configuration may not be detected. Consider upgrading pacemaker."
5750 	            ),
5751 	            reports.RuleInEffectStatusDetectionNotSupported(),
5752 	        )
5753 	
5754 	
5755 	class RuleExpressionOptionsDuplication(NameBuildTest):
5756 	    def test_success(self):
5757 	        self.assert_message_from_report(
5758 	            "Duplicate options in a single (sub)expression: 'key', 'name'",
5759 	            reports.RuleExpressionOptionsDuplication(["name", "key"]),
5760 	        )
5761 	
5762 	
5763 	class RuleExpressionSinceGreaterThanUntil(NameBuildTest):
5764 	    def test_success(self):
5765 	        self.assert_message_from_report(
5766 	            "Since '987' is not sooner than until '654'",
5767 	            reports.RuleExpressionSinceGreaterThanUntil("987", "654"),
5768 	        )
5769 	
5770 	
5771 	class RuleExpressionParseError(NameBuildTest):
5772 	    def test_success(self):
5773 	        self.assert_message_from_report(
5774 	            "'resource dummy op monitor' is not a valid rule expression, "
5775 	            "parse error near or after line 1 column 16",
5776 	            reports.RuleExpressionParseError(
5777 	                "resource dummy op monitor",
5778 	                "Expected end of text",
5779 	                "resource dummy op monitor",
5780 	                1,
5781 	                16,
5782 	                15,
5783 	            ),
5784 	        )
5785 	
5786 	
5787 	class RuleExpressionNotAllowed(NameBuildTest):
5788 	    def test_op(self):
5789 	        self.assert_message_from_report(
5790 	            "Keyword 'op' cannot be used in a rule in this command",
5791 	            reports.RuleExpressionNotAllowed(
5792 	                CibRuleExpressionType.OP_EXPRESSION
5793 	            ),
5794 	        )
5795 	
5796 	    def test_rsc(self):
5797 	        self.assert_message_from_report(
5798 	            "Keyword 'resource' cannot be used in a rule in this command",
5799 	            reports.RuleExpressionNotAllowed(
5800 	                CibRuleExpressionType.RSC_EXPRESSION
5801 	            ),
5802 	        )
5803 	
5804 	    def test_node_attr(self):
5805 	        self.assert_message_from_report(
5806 	            "Keywords 'defined', 'not_defined', 'eq', 'ne', 'gte', 'gt', "
5807 	            "'lte' and 'lt' cannot be used in a rule in this command",
5808 	            reports.RuleExpressionNotAllowed(CibRuleExpressionType.EXPRESSION),
5809 	        )
5810 	
5811 	
5812 	class RuleNoExpressionSpecified(NameBuildTest):
5813 	    def test_success(self):
5814 	        self.assert_message_from_report(
5815 	            "No rule expression was specified",
5816 	            reports.RuleNoExpressionSpecified(),
5817 	        )
5818 	
5819 	
5820 	class CibNvsetAmbiguousProvideNvsetId(NameBuildTest):
5821 	    def test_success(self):
5822 	        self.assert_message_from_report(
5823 	            "Several options sets exist, please specify an option set ID",
5824 	            reports.CibNvsetAmbiguousProvideNvsetId(
5825 	                const.PCS_COMMAND_RESOURCE_DEFAULTS_UPDATE
5826 	            ),
5827 	        )
5828 	
5829 	
5830 	class AddRemoveItemsNotSpecified(NameBuildTest):
5831 	    def test_message(self):
5832 	        self.assert_message_from_report(
5833 	            (
5834 	                "Cannot modify stonith resource 'container-id', no devices to "
5835 	                "add or remove specified"
5836 	            ),
5837 	            reports.AddRemoveItemsNotSpecified(
5838 	                const.ADD_REMOVE_CONTAINER_TYPE_STONITH_RESOURCE,
5839 	                const.ADD_REMOVE_ITEM_TYPE_DEVICE,
5840 	                "container-id",
5841 	            ),
5842 	        )
5843 	
5844 	    def test_message_without_container(self):
5845 	        self.assert_message_from_report(
5846 	            "No devices to add or remove specified",
5847 	            reports.AddRemoveItemsNotSpecified(
5848 	                container_type=None,
5849 	                item_type=const.ADD_REMOVE_ITEM_TYPE_DEVICE,
5850 	                container_id=None,
5851 	            ),
5852 	        )
5853 	
5854 	
5855 	class AddRemoveItemsDuplication(NameBuildTest):
5856 	    def test_message(self):
5857 	        self.assert_message_from_report(
5858 	            (
5859 	                "Devices to add or remove must be unique, duplicate devices: "
5860 	                "'dup1', 'dup2'"
5861 	            ),
5862 	            reports.AddRemoveItemsDuplication(
5863 	                const.ADD_REMOVE_CONTAINER_TYPE_STONITH_RESOURCE,
5864 	                const.ADD_REMOVE_ITEM_TYPE_DEVICE,
5865 	                "container-id",
5866 	                ["dup2", "dup1"],
5867 	            ),
5868 	        )
5869 	
5870 	
5871 	class AddRemoveCannotAddItemsAlreadyInTheContainer(NameBuildTest):
5872 	    def test_message_plural(self):
5873 	        self.assert_message_from_report(
5874 	            "Cannot add devices 'i1', 'i2', they are already present in stonith"
5875 	            " resource 'container-id'",
5876 	            reports.AddRemoveCannotAddItemsAlreadyInTheContainer(
5877 	                const.ADD_REMOVE_CONTAINER_TYPE_STONITH_RESOURCE,
5878 	                const.ADD_REMOVE_ITEM_TYPE_DEVICE,
5879 	                "container-id",
5880 	                ["i2", "i1"],
5881 	            ),
5882 	        )
5883 	
5884 	    def test_message_singular(self):
5885 	        self.assert_message_from_report(
5886 	            "Cannot add device 'i1', it is already present in stonith resource "
5887 	            "'container-id'",
5888 	            reports.AddRemoveCannotAddItemsAlreadyInTheContainer(
5889 	                const.ADD_REMOVE_CONTAINER_TYPE_STONITH_RESOURCE,
5890 	                const.ADD_REMOVE_ITEM_TYPE_DEVICE,
5891 	                "container-id",
5892 	                ["i1"],
5893 	            ),
5894 	        )
5895 	
5896 	
5897 	class AddRemoveCannotRemoveItemsNotInTheContainer(NameBuildTest):
5898 	    def test_message_plural(self):
5899 	        self.assert_message_from_report(
5900 	            (
5901 	                "Cannot remove devices 'i1', 'i2', they are not present in "
5902 	                "stonith resource 'container-id'"
5903 	            ),
5904 	            reports.AddRemoveCannotRemoveItemsNotInTheContainer(
5905 	                const.ADD_REMOVE_CONTAINER_TYPE_STONITH_RESOURCE,
5906 	                const.ADD_REMOVE_ITEM_TYPE_DEVICE,
5907 	                "container-id",
5908 	                ["i2", "i1"],
5909 	            ),
5910 	        )
5911 	
5912 	    def test_message_singular(self):
5913 	        self.assert_message_from_report(
5914 	            (
5915 	                "Cannot remove device 'i1', it is not present in "
5916 	                "stonith resource 'container-id'"
5917 	            ),
5918 	            reports.AddRemoveCannotRemoveItemsNotInTheContainer(
5919 	                const.ADD_REMOVE_CONTAINER_TYPE_STONITH_RESOURCE,
5920 	                const.ADD_REMOVE_ITEM_TYPE_DEVICE,
5921 	                "container-id",
5922 	                ["i1"],
5923 	            ),
5924 	        )
5925 	
5926 	
5927 	class AddRemoveCannotAddAndRemoveItemsAtTheSameTime(NameBuildTest):
5928 	    def test_message_plural(self):
5929 	        self.assert_message_from_report(
5930 	            "Devices cannot be added and removed at the same time: 'i1', 'i2'",
5931 	            reports.AddRemoveCannotAddAndRemoveItemsAtTheSameTime(
5932 	                const.ADD_REMOVE_CONTAINER_TYPE_STONITH_RESOURCE,
5933 	                const.ADD_REMOVE_ITEM_TYPE_DEVICE,
5934 	                "container-id",
5935 	                ["i2", "i1"],
5936 	            ),
5937 	        )
5938 	
5939 	    def test_message_singular(self):
5940 	        self.assert_message_from_report(
5941 	            "Device cannot be added and removed at the same time: 'i1'",
5942 	            reports.AddRemoveCannotAddAndRemoveItemsAtTheSameTime(
5943 	                const.ADD_REMOVE_CONTAINER_TYPE_STONITH_RESOURCE,
5944 	                const.ADD_REMOVE_ITEM_TYPE_DEVICE,
5945 	                "container-id",
5946 	                ["i1"],
5947 	            ),
5948 	        )
5949 	
5950 	
5951 	class AddRemoveCannotRemoveAllItemsFromTheContainer(NameBuildTest):
5952 	    def test_message(self):
5953 	        self.assert_message_from_report(
5954 	            "Cannot remove all devices from stonith resource 'container-id'",
5955 	            reports.AddRemoveCannotRemoveAllItemsFromTheContainer(
5956 	                const.ADD_REMOVE_CONTAINER_TYPE_STONITH_RESOURCE,
5957 	                const.ADD_REMOVE_ITEM_TYPE_DEVICE,
5958 	                "container-id",
5959 	                ["i1", "i2"],
5960 	            ),
5961 	        )
5962 	
5963 	
5964 	class AddRemoveAdjacentItemNotInTheContainer(NameBuildTest):
5965 	    def test_message(self):
5966 	        self.assert_message_from_report(
5967 	            (
5968 	                "There is no device 'adjacent-item-id' in the stonith resource "
5969 	                "'container-id', cannot add devices next to it"
5970 	            ),
5971 	            reports.AddRemoveAdjacentItemNotInTheContainer(
5972 	                const.ADD_REMOVE_CONTAINER_TYPE_STONITH_RESOURCE,
5973 	                const.ADD_REMOVE_ITEM_TYPE_DEVICE,
5974 	                "container-id",
5975 	                "adjacent-item-id",
5976 	            ),
5977 	        )
5978 	
5979 	
5980 	class AddRemoveCannotPutItemNextToItself(NameBuildTest):
5981 	    def test_message(self):
5982 	        self.assert_message_from_report(
5983 	            "Cannot put device 'adjacent-item-id' next to itself",
5984 	            reports.AddRemoveCannotPutItemNextToItself(
5985 	                const.ADD_REMOVE_CONTAINER_TYPE_STONITH_RESOURCE,
5986 	                const.ADD_REMOVE_ITEM_TYPE_DEVICE,
5987 	                "container-id",
5988 	                "adjacent-item-id",
5989 	            ),
5990 	        )
5991 	
5992 	
5993 	class AddRemoveCannotSpecifyAdjacentItemWithoutItemsToAdd(NameBuildTest):
5994 	    def test_message(self):
5995 	        self.assert_message_from_report(
5996 	            (
5997 	                "Cannot specify adjacent device 'adjacent-item-id' without "
5998 	                "devices to add"
5999 	            ),
6000 	            reports.AddRemoveCannotSpecifyAdjacentItemWithoutItemsToAdd(
6001 	                const.ADD_REMOVE_CONTAINER_TYPE_STONITH_RESOURCE,
6002 	                const.ADD_REMOVE_ITEM_TYPE_DEVICE,
6003 	                "container-id",
6004 	                "adjacent-item-id",
6005 	            ),
6006 	        )
6007 	
6008 	
6009 	class CloningStonithResourcesHasNoEffect(NameBuildTest):
6010 	    def test_singular_without_group_id(self):
6011 	        self.assert_message_from_report(
6012 	            (
6013 	                "No need to clone stonith resource 'fence1', any node can use "
6014 	                "a stonith resource (unless specifically banned) regardless of "
6015 	                "whether the stonith resource is running on that node or not"
6016 	            ),
6017 	            reports.CloningStonithResourcesHasNoEffect(["fence1"]),
6018 	        )
6019 	
6020 	    def test_plural_with_group_id(self):
6021 	        self.assert_message_from_report(
6022 	            (
6023 	                "Group 'StonithGroup' contains stonith resources. No need to "
6024 	                "clone stonith resources 'fence1', 'fence2', any node can use "
6025 	                "a stonith resource (unless specifically banned) regardless of "
6026 	                "whether the stonith resource is running on that node or not"
6027 	            ),
6028 	            reports.CloningStonithResourcesHasNoEffect(
6029 	                ["fence1", "fence2"], "StonithGroup"
6030 	            ),
6031 	        )
6032 	
6033 	
6034 	class CommandInvalidPayload(NameBuildTest):
6035 	    def test_all(self):
6036 	        reason = "a reason"
6037 	        self.assert_message_from_report(
6038 	            f"Invalid command payload: {reason}",
6039 	            reports.CommandInvalidPayload(reason),
6040 	        )
6041 	
6042 	
6043 	class CommandUnknown(NameBuildTest):
6044 	    def test_all(self):
6045 	        cmd = "a cmd"
6046 	        self.assert_message_from_report(
6047 	            f"Unknown command '{cmd}'",
6048 	            reports.CommandUnknown(cmd),
6049 	        )
6050 	
6051 	
6052 	class NotAuthorized(NameBuildTest):
6053 	    def test_all(self):
6054 	        self.assert_message_from_report(
6055 	            "Current user is not authorized for this operation",
6056 	            reports.NotAuthorized(),
6057 	        )
6058 	
6059 	
6060 	class AgentSelfValidationResult(NameBuildTest):
6061 	    def test_message(self):
6062 	        lines = [f"line #{i}" for i in range(3)]
6063 	        self.assert_message_from_report(
6064 	            "Validation result from agent:\n  {}".format("\n  ".join(lines)),
6065 	            reports.AgentSelfValidationResult("\n".join(lines)),
6066 	        )
6067 	
6068 	
6069 	class AgentSelfValidationInvalidData(NameBuildTest):
6070 	    def test_message(self):
6071 	        reason = "not xml"
6072 	        self.assert_message_from_report(
6073 	            f"Invalid validation data from agent: {reason}",
6074 	            reports.AgentSelfValidationInvalidData(reason),
6075 	        )
6076 	
6077 	
6078 	class AgentSelfValidationSkippedUpdatedResourceMisconfigured(NameBuildTest):
6079 	    def test_message(self):
6080 	        lines = [f"line #{i}" for i in range(3)]
6081 	        self.assert_message_from_report(
6082 	            (
6083 	                "The resource was misconfigured before the update, therefore "
6084 	                "agent self-validation will not be run for the updated "
6085 	                "configuration. Validation output of the original "
6086 	                "configuration:\n  {}"
6087 	            ).format("\n  ".join(lines)),
6088 	            reports.AgentSelfValidationSkippedUpdatedResourceMisconfigured(
6089 	                "\n".join(lines)
6090 	            ),
6091 	        )
6092 	
6093 	
6094 	class AgentSelfValidationAutoOnWithWarnings(NameBuildTest):
6095 	    def test_message(self):
6096 	        self.assert_message_from_report(
6097 	            (
6098 	                "Validating resource options using the resource agent itself "
6099 	                "is enabled by default and produces warnings. In a future "
6100 	                "version, this might be changed to errors. Enable "
6101 	                "agent validation to switch to the future behavior."
6102 	            ),
6103 	            reports.AgentSelfValidationAutoOnWithWarnings(),
6104 	        )
6105 	
6106 	
6107 	class ResourceCloneIncompatibleMetaAttributes(NameBuildTest):
6108 	    def test_with_provider(self):
6109 	        attr = "attr_name"
6110 	        self.assert_message_from_report(
6111 	            f"Clone option '{attr}' is not compatible with 'standard:provider:type' resource agent",
6112 	            reports.ResourceCloneIncompatibleMetaAttributes(
6113 	                attr, ResourceAgentNameDto("standard", "provider", "type")
6114 	            ),
6115 	        )
6116 	
6117 	    def test_without_provider(self):
6118 	        attr = "attr_name"
6119 	        self.assert_message_from_report(
6120 	            f"Clone option '{attr}' is not compatible with 'standard:type' resource agent",
6121 	            reports.ResourceCloneIncompatibleMetaAttributes(
6122 	                attr, ResourceAgentNameDto("standard", None, "type")
6123 	            ),
6124 	        )
6125 	
6126 	    def test_resource_id(self):
6127 	        attr = "attr_name"
6128 	        res_id = "resource_id"
6129 	        self.assert_message_from_report(
6130 	            (
6131 	                f"Clone option '{attr}' is not compatible with 'standard:type' "
6132 	                f"resource agent of resource '{res_id}'"
6133 	            ),
6134 	            reports.ResourceCloneIncompatibleMetaAttributes(
6135 	                attr,
6136 	                ResourceAgentNameDto("standard", None, "type"),
6137 	                resource_id=res_id,
6138 	            ),
6139 	        )
6140 	
6141 	    def test_group_id(self):
6142 	        attr = "attr_name"
6143 	        res_id = "resource id"
6144 	        group_id = "group id"
6145 	        self.assert_message_from_report(
6146 	            (
6147 	                f"Clone option '{attr}' is not compatible with 'standard:type' "
6148 	                f"resource agent of resource '{res_id}' in group '{group_id}'"
6149 	            ),
6150 	            reports.ResourceCloneIncompatibleMetaAttributes(
6151 	                attr,
6152 	                ResourceAgentNameDto("standard", None, "type"),
6153 	                resource_id=res_id,
6154 	                group_id=group_id,
6155 	            ),
6156 	        )
6157 	
6158 	
6159 	class BoothAuthfileNotUsed(NameBuildTest):
6160 	    def test_message(self):
6161 	        self.assert_message_from_report(
6162 	            "Booth authfile is not enabled",
6163 	            reports.BoothAuthfileNotUsed("instance name"),
6164 	        )
6165 	
6166 	
6167 	class BoothUnsupportedOptionEnableAuthfile(NameBuildTest):
6168 	    def test_message(self):
6169 	        self.assert_message_from_report(
6170 	            "Unsupported option 'enable-authfile' is set in booth configuration",
6171 	            reports.BoothUnsupportedOptionEnableAuthfile("instance name"),
6172 	        )
6173 	
6174 	
6175 	class CannotCreateDefaultClusterPropertySet(NameBuildTest):
6176 	    def test_all(self):
6177 	        self.assert_message_from_report(
6178 	            (
6179 	                "Cannot create default cluster_property_set element, ID "
6180 	                "'cib-bootstrap-options' already exists. Find elements with the"
6181 	                " ID and remove them from cluster configuration."
6182 	            ),
6183 	            reports.CannotCreateDefaultClusterPropertySet(
6184 	                "cib-bootstrap-options"
6185 	            ),
6186 	        )
6187 	
6188 	
6189 	class ClusterStatusBundleMemberIdAsImplicit(NameBuildTest):
6190 	    def test_one(self):
6191 	        self.assert_message_from_report(
6192 	            (
6193 	                "Skipping bundle 'resource-bundle': resource 'resource' has "
6194 	                "the same id as some of the implicit bundle resources"
6195 	            ),
6196 	            reports.ClusterStatusBundleMemberIdAsImplicit(
6197 	                "resource-bundle", ["resource"]
6198 	            ),
6199 	        )
6200 	
6201 	    def test_multiple(self):
6202 	        self.assert_message_from_report(
6203 	            (
6204 	                "Skipping bundle 'resource-bundle': resources 'resource-0', "
6205 	                "'resource-1' have the same id as some of the implicit bundle "
6206 	                "resources"
6207 	            ),
6208 	            reports.ClusterStatusBundleMemberIdAsImplicit(
6209 	                "resource-bundle", ["resource-0", "resource-1"]
6210 	            ),
6211 	        )
6212 	
6213 	
6214 	class ResourceWaitDeprecated(NameBuildTest):
6215 	    def test_success(self):
6216 	        self.assert_message_from_report(
6217 	            (
6218 	                "Ability of this command to accept 'wait' argument is "
6219 	                "deprecated and will be removed in a future release."
6220 	            ),
6221 	            reports.ResourceWaitDeprecated(),
6222 	        )
6223 	
6224 	
6225 	class CommandArgumentTypeMismatch(NameBuildTest):
6226 	    def test_message(self) -> str:
6227 	        self.assert_message_from_report(
6228 	            "This command does not accept entity type.",
6229 	            reports.CommandArgumentTypeMismatch(
6230 	                "entity type", "pcs stonith create"
6231 	            ),
6232 	        )
6233 	
6234 	
6235 	class ResourceRestartError(NameBuildTest):
6236 	    def test_message(self) -> str:
6237 	        self.assert_message_from_report(
6238 	            "Unable to restart resource 'resourceId':\nerror description",
6239 	            reports.ResourceRestartError("error description", "resourceId"),
6240 	        )
6241 	
6242 	
6243 	class ResourceRestartNodeIsForMultiinstanceOnly(NameBuildTest):
6244 	    def test_message(self) -> str:
6245 	        self.assert_message_from_report(
6246 	            (
6247 	                "Can only restart on a specific node for a clone or bundle, "
6248 	                "'resourceId' is a resource"
6249 	            ),
6250 	            reports.ResourceRestartNodeIsForMultiinstanceOnly(
6251 	                "resourceId", "primitive", "node01"
6252 	            ),
6253 	        )
6254 	
6255 	
6256 	class ResourceRestartUsingParentRersource(NameBuildTest):
6257 	    def test_message(self) -> str:
6258 	        self.assert_message_from_report(
6259 	            (
6260 	                "Restarting 'parentId' instead...\n"
6261 	                "(If a resource is a clone or bundle, you must use the clone "
6262 	                "or bundle instead)"
6263 	            ),
6264 	            reports.ResourceRestartUsingParentRersource(
6265 	                "resourceId", "parentId"
6266 	            ),
6267 	        )
6268 	
6269 	
6270 	class ClusterOptionsMetadataNotSupported(NameBuildTest):
6271 	    def test_success(self):
6272 	        self.assert_message_from_report(
6273 	            (
6274 	                "Cluster options metadata are not supported, please upgrade "
6275 	                "pacemaker"
6276 	            ),
6277 	            reports.ClusterOptionsMetadataNotSupported(),
6278 	        )
6279 	
6280 	
6281 	class StoppingResources(NameBuildTest):
6282 	    def test_one_resource(self):
6283 	        self.assert_message_from_report(
6284 	            "Stopping resource 'resourceId'",
6285 	            reports.StoppingResources(["resourceId"]),
6286 	        )
6287 	
6288 	    def test_multiple_resources(self):
6289 	        self.assert_message_from_report(
6290 	            "Stopping resources 'resourceId1', 'resourceId2'",
6291 	            reports.StoppingResources(["resourceId1", "resourceId2"]),
6292 	        )
6293 	
6294 	
6295 	class StoppedResourcesBeforeDeleteCheckSkipped(NameBuildTest):
6296 	    def test_one_resource(self):
6297 	        self.assert_message_from_report(
6298 	            (
6299 	                "Not checking if resource 'A' is stopped before deletion. "
6300 	                "Deleting unstopped resources may result in orphaned resources "
6301 	                "being present in the cluster."
6302 	            ),
6303 	            reports.StoppedResourcesBeforeDeleteCheckSkipped(["A"]),
6304 	        )
6305 	
6306 	    def test_multiple_resources(self):
6307 	        self.assert_message_from_report(
6308 	            (
6309 	                "Not checking if resources 'A', 'B' are stopped before "
6310 	                "deletion. Deleting unstopped resources may result in orphaned "
6311 	                "resources being present in the cluster."
6312 	            ),
6313 	            reports.StoppedResourcesBeforeDeleteCheckSkipped(["A", "B"]),
6314 	        )
6315 	
6316 	    def test_with_reason(self):
6317 	        self.assert_message_from_report(
6318 	            (
6319 	                "Not checking if resource 'A' is stopped before deletion "
6320 	                "because the command does not run on a live cluster. Deleting "
6321 	                "unstopped resources may result in orphaned resources being "
6322 	                "present in the cluster."
6323 	            ),
6324 	            reports.StoppedResourcesBeforeDeleteCheckSkipped(
6325 	                ["A"], reports.const.REASON_NOT_LIVE_CIB
6326 	            ),
6327 	        )
6328 	
6329 	
6330 	class CannotRemoveResourcesNotStopped(NameBuildTest):
6331 	    def test_one_resource(self) -> str:
6332 	        self.assert_message_from_report(
6333 	            (
6334 	                "Resource 'resourceId' is not stopped, removing unstopped "
6335 	                "resources can lead to orphaned resources being present in the "
6336 	                "cluster."
6337 	            ),
6338 	            reports.CannotRemoveResourcesNotStopped(["resourceId"]),
6339 	        )
6340 	
6341 	    def test_multiple_resources(self) -> str:
6342 	        self.assert_message_from_report(
6343 	            (
6344 	                "Resources 'resourceId1', 'resourceId2' are not stopped, "
6345 	                "removing unstopped resources can lead to orphaned resources "
6346 	                "being present in the cluster."
6347 	            ),
6348 	            reports.CannotRemoveResourcesNotStopped(
6349 	                ["resourceId1", "resourceId2"]
6350 	            ),
6351 	        )
6352 	
6353 	
6354 	class DlmClusterRenameNeeded(NameBuildTest):
6355 	    def test_success(self):
6356 	        self.assert_message_from_report(
6357 	            (
6358 	                "The DLM cluster name in the shared volume groups metadata "
6359 	                "must be updated to reflect the name of the cluster so that "
6360 	                "the volume groups can start"
6361 	            ),
6362 	            reports.DlmClusterRenameNeeded(),
6363 	        )
6364 	
6365 	
6366 	class Gfs2LockTableRenameNeeded(NameBuildTest):
6367 	    def test_success(self):
6368 	        self.assert_message_from_report(
6369 	            (
6370 	                "The lock table name on each GFS2 filesystem must be updated "
6371 	                "to reflect the name of the cluster so that the filesystems "
6372 	                "can be mounted"
6373 	            ),
6374 	            reports.Gfs2LockTableRenameNeeded(),
6375 	        )
6376 	
6377 	
6378 	class CibClusterNameRemovalStarted(NameBuildTest):
6379 	    def test_success(self):
6380 	        self.assert_message_from_report(
6381 	            "Removing CIB cluster name property on nodes...",
6382 	            reports.CibClusterNameRemovalStarted(),
6383 	        )
6384 	
6385 	
6386 	class CibClusterNameRemoved(NameBuildTest):
6387 	    def test_success(self):
6388 	        self.assert_message_from_report(
6389 	            "node: Succeeded", reports.CibClusterNameRemoved("node")
6390 	        )
6391 	
6392 	
6393 	class CibClusterNameRemovalFailed(NameBuildTest):
6394 	    def test_success(self):
6395 	        self.assert_message_from_report(
6396 	            "CIB cluster name property removal failed: reason",
6397 	            reports.CibClusterNameRemovalFailed("reason"),
6398 	        )
6399 	
6400 	
6401 	class PacemakerRunning(NameBuildTest):
6402 	    def test_success(self):
6403 	        self.assert_message_from_report(
6404 	            "Pacemaker is running", reports.PacemakerRunning()
6405 	        )
6406 	
6407 	
6408 	class CibXmlMissing(NameBuildTest):
6409 	    def test_success(self):
6410 	        self.assert_message_from_report(
6411 	            "CIB XML file cannot be found", reports.CibXmlMissing()
6412 	        )
6413 	
6414 	
6415 	class CibNodeRenameElementUpdated(NameBuildTest):
6416 	    def test_location_constraint(self):
6417 	        self.assert_message_from_report(
6418 	            "Location constraint 'loc-1': node updated from 'node1' to 'node2'",
6419 	            reports.CibNodeRenameElementUpdated(
6420 	                "Location constraint", "loc-1", "node", "node1", "node2"
6421 	            ),
6422 	        )
6423 	
6424 	    def test_rule_expression(self):
6425 	        self.assert_message_from_report(
6426 	            "Rule 'rule-1': #uname expression updated from 'node1' to 'node2'",
6427 	            reports.CibNodeRenameElementUpdated(
6428 	                "Rule", "rule-1", "#uname expression", "node1", "node2"
6429 	            ),
6430 	        )
6431 	
6432 	    def test_fencing_level(self):
6433 	        self.assert_message_from_report(
6434 	            "Fencing level '1': target updated from 'node1' to 'node2'",
6435 	            reports.CibNodeRenameElementUpdated(
6436 	                "Fencing level", "1", "target", "node1", "node2"
6437 	            ),
6438 	        )
6439 	
6440 	    def test_fence_device(self):
6441 	        self.assert_message_from_report(
6442 	            "Fence device 'fence_xvm': attribute 'pcmk_host_list' "
6443 	            "updated from 'node1,node2' to 'node3,node2'",
6444 	            reports.CibNodeRenameElementUpdated(
6445 	                "Fence device",
6446 	                "fence_xvm",
6447 	                "attribute 'pcmk_host_list'",
6448 	                "node1,node2",
6449 	                "node3,node2",
6450 	            ),
6451 	        )
6452 	
6453 	
6454 	class CibNodeRenameFencingLevelPatternExists(NameBuildTest):
6455 	    def test_success(self):
6456 	        self.assert_message_from_report(
6457 	            "Fencing level '1' uses target-pattern 'node.*', "
6458 	            "which may match the renamed node, check the pattern and adjust the"
6459 	            " configuration if necessary",
6460 	            reports.CibNodeRenameFencingLevelPatternExists("1", "node.*"),
6461 	        )
6462 	
6463 	
6464 	class CibNodeRenameAclsExist(NameBuildTest):
6465 	    def test_success(self):
6466 	        self.assert_message_from_report(
6467 	            "ACL rules exist in CIB and may contain references to node "
6468 	            "names, check the ACL configuration and adjust it if necessary",
6469 	            reports.CibNodeRenameAclsExist(),
6470 	        )
6471 	
6472 	
6473 	class CibNodeRenameOldNodeInCorosync(NameBuildTest):
6474 	    def test_success(self):
6475 	        self.assert_message_from_report(
6476 	            "Node 'old_name' is still known to corosync, "
6477 	            "the node may not have been renamed in corosync.conf yet",
6478 	            reports.CibNodeRenameOldNodeInCorosync(
6479 	                old_name="old_name",
6480 	            ),
6481 	        )
6482 	
6483 	
6484 	class CibNodeRenameNewNodeNotInCorosync(NameBuildTest):
6485 	    def test_success(self):
6486 	        self.assert_message_from_report(
6487 	            "Node 'new_name' is not known to corosync, "
6488 	            "the node name may be incorrect",
6489 	            reports.CibNodeRenameNewNodeNotInCorosync(
6490 	                new_name="new_name",
6491 	            ),
6492 	        )
6493 	
6494 	
6495 	class CibNodeRenameNoChange(NameBuildTest):
6496 	    def test_success(self):
6497 	        self.assert_message_from_report(
6498 	            "No CIB configuration changes needed for node rename",
6499 	            reports.CibNodeRenameNoChange(),
6500 	        )
6501 	
6502 	
6503 	class ConfiguredResourceMissingInStatus(NameBuildTest):
6504 	    def test_only_resource_id(self):
6505 	        self.assert_message_from_report(
6506 	            (
6507 	                "Cannot check if the resource 'id' is in expected state, "
6508 	                "since the resource is missing in cluster status"
6509 	            ),
6510 	            reports.ConfiguredResourceMissingInStatus("id"),
6511 	        )
6512 	
6513 	    def test_with_expected_state(self):
6514 	        self.assert_message_from_report(
6515 	            (
6516 	                "Cannot check if the resource 'id' is in expected state "
6517 	                "(stopped), since the resource is missing in cluster status"
6518 	            ),
6519 	            reports.ConfiguredResourceMissingInStatus(
6520 	                "id", ResourceState.STOPPED
6521 	            ),
6522 	        )
6523 	
6524 	
6525 	class NoStonithMeansWouldBeLeft(NameBuildTest):
6526 	    def test_success(self):
6527 	        self.assert_message_from_report(
6528 	            (
6529 	                "Requested action leaves the cluster with no enabled means "
6530 	                "to fence nodes, resulting in the cluster not being able to "
6531 	                "recover from certain failure conditions"
6532 	            ),
6533 	            reports.NoStonithMeansWouldBeLeft(),
6534 	        )
6535 	
6536 	
6537 	class NoStonithMeansWouldBeLeftDueToProperties(NameBuildTest):
6538 	    def test_success(self):
6539 	        self.assert_message_from_report(
6540 	            (
6541 	                "Setting property stonith-enabled to false or fencing-enabled"
6542 	                " to 0 leaves the cluster with no enabled means to fence nodes,"
6543 	                " resulting in the cluster not being able to recover from"
6544 	                " certain failure conditions"
6545 	            ),
6546 	            reports.NoStonithMeansWouldBeLeftDueToProperties(
6547 	                {"stonith-enabled": "false", "fencing-enabled": "0"}
6548 	            ),
6549 	        )
6550 	
6551 	
6552 	class ParseErrorInvalidFileStructure(NameBuildTest):
6553 	    def test_no_path(self):
6554 	        self.assert_message_from_report(
6555 	            "Unable to parse known-hosts file: reason",
6556 	            reports.ParseErrorInvalidFileStructure(
6557 	                "reason", file_type_codes.PCS_KNOWN_HOSTS, None
6558 	            ),
6559 	        )
6560 	
6561 	    def test_path(self):
6562 	        self.assert_message_from_report(
6563 	            "Unable to parse known-hosts file '/foo/bar': reason",
6564 	            reports.ParseErrorInvalidFileStructure(
6565 	                "reason", file_type_codes.PCS_KNOWN_HOSTS, "/foo/bar"
6566 	            ),
6567 	        )
6568 	
6569 	
6570 	class NodeReportsUnexpectedClusterName(NameBuildTest):
6571 	    def test_success(self):
6572 	        self.assert_message_from_report(
6573 	            "The node is not in the cluster named 'name'",
6574 	            reports.NodeReportsUnexpectedClusterName("name"),
6575 	        )
6576 	
6577 	
6578 	class PcsCfgsyncSendingConfigsToNodes(NameBuildTest):
6579 	    def test_one_node(self):
6580 	        self.assert_message_from_report(
6581 	            "Sending file 'known-hosts' to node 'node1'",
6582 	            reports.PcsCfgsyncSendingConfigsToNodes(
6583 	                [file_type_codes.PCS_KNOWN_HOSTS], ["node1"]
6584 	            ),
6585 	        )
6586 	
6587 	    def test_multiple_nodes(self):
6588 	        self.assert_message_from_report(
6589 	            "Sending file 'known-hosts' to nodes 'node1', 'node2'",
6590 	            reports.PcsCfgsyncSendingConfigsToNodes(
6591 	                [file_type_codes.PCS_KNOWN_HOSTS], ["node1", "node2"]
6592 	            ),
6593 	        )
6594 	
6595 	    def test_multiple_files(self):
6596 	        self.assert_message_from_report(
6597 	            "Sending files 'known-hosts', 'pcs configuration' to node 'node1'",
6598 	            reports.PcsCfgsyncSendingConfigsToNodes(
6599 	                [
6600 	                    file_type_codes.PCS_KNOWN_HOSTS,
6601 	                    file_type_codes.PCS_SETTINGS_CONF,
6602 	                ],
6603 	                ["node1"],
6604 	            ),
6605 	        )
6606 	
6607 	
6608 	class PcsCfgsyncSendingConfigsToNodesFailed(NameBuildTest):
6609 	    def test_one_node(self):
6610 	        self.assert_message_from_report(
6611 	            "Unable to save file 'known-hosts' on node 'node1'",
6612 	            reports.PcsCfgsyncSendingConfigsToNodesFailed(
6613 	                [file_type_codes.PCS_KNOWN_HOSTS], ["node1"]
6614 	            ),
6615 	        )
6616 	
6617 	    def test_multiple_nodes(self):
6618 	        self.assert_message_from_report(
6619 	            "Unable to save file 'known-hosts' on nodes 'node1', 'node2'",
6620 	            reports.PcsCfgsyncSendingConfigsToNodesFailed(
6621 	                [file_type_codes.PCS_KNOWN_HOSTS], ["node1", "node2"]
6622 	            ),
6623 	        )
6624 	
6625 	    def test_multiple_files(self):
6626 	        self.assert_message_from_report(
6627 	            "Unable to save files 'known-hosts', 'pcs configuration' on node 'node1'",
6628 	            reports.PcsCfgsyncSendingConfigsToNodesFailed(
6629 	                [
6630 	                    file_type_codes.PCS_KNOWN_HOSTS,
6631 	                    file_type_codes.PCS_SETTINGS_CONF,
6632 	                ],
6633 	                ["node1"],
6634 	            ),
6635 	        )
6636 	
6637 	
6638 	class PcsCfgsyncConfigAccepted(NameBuildTest):
6639 	    def test_success(self):
6640 	        self.assert_message_from_report(
6641 	            "The known-hosts file saved successfully",
6642 	            reports.PcsCfgsyncConfigAccepted(file_type_codes.PCS_KNOWN_HOSTS),
6643 	        )
6644 	
6645 	
6646 	class PcsCfgsyncConfigRejected(NameBuildTest):
6647 	    def test_success(self):
6648 	        self.assert_message_from_report(
6649 	            (
6650 	                "The known-hosts file not saved, a newer version of the file "
6651 	                "exists on the node"
6652 	            ),
6653 	            reports.PcsCfgsyncConfigRejected(file_type_codes.PCS_KNOWN_HOSTS),
6654 	        )
6655 	
6656 	
6657 	class PcsCfgsyncConfigSaveError(NameBuildTest):
6658 	    def test_success(self):
6659 	        self.assert_message_from_report(
6660 	            "The known-hosts file not saved",
6661 	            reports.PcsCfgsyncConfigSaveError(file_type_codes.PCS_KNOWN_HOSTS),
6662 	        )
6663 	
6664 	
6665 	class PcsCfgsyncConfigUnsupported(NameBuildTest):
6666 	    def test_success(self):
6667 	        self.assert_message_from_report(
6668 	            (
6669 	                "The known-hosts file synchronization is not supported on this "
6670 	                "node"
6671 	            ),
6672 	            reports.PcsCfgsyncConfigUnsupported(
6673 	                file_type_codes.PCS_KNOWN_HOSTS
6674 	            ),
6675 	        )
6676 	
6677 	
6678 	class PcsCfgsyncFetchingNewestConfig(NameBuildTest):
6679 	    def test_one_node(self):
6680 	        self.assert_message_from_report(
6681 	            (
6682 	                "Fetching the newest version of file 'known-hosts' from node "
6683 	                "'node1'"
6684 	            ),
6685 	            reports.PcsCfgsyncFetchingNewestConfig(
6686 	                [file_type_codes.PCS_KNOWN_HOSTS], ["node1"]
6687 	            ),
6688 	        )
6689 	
6690 	    def test_multiple_nodes(self):
6691 	        self.assert_message_from_report(
6692 	            (
6693 	                "Fetching the newest version of file 'known-hosts' from nodes "
6694 	                "'node1', 'node2'"
6695 	            ),
6696 	            reports.PcsCfgsyncFetchingNewestConfig(
6697 	                [file_type_codes.PCS_KNOWN_HOSTS], ["node1", "node2"]
6698 	            ),
6699 	        )
6700 	
6701 	    def test_multiple_files(self):
6702 	        self.assert_message_from_report(
6703 	            (
6704 	                "Fetching the newest version of files 'known-hosts', "
6705 	                "'pcs configuration' from node 'node1'"
6706 	            ),
6707 	            reports.PcsCfgsyncFetchingNewestConfig(
6708 	                [
6709 	                    file_type_codes.PCS_KNOWN_HOSTS,
6710 	                    file_type_codes.PCS_SETTINGS_CONF,
6711 	                ],
6712 	                ["node1"],
6713 	            ),
6714 	        )
6715 	
6716 	
6717 	class PcsCfgsyncConflictRepeatAction(NameBuildTest):
6718 	    def test_success(self):
6719 	        self.assert_message_from_report(
6720 	            (
6721 	                "Configuration conflict detected. Some nodes had a newer "
6722 	                "configuration than the local node. Local node's configuration "
6723 	                "was updated. Please repeat the last action if appropriate."
6724 	            ),
6725 	            reports.PcsCfgsyncConflictRepeatAction(),
6726 	        )
6727 	
6728 	
6729 	class MetaAttrsUnknownToPcmk(NameBuildTest):
6730 	    def test_single_option(self):
6731 	        self.assert_message_from_report(
6732 	            (
6733 	                "Resource meta attribute 'unknown' has no effect on cluster "
6734 	                "resource handling, meta attribute with effect: 'known'"
6735 	            ),
6736 	            reports.MetaAttrsUnknownToPcmk(
6737 	                ["unknown"], ["known"], ["primitive-meta"]
6738 	            ),
6739 	        )
6740 	
6741 	    def test_multiple_options(self):
6742 	        self.assert_message_from_report(
6743 	            (
6744 	                "Resource / stonith meta attributes 'unknown1', 'unknown2' "
6745 	                "have no effect on cluster resource handling, meta attributes "
6746 	                "with effect: 'known1', 'known2'"
6747 	            ),
6748 	            reports.MetaAttrsUnknownToPcmk(
6749 	                ["unknown1", "unknown2"],
6750 	                ["known1", "known2"],
6751 	                ["primitive-meta", "stonith-meta"],
6752 	            ),
6753 	        )
6754 	
6755 	
6756 	class MetaAttrsNotValidatedUnsupportedType(NameBuildTest):
6757 	    def test_empty_options(self):
6758 	        self.assert_message_from_report(
6759 	            "Meta attributes are not validated",
6760 	            reports.MetaAttrsNotValidatedUnsupportedType([]),
6761 	        )
6762 	
6763 	    def test_single_option(self):
6764 	        self.assert_message_from_report(
6765 	            "Meta attributes of clone are not validated",
6766 	            reports.MetaAttrsNotValidatedUnsupportedType(["clone"]),
6767 	        )
6768 	
6769 	    def test_multiple_options(self):
6770 	        self.assert_message_from_report(
6771 	            (
6772 	                "Meta attributes of bundle / clone / group / resource are not "
6773 	                "validated"
6774 	            ),
6775 	            reports.MetaAttrsNotValidatedUnsupportedType(
6776 	                ["clone", "bundle", "group", "primitive"]
6777 	            ),
6778 	        )
6779 	
6780 	
6781 	class MetaAttrsNotValidatedLoadingError(NameBuildTest):
6782 	    def test_success(self):
6783 	        self.assert_message_from_report(
6784 	            (
6785 	                "Meta attribute validation is skipped due to an error loading "
6786 	                "meta attributes definition."
6787 	            ),
6788 	            reports.MetaAttrsNotValidatedLoadingError(),
6789 	        )
6790 	
6791 	
6792 	class NodeNotInCluster(NameBuildTest):
6793 	    def test_success(self):
6794 	        self.assert_message_from_report(
6795 	            "The node does not currently have a cluster configured",
6796 	            reports.NodeNotInCluster(),
6797 	        )
6798 	
6799 	
6800 	class ClusterNameAlreadyInUse(NameBuildTest):
6801 	    def test_success(self):
6802 	        self.assert_message_from_report(
6803 	            "The cluster name 'foo' is already used",
6804 	            reports.ClusterNameAlreadyInUse("foo"),
6805 	        )
6806 	
6807 	
6808 	class UnableToGetClusterInfoFromStatus(NameBuildTest):
6809 	    def test_success(self):
6810 	        self.assert_message_from_report(
6811 	            "Unable to retrieve cluster information from node status",
6812 	            reports.UnableToGetClusterInfoFromStatus(),
6813 	        )
6814 	
6815 	
6816 	class UnableToGetClusterKnownHosts(NameBuildTest):
6817 	    def test_success(self):
6818 	        self.assert_message_from_report(
6819 	            "Unable to get known hosts from cluster 'foo'",
6820 	            reports.UnableToGetClusterKnownHosts("foo"),
6821 	        )
6822 	
6823 	
6824 	class CibResourceSecretUnableToGet(NameBuildTest):
6825 	    def test_success(self):
6826 	        self.assert_message_from_report(
6827 	            "Unable to get secret 'secret_name' for resource 'resource_id'",
6828 	            reports.CibResourceSecretUnableToGet(
CID (unavailable; MK=55cbeb11082b96308d32369024ffba4d) (#1 of 1): Hard-coded secret (SIGMA.hardcoded_secret):
(1) Event Sigma main event: A secret, such as a password, cryptographic key, or token is stored in plaintext directly in the source code, in an application's properties, or configuration file. Users with access to the secret may then use the secret to access resources that they otherwise would not have access to. Secret type: `Secret (generic)`.
(2) Event remediation: Avoid setting sensitive configuration values as string literals. Instead, these values should be set using variables with the sensitive data loaded from an encrypted file or a secret store.
6829 	                "resource_id", "secret_name", "reason"
6830 	            ),
6831 	        )
6832 	
6833 	
6834 	class PermissionDuplication(NameBuildTest):
6835 	    def test_success(self):
6836 	        self.assert_message_from_report(
6837 	            (
6838 	                "Permissions must be unique, duplicate permissions for "
6839 	                "user: 'john', group: 'haclient'"
6840 	            ),
6841 	            reports.PermissionDuplication(
6842 	                [
6843 	                    ("john", PermissionTargetType.USER),
6844 	                    ("haclient", PermissionTargetType.GROUP),
6845 	                ]
6846 	            ),
6847 	        )
6848 	
6849 	
6850 	class NotAuthorizedToChangeFullPermission(NameBuildTest):
6851 	    def test_success(self):
6852 	        self.assert_message_from_report(
6853 	            (
6854 	                "Current user is not authorized for this operation.\n"
6855 	                "Only hacluster and users with Full permission can grant or "
6856 	                "revoke Full permission."
6857 	            ),
6858 	            reports.NotAuthorizedToChangeFullPermission(),
6859 	        )
6860 	
6861 	
6862 	class UseCommandClusterRename(NameBuildTest):
6863 	    def test_success(self):
6864 	        self.assert_message_from_report(
6865 	            "This command cannot be used for renaming a cluster",
6866 	            reports.UseCommandClusterRename(),
6867 	        )
6868