예제 #1
0
 def test_reset_service_replication(self, mock_update):
     cluster = fake_cluster.fake_cluster_ovo(self.context)
     cluster.reset_service_replication()
     mock_update.assert_called_with(self.context, models.Service,
                                    {'replication_status': 'enabled',
                                     'active_backend_id': None},
                                    {'cluster_name': cluster.name})
예제 #2
0
 def test_reset_service_replication(self, mock_update):
     cluster = fake_cluster.fake_cluster_ovo(self.context)
     cluster.reset_service_replication()
     mock_update.assert_called_with(self.context, models.Service, {
         'replication_status': 'enabled',
         'active_backend_id': None
     }, {'cluster_name': cluster.name})
예제 #3
0
 def test_is_up_limit(self):
     limit_expired = (utils.service_expired_time(True) +
                      timeutils.datetime.timedelta(seconds=1))
     cluster = fake_cluster.fake_cluster_ovo(self.context,
                                             last_heartbeat=limit_expired)
     self.assertTrue(cluster.is_up)
예제 #4
0
 def test_is_up(self):
     cluster = fake_cluster.fake_cluster_ovo(
         self.context,
         last_heartbeat=timeutils.utcnow(with_timezone=True))
     self.assertTrue(cluster.is_up)
예제 #5
0
 def test_is_up_no_last_hearbeat(self):
     cluster = fake_cluster.fake_cluster_ovo(self.context,
                                             last_heartbeat=None)
     self.assertFalse(cluster.is_up)
예제 #6
0
 def test_refresh(self, cluster_get_mock):
     cluster = fake_cluster.fake_cluster_ovo(self.context)
     cluster.refresh()
     cluster_get_mock.assert_called_once_with(self.context, cluster.id)
예제 #7
0
 def test_destroy(self, cluster_destroy_mock):
     cluster = fake_cluster.fake_cluster_ovo(self.context)
     cluster.destroy()
     cluster_destroy_mock.assert_called_once_with(mock.ANY, cluster.id)
예제 #8
0
 def test_save(self, cluster_update_mock):
     cluster = fake_cluster.fake_cluster_ovo(self.context)
     cluster.disabled = True
     cluster.save()
     cluster_update_mock.assert_called_once_with(self.context, cluster.id,
                                                 {'disabled': True})
예제 #9
0
 def test_is_up_down(self):
     expired_time = (utils.service_expired_time(True) -
                     timeutils.datetime.timedelta(seconds=1))
     cluster = fake_cluster.fake_cluster_ovo(self.context,
                                             last_heartbeat=expired_time)
     self.assertFalse(cluster.is_up)
예제 #10
0
 def test_is_up(self):
     cluster = fake_cluster.fake_cluster_ovo(
         self.context,
         last_heartbeat=timeutils.utcnow(with_timezone=True))
     self.assertTrue(cluster.is_up)
예제 #11
0
 def test_is_up_no_last_hearbeat(self):
     cluster = fake_cluster.fake_cluster_ovo(self.context,
                                             last_heartbeat=None)
     self.assertFalse(bool(cluster.is_up))
예제 #12
0
 def test_refresh(self, cluster_get_mock):
     cluster = fake_cluster.fake_cluster_ovo(self.context)
     cluster.refresh()
     cluster_get_mock.assert_called_once_with(self.context, cluster.id)
예제 #13
0
 def test_destroy(self, cluster_destroy_mock):
     cluster = fake_cluster.fake_cluster_ovo(self.context)
     cluster.destroy()
     cluster_destroy_mock.assert_called_once_with(mock.ANY, cluster.id)
예제 #14
0
 def test_save(self, cluster_update_mock):
     cluster = fake_cluster.fake_cluster_ovo(self.context)
     cluster.disabled = True
     cluster.save()
     cluster_update_mock.assert_called_once_with(self.context, cluster.id,
                                                 {'disabled': True})
예제 #15
0
 def test_is_up_down(self):
     expired_time = (utils.service_expired_time(True) -
                     timeutils.datetime.timedelta(seconds=1))
     cluster = fake_cluster.fake_cluster_ovo(self.context,
                                             last_heartbeat=expired_time)
     self.assertFalse(cluster.is_up)
예제 #16
0
 def test_is_up_limit(self):
     limit_expired = (utils.service_expired_time(True) +
                      timeutils.datetime.timedelta(seconds=1))
     cluster = fake_cluster.fake_cluster_ovo(self.context,
                                             last_heartbeat=limit_expired)
     self.assertTrue(cluster.is_up)