Ejemplo n.º 1
0
 def test_success(self, mock_net_disable):
     lib.qdevice_disable(self.lib_env, "net")
     mock_net_disable.assert_called_once_with("mock_runner",
                                              "corosync-qnetd")
     assert_report_item_list_equal(
         self.mock_reporter.report_item_list,
         [(severity.INFO, report_codes.SERVICE_DISABLE_SUCCESS, {
             "service": "quorum device",
         })])
Ejemplo n.º 2
0
 def test_success(self, mock_net_disable):
     lib.qdevice_disable(self.lib_env, "net")
     mock_net_disable.assert_called_once_with("mock_runner",
                                              "corosync-qnetd")
     assert_report_item_list_equal(
         self.mock_reporter.report_item_list,
         [(
             severity.INFO,
             reports.codes.SERVICE_ACTION_SUCCEEDED,
             {
                 "action": reports.const.SERVICE_ACTION_DISABLE,
                 "service": "quorum device",
                 "node": "",
                 "instance": "",
             },
         )],
     )
Ejemplo n.º 3
0
 def test_success(self, mock_net_disable):
     lib.qdevice_disable(self.lib_env, "net")
     mock_net_disable.assert_called_once_with(
         "mock_runner",
         "corosync-qnetd"
     )
     assert_report_item_list_equal(
         self.mock_reporter.report_item_list,
         [
             (
                 severity.INFO,
                 report_codes.SERVICE_DISABLE_SUCCESS,
                 {
                     "service": "quorum device",
                 }
             )
         ]
     )
Ejemplo n.º 4
0
 def test_success(self):
     lib.qdevice_disable(self.lib_env, "net")
     self.assertEqual(
         self.lib_env.service_manager.method_calls,
         [mock.call.disable("corosync-qnetd")],
     )
     assert_report_item_list_equal(
         self.mock_reporter.report_item_list,
         [(
             severity.INFO,
             reports.codes.SERVICE_ACTION_SUCCEEDED,
             {
                 "action": reports.const.SERVICE_ACTION_DISABLE,
                 "service": "quorum device",
                 "node": "",
                 "instance": "",
             },
         )],
     )
Ejemplo n.º 5
0
    def test_failed(self, mock_net_disable):
        mock_net_disable.side_effect = DisableServiceError(
            "test service", "test error")

        assert_raise_library_error(
            lambda: lib.qdevice_disable(self.lib_env, "net"),
            (severity.ERROR, report_codes.SERVICE_DISABLE_ERROR, {
                "service": "test service",
                "reason": "test error",
            }))
        mock_net_disable.assert_called_once_with("mock_runner",
                                                 "corosync-qnetd")
Ejemplo n.º 6
0
    def test_failed(self, mock_net_disable):
        mock_net_disable.side_effect = DisableServiceError(
            "test service", "test error")

        assert_raise_library_error(
            lambda: lib.qdevice_disable(self.lib_env, "net"),
            (
                severity.ERROR,
                reports.codes.SERVICE_ACTION_FAILED,
                {
                    "action": reports.const.SERVICE_ACTION_DISABLE,
                    "service": "test service",
                    "reason": "test error",
                    "node": "",
                    "instance": "",
                },
            ),
        )
        mock_net_disable.assert_called_once_with("mock_runner",
                                                 "corosync-qnetd")
Ejemplo n.º 7
0
    def test_failed(self, mock_net_disable):
        mock_net_disable.side_effect = DisableServiceError(
            "test service",
            "test error"
        )

        assert_raise_library_error(
            lambda: lib.qdevice_disable(self.lib_env, "net"),
            (
                severity.ERROR,
                report_codes.SERVICE_DISABLE_ERROR,
                {
                    "service": "test service",
                    "reason": "test error",
                }
            )
        )
        mock_net_disable.assert_called_once_with(
            "mock_runner",
            "corosync-qnetd"
        )
Ejemplo n.º 8
0
    def test_failed(self):
        self.lib_env.service_manager.disable.side_effect = DisableServiceError(
            "test service", "test error")

        assert_raise_library_error(
            lambda: lib.qdevice_disable(self.lib_env, "net"),
            (
                severity.ERROR,
                reports.codes.SERVICE_ACTION_FAILED,
                {
                    "action": reports.const.SERVICE_ACTION_DISABLE,
                    "service": "test service",
                    "reason": "test error",
                    "node": "",
                    "instance": "",
                },
            ),
        )
        self.assertEqual(
            self.lib_env.service_manager.method_calls,
            [mock.call.disable("corosync-qnetd")],
        )
Ejemplo n.º 9
0
 def test_disable(self):
     self.base_test(lambda: lib.qdevice_disable(self.lib_env, "bad model"))
Ejemplo n.º 10
0
 def test_disable(self):
     self.base_test(
         lambda: lib.qdevice_disable(self.lib_env, "bad model")
     )