Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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
     )
Exemplo n.º 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)
Exemplo n.º 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)