Ejemplo n.º 1
0
 def test_destroy_bay_that_has_rc_by_uuid(self):
     bay = utils.create_test_bay()
     rc = utils.create_test_rc(bay_uuid=bay.uuid)
     self.assertEqual(bay.uuid, rc.bay_uuid)
     self.dbapi.destroy_bay(bay.uuid)
     self.assertRaises(exception.ReplicationControllerNotFound,
                       self.dbapi.get_rc_by_id, self.context, rc.id)
Ejemplo n.º 2
0
 def test_destroy_bay_that_has_rc_by_uuid(self):
     bay = utils.create_test_bay()
     rc = utils.create_test_rc(bay_uuid=bay.uuid)
     self.assertEqual(bay.uuid, rc.bay_uuid)
     self.dbapi.destroy_bay(bay.uuid)
     self.assertRaises(exception.ReplicationControllerNotFound,
                       self.dbapi.get_rc_by_id,
                       self.context, rc.id)
 def test_get_rc_list(self):
     uuids = [self.rc.uuid]
     for i in range(1, 6):
         rc = utils.create_test_rc(bay_uuid=self.bay.uuid,
             uuid=magnum_utils.generate_uuid())
         uuids.append(six.text_type(rc.uuid))
     rc = self.dbapi.get_rc_list(self.context)
     rc_uuids = [r.uuid for r in rc]
     self.assertEqual(sorted(uuids), sorted(rc_uuids))
Ejemplo n.º 4
0
 def test_get_rc_list(self):
     uuids = [self.rc.uuid]
     for i in range(1, 6):
         rc = utils.create_test_rc(bay_uuid=self.bay.uuid,
                                   uuid=magnum_utils.generate_uuid())
         uuids.append(six.text_type(rc.uuid))
     rc = self.dbapi.get_rc_list(self.context)
     rc_uuids = [r.uuid for r in rc]
     self.assertEqual(sorted(uuids), sorted(rc_uuids))
Ejemplo n.º 5
0
    def test_get_rc_list_sorted(self):
        uuids = [self.rc.uuid]
        for _ in range(5):
            rc = utils.create_test_rc(uuid=magnum_utils.generate_uuid())
            uuids.append(six.text_type(rc.uuid))
        res = self.dbapi.get_rc_list(self.context, sort_key='uuid')
        res_uuids = [r.uuid for r in res]
        self.assertEqual(sorted(uuids), res_uuids)

        self.assertRaises(exception.InvalidParameterValue,
                          self.dbapi.get_rc_list,
                          self.context,
                          sort_key='foo')
    def test_get_rc_list_sorted(self):
        uuids = [self.rc.uuid]
        for _ in range(5):
            rc = utils.create_test_rc(uuid=magnum_utils.generate_uuid())
            uuids.append(six.text_type(rc.uuid))
        res = self.dbapi.get_rc_list(self.context, sort_key='uuid')
        res_uuids = [r.uuid for r in res]
        self.assertEqual(sorted(uuids), res_uuids)

        self.assertRaises(exception.InvalidParameterValue,
                          self.dbapi.get_rc_list,
                          self.context,
                          sort_key='foo')
Ejemplo n.º 7
0
 def test_get_rc_by_name_multiple_rcs(self):
     utils.create_test_rc(bay_uuid=self.bay.uuid,
                          uuid=magnum_utils.generate_uuid())
     self.assertRaises(exception.Conflict, self.dbapi.get_rc_by_name,
                       self.rc.name)
Ejemplo n.º 8
0
 def setUp(self):
     # This method creates a replication controller for every test and
     # replaces a test for creating a replication controller.
     super(DbRCTestCase, self).setUp()
     self.bay = utils.create_test_bay()
     self.rc = utils.create_test_rc(bay_uuid=self.bay.uuid)
Ejemplo n.º 9
0
 def test_get_rc_by_name_multiple_rcs(self):
     utils.create_test_rc(bay_uuid=self.bay.uuid,
                          uuid=magnum_utils.generate_uuid())
     self.assertRaises(exception.Conflict, self.dbapi.get_rc_by_name,
                       self.context, self.rc.name)
Ejemplo n.º 10
0
 def setUp(self):
     # This method creates a replication controller for every test and
     # replaces a test for creating a replication controller.
     super(DbRCTestCase, self).setUp()
     self.bay = utils.create_test_bay()
     self.rc = utils.create_test_rc(bay_uuid=self.bay.uuid)