예제 #1
0
파일: test_booth.py 프로젝트: cwjenkins/pcs
 def test_success_remove_ticket(self):
     self.assert_pcs_success("booth ticket add TicketA")
     self.assert_pcs_success("booth config", stdout_full=console_report(
         "authfile = {0}".format(BOOTH_KEY_FILE),
         "site = 1.1.1.1",
         "site = 2.2.2.2",
         "arbitrator = 3.3.3.3",
         'ticket = "TicketA"',
     ))
     self.assert_pcs_success("booth ticket remove TicketA")
     self.assert_pcs_success("booth config", stdout_full=console_report(
         "authfile = {0}".format(BOOTH_KEY_FILE),
         "site = 1.1.1.1",
         "site = 2.2.2.2",
         "arbitrator = 3.3.3.3",
     ))
예제 #2
0
 def test_success_remove_ticket(self):
     self.assert_pcs_success("booth ticket add TicketA")
     self.assert_pcs_success("booth config", stdout_full=console_report(
         "authfile = {0}".format(BOOTH_KEY_FILE),
         "site = 1.1.1.1",
         "site = 2.2.2.2",
         "arbitrator = 3.3.3.3",
         'ticket = "TicketA"',
     ))
     self.assert_pcs_success("booth ticket remove TicketA")
     self.assert_pcs_success("booth config", stdout_full=console_report(
         "authfile = {0}".format(BOOTH_KEY_FILE),
         "site = 1.1.1.1",
         "site = 2.2.2.2",
         "arbitrator = 3.3.3.3",
     ))
예제 #3
0
 def test_fail_on_invalid_options(self):
     self.assert_pcs_fail(
         "booth ticket add TicketA site=a timeout=",
         console_report(
             "Error: invalid booth ticket option 'site', allowed options"
             " are: acquire-after, attr-prereq, before-acquire-handler,"
             " expire, renewal-freq, retries, timeout, weights",
             "Error: '' is not a valid timeout value, use no-empty",
         ))
예제 #4
0
 def test_fail_on_multiple_reasons(self):
     self.assert_pcs_fail(
         "booth setup sites 1.1.1.1 arbitrators 1.1.1.1 2.2.2.2 3.3.3.3",
         console_report(
             "Error: lack of sites for booth configuration (need 2 at least)"
             ": sites 1.1.1.1",
             "Error: odd number of peers is required (entered 4 peers)",
             "Error: duplicate address for booth configuration: 1.1.1.1",
         ))
예제 #5
0
 def test_fail_on_invalid_options(self):
     self.assert_pcs_fail(
         "booth ticket add TicketA site=a timeout=", console_report(
             "Error: invalid booth ticket option 'site', allowed options"
                 " are: acquire-after, attr-prereq, before-acquire-handler,"
                 " expire, renewal-freq, retries, timeout, weights"
             ,
             "Error: '' is not a valid timeout value, use no-empty",
         )
     )
예제 #6
0
 def test_fail_on_multiple_reasons(self):
     self.assert_pcs_fail(
         "booth setup sites 1.1.1.1 arbitrators 1.1.1.1 2.2.2.2 3.3.3.3",
         console_report(
             "Error: lack of sites for booth configuration (need 2 at least)"
                 ": sites 1.1.1.1"
             ,
             "Error: odd number of peers is required (entered 4 peers)",
             "Error: duplicate address for booth configuration: 1.1.1.1",
         )
     )
예제 #7
0
 def test_forceable_fail_on_unknown_options(self):
     msg = ("invalid booth ticket option 'unknown', allowed options"
            " are: acquire-after, attr-prereq, before-acquire-handler,"
            " expire, renewal-freq, retries, timeout, weights")
     self.assert_pcs_fail(
         "booth ticket add TicketA unknown=a",
         console_report("Error: " + msg + ", use --force to override", ))
     self.assert_pcs_success(
         "booth ticket add TicketA unknown=a --force",
         "Warning: {0}\n".format(msg),
     )
예제 #8
0
 def test_sucess_setup_booth_config(self):
     ensure_booth_config_not_exists()
     self.assert_pcs_success(
         "booth setup sites 1.1.1.1 2.2.2.2 arbitrators 3.3.3.3")
     self.assert_pcs_success("booth config",
                             stdout_full=console_report(
                                 "authfile = {0}".format(BOOTH_KEY_FILE),
                                 "site = 1.1.1.1",
                                 "site = 2.2.2.2",
                                 "arbitrator = 3.3.3.3",
                             ))
     with open(BOOTH_KEY_FILE, "rb") as key_file:
         self.assertEqual(64, len(key_file.read()))
예제 #9
0
 def test_forceable_fail_on_unknown_options(self):
     msg = (
         "invalid booth ticket option 'unknown', allowed options"
         " are: acquire-after, attr-prereq, before-acquire-handler,"
         " expire, renewal-freq, retries, timeout, weights"
     )
     self.assert_pcs_fail(
         "booth ticket add TicketA unknown=a", console_report(
             "Error: "+msg+", use --force to override",
         )
     )
     self.assert_pcs_success(
         "booth ticket add TicketA unknown=a --force",
         "Warning: {0}\n".format(msg),
     )
예제 #10
0
 def test_sucess_setup_booth_config(self):
     ensure_booth_config_not_exists()
     self.assert_pcs_success(
         "booth setup sites 1.1.1.1 2.2.2.2 arbitrators 3.3.3.3"
     )
     self.assert_pcs_success(
         "booth config",
         stdout_full=console_report(
             "authfile = {0}".format(BOOTH_KEY_FILE),
             "site = 1.1.1.1",
             "site = 2.2.2.2",
             "arbitrator = 3.3.3.3",
         )
     )
     with open(BOOTH_KEY_FILE) as key_file:
         self.assertEqual(64, len(key_file.read()))