Ejemplo n.º 1
0
 def test_haproxy_action_unexpected_status(self, mock):
     mock(None, None).status.side_effect = lambda backend, server: {
         'status': 'MAINT'
     }
     with self.assertRaises(execution.UnexpectedHAproxyServerStatus):
         execution.haproxy_action(
             "fr-hq-vip-01", ["BACKEND,SERVER-01", "BACKEND,SERVER-02"],
             "secret", "UP", execution.HAProxyAction.ENABLE)
Ejemplo n.º 2
0
 def test_haproxy_action_enable(self, mock):
     mock(None, None).status.side_effect = lambda backend, server: {
         'status': 'MAINT'
     }
     mock(None, None).enable.side_effect = lambda backend, server: "OK"
     execution.haproxy_action("fr-hq-vip-01",
                              ["BACKEND,SERVER-01", "BACKEND,SERVER-02"],
                              "secret", "MAINT",
                              execution.HAProxyAction.ENABLE)
Ejemplo n.º 3
0
 def test_haproxy_action_unnormalized_keys(self, mock):
     with self.assertRaises(execution.InvalidHAProxyKeyFormat):
         execution.haproxy_action("fr-hq-vip-01", ["BADKEY"], "secret",
                                  "UP", execution.HAProxyAction.DISABLE)