Ejemplo n.º 1
0
    def test_service_destroy(self):
        service1 = self._create_service({})
        service2 = self._create_service({'host': 'fake_host2'})

        db.service_destroy(self.ctxt, service1['id'])
        self.assertRaises(exception.ServiceNotFound,
                          db.service_get, self.ctxt, service1['id'])
        self._assertEqualObjects(db.service_get(self.ctxt, service2['id']),
                                 service2)
Ejemplo n.º 2
0
 def test_service_enabled_on_create_based_on_flag(self):
     self.flags(enable_new_services=True)
     host = 'foo'
     binary = 'rack-fake'
     app = service.Service.create(host=host, binary=binary)
     app.start()
     app.stop()
     ref = db.service_get(context.get_admin_context(), app.service_id)
     db.service_destroy(context.get_admin_context(), app.service_id)
     self.assertTrue(not ref['disabled'])
Ejemplo n.º 3
0
 def test_service_update(self):
     service = self._create_service({})
     new_values = {
         'host': 'fake_host1',
         'binary': 'fake_binary1',
         'topic': 'fake_topic1',
         'report_count': 4,
         'disabled': True
     }
     db.service_update(self.ctxt, service['id'], new_values)
     updated_service = db.service_get(self.ctxt, service['id'])
     for key, value in new_values.iteritems():
         self.assertEqual(value, updated_service[key])
Ejemplo n.º 4
0
 def test_service_get(self):
     service1 = self._create_service({})
     self._create_service({'host': 'some_other_fake_host'})
     real_service1 = db.service_get(self.ctxt, service1['id'])
     self._assertEqualObjects(service1, real_service1,
                              ignored_keys=['compute_node'])