示例#1
0
 def test_notify_about_replication_error(self, mock_rpc, mock_conf, mock_usage):
     mock_conf.host = "host1"
     output = volume_utils.notify_about_replication_error(mock.sentinel.context, mock.sentinel.volume, "test_suffix")
     self.assertIsNone(output)
     mock_usage.assert_called_once_with(mock.sentinel.context, mock.sentinel.volume)
     mock_rpc.get_notifier.assert_called_once_with("replication", "host1")
     mock_rpc.get_notifier.return_value.error.assert_called_once_with(
         mock.sentinel.context, "replication.test_suffix", mock_usage.return_value
     )
 def test_notify_about_replication_error(self, mock_rpc, mock_conf,
                                         mock_usage):
     mock_conf.host = 'host1'
     output = volume_utils.notify_about_replication_error(
         mock.sentinel.context, mock.sentinel.volume, 'test_suffix')
     self.assertIsNone(output)
     mock_usage.assert_called_once_with(mock.sentinel.context,
                                        mock.sentinel.volume)
     mock_rpc.get_notifier.assert_called_once_with('replication', 'host1')
     mock_rpc.get_notifier.return_value.error.assert_called_once_with(
         mock.sentinel.context, 'replication.test_suffix',
         mock_usage.return_value)
示例#3
0
 def test_notify_about_replication_error(self, mock_rpc,
                                         mock_conf, mock_usage):
     mock_conf.host = 'host1'
     output = volume_utils.notify_about_replication_error(
         mock.sentinel.context,
         mock.sentinel.volume,
         'test_suffix')
     self.assertIsNone(output)
     mock_usage.assert_called_once_with(mock.sentinel.volume)
     mock_rpc.get_notifier.assert_called_once_with('replication', 'host1')
     mock_rpc.get_notifier.return_value.error.assert_called_once_with(
         mock.sentinel.context,
         'replication.test_suffix',
         mock_usage.return_value)
示例#4
0
 def test_notify_about_replication_error_with_kwargs(self, mock_rpc, mock_conf, mock_usage):
     mock_conf.host = "host1"
     output = volume_utils.notify_about_replication_error(
         mock.sentinel.context,
         mock.sentinel.volume,
         "test_suffix",
         extra_error_info={"a": "b", "c": "d"},
         host="host2",
     )
     self.assertIsNone(output)
     mock_usage.assert_called_once_with(mock.sentinel.context, mock.sentinel.volume, a="b", c="d")
     mock_rpc.get_notifier.assert_called_once_with("replication", "host2")
     mock_rpc.get_notifier.return_value.error.assert_called_once_with(
         mock.sentinel.context, "replication.test_suffix", mock_usage.return_value
     )
示例#5
0
 def test_notify_about_replication_error_with_kwargs(self, mock_rpc,
                                                     mock_conf, mock_usage):
     mock_conf.host = 'host1'
     output = volume_utils.notify_about_replication_error(
         mock.sentinel.context,
         mock.sentinel.volume,
         'test_suffix',
         extra_error_info={'a': 'b', 'c': 'd'},
         host='host2')
     self.assertIsNone(output)
     mock_usage.assert_called_once_with(mock.sentinel.volume,
                                        a='b', c='d')
     mock_rpc.get_notifier.assert_called_once_with('replication', 'host2')
     mock_rpc.get_notifier.return_value.error.assert_called_once_with(
         mock.sentinel.context,
         'replication.test_suffix',
         mock_usage.return_value)
示例#6
0
 def test_notify_about_replication_error_with_kwargs(self, mock_rpc,
                                                     mock_conf, mock_usage):
     mock_conf.host = 'host1'
     output = volume_utils.notify_about_replication_error(
         mock.sentinel.context,
         mock.sentinel.volume,
         'test_suffix',
         extra_error_info={'a': 'b', 'c': 'd'},
         host='host2')
     self.assertIsNone(output)
     mock_usage.assert_called_once_with(mock.sentinel.context,
                                        mock.sentinel.volume,
                                        a='b', c='d')
     mock_rpc.get_notifier.assert_called_once_with('replication', 'host2')
     mock_rpc.get_notifier.return_value.error.assert_called_once_with(
         mock.sentinel.context,
         'replication.test_suffix',
         mock_usage.return_value)