def test_revert(self):
        self.migration_task.revert([])
        self.migration_task.revert(None)

        test_flavor_name = 'Flavor_on_source'
        test_flavor_details = {'name': test_flavor_name,
                               'ram': 512,
                               'vcpus': 1,
                               'disk': 1,
                               'ephemeral': 0,
                               'swap': 0,
                               'rxtx_factor': 1.0,
                               'is_public': 'True'}

        flavor_to_migrate = self.migration_task. \
            nv_source.flavors.create(**test_flavor_details)

        migrated_flavor = None
        try:
            self.migration_task.execute([test_flavor_name])
            self.migration_task.revert([test_flavor_name])

            data = read_record("flavors", ['*'], {"name": "test_flavor_name"}, True)
            self.assertEqual(None, data)

        except keystone_exceptions.NotFound:
            pass
        finally:
            self.clean_up(flavor_to_migrate, migrated_flavor)
Beispiel #2
0
    def test_revert(self):
        self.migration_task.revert([])
        self.migration_task.revert(None)

        test_flavor_name = 'Flavor_on_source'
        test_flavor_details = {
            'name': test_flavor_name,
            'ram': 512,
            'vcpus': 1,
            'disk': 1,
            'ephemeral': 0,
            'swap': 0,
            'rxtx_factor': 1.0,
            'is_public': 'True'
        }

        flavor_to_migrate = self.migration_task. \
            nv_source.flavors.create(**test_flavor_details)

        migrated_flavor = None
        try:
            self.migration_task.execute([test_flavor_name])
            self.migration_task.revert([test_flavor_name])

            data = read_record("flavors", ['*'], {"name": "test_flavor_name"},
                               True)
            self.assertEqual(None, data)

        except keystone_exceptions.NotFound:
            pass
        finally:
            self.clean_up(flavor_to_migrate, migrated_flavor)
 def test_delete_all_data(self):
     db_name = 'test'
     release_db_pool()
     create_db_pool(db_name)
     table_name = 'test_table_name'
     create_table(table_name, 'id varchar(20)', True)
     test_id, test_id2 = 1, 2
     insert_record(table_name, [{'id': test_id}, {'id': test_id2}], True)
     data = read_record(table_name, ['id'], {'1': 1}, True)
     self.assertIn((str(test_id),), data)
     self.assertIn((str(test_id2),), data)
     try:
         delete_all_data(table_name)
         data = read_record(table_name, ['id'], {'1': 1}, True)
         self.assertNotIn((str(test_id)), data)
         self.assertNotIn((str(test_id2),), data)
     except Exception, e:
         self.fail(e)
Beispiel #4
0
 def test_delete_all_data(self):
     db_name = 'test'
     release_db_pool()
     create_db_pool(db_name)
     table_name = 'test_table_name'
     create_table(table_name, 'id varchar(20)', True)
     test_id, test_id2 = 1, 2
     insert_record(table_name, [{'id': test_id}, {'id': test_id2}], True)
     data = read_record(table_name, ['id'], {'1': 1}, True)
     self.assertIn((str(test_id), ), data)
     self.assertIn((str(test_id2), ), data)
     try:
         delete_all_data(table_name)
         data = read_record(table_name, ['id'], {'1': 1}, True)
         self.assertNotIn((str(test_id)), data)
         self.assertNotIn((str(test_id2), ), data)
     except Exception, e:
         self.fail(e)
    def get_project_pairs(self, where_dict):
        project_names = read_record('tenants',
                                    ['project_name, new_project_name'],
                                    where_dict, True)

        project_pairs = [(self.ks_source.tenants.find(name=name[0]),
                          self.ks_target.tenants.find(name=name[1]))
                         for name in project_names]

        return project_pairs
 def test_read_record(self):
     db_name = 'mysql'
     release_db_pool()
     create_db_pool(db_name)
     table_name = 'user'
     data = read_record(table_name,
                        ['*'],
                        {'Host': 'localhost', 'User': '******'},
                        True)
     self.assertEqual('localhost', data[0][0])
     self.assertEqual('root', data[0][1])
    def get_project_pairs(self, where_dict):
        project_names = read_record('tenants',
                                    ['project_name, new_project_name'],
                                    where_dict, True)

        try:
            project_pairs = [(self.ks_source.tenants.find(name=name[0]),
                              self.ks_target.tenants.find(name=name[1]))
                             for name in project_names]
        except Exception, e:
            return None
Beispiel #8
0
 def test_read_record(self):
     db_name = 'mysql'
     release_db_pool()
     create_db_pool(db_name)
     table_name = 'user'
     data = read_record(table_name, ['*'], {
         'Host': 'localhost',
         'User': '******'
     }, True)
     self.assertEqual('localhost', data[0][0])
     self.assertEqual('root', data[0][1])
 def test_insert_record(self):
     db_name = 'test'
     release_db_pool()
     create_db_pool(db_name)
     table_name = 'test_table_name'
     create_table(table_name, 'id varchar(20)', True)
     test_id = 1
     try:
         insert_record(table_name, [{'id': test_id}], True)
         data = read_record(table_name, ['id'], {'1': 1}, True)
         self.assertIn((str(test_id),), data)
     except Exception, e:
         self.fail(e.message)
Beispiel #10
0
 def test_insert_record(self):
     db_name = 'test'
     release_db_pool()
     create_db_pool(db_name)
     table_name = 'test_table_name'
     create_table(table_name, 'id varchar(20)', True)
     test_id = 1
     try:
         insert_record(table_name, [{'id': test_id}], True)
         data = read_record(table_name, ['id'], {'1': 1}, True)
         self.assertIn((str(test_id), ), data)
     except Exception, e:
         self.fail(e.message)