Ejemplo n.º 1
0
 def test_db_null_instance_uuid_scan_readonly(self):
     results = migration.db_null_instance_uuid_scan(delete=False)
     self.assertEqual(1, results.get("instances"))
     self.assertEqual(1, results.get("consoles"))
     # The fixed_ips table should be ignored.
     self.assertNotIn("fixed_ips", results)
     # Now pick a random table with an instance_uuid column and show it's
     # in the results but with 0 hits.
     self.assertEqual(0, results.get("instance_info_caches"))
     # Make sure nothing was deleted.
     for table_name in ("fixed_ips", "instances", "consoles"):
         table = db_utils.get_table(self.engine, table_name)
         record = table.select(table.c.id == 1).execute().first()
         self.assertIsNotNone(record)
Ejemplo n.º 2
0
 def test_db_null_instance_uuid_scan_readonly(self):
     results = migration.db_null_instance_uuid_scan(delete=False)
     self.assertEqual(1, results.get('instances'))
     self.assertEqual(1, results.get('consoles'))
     # The fixed_ips table should be ignored.
     self.assertNotIn('fixed_ips', results)
     # Now pick a random table with an instance_uuid column and show it's
     # in the results but with 0 hits.
     self.assertEqual(0, results.get('instance_info_caches'))
     # Make sure nothing was deleted.
     for table_name in ('fixed_ips', 'instances', 'consoles'):
         table = db_utils.get_table(self.engine, table_name)
         record = table.select(table.c.id == 1).execute().first()
         self.assertIsNotNone(record)
Ejemplo n.º 3
0
    def test_db_null_instance_uuid_scan_delete(self):
        results = migration.db_null_instance_uuid_scan(delete=True)
        self.assertEqual(1, results.get("instances"))
        self.assertEqual(1, results.get("consoles"))
        # The fixed_ips table should be ignored.
        self.assertNotIn("fixed_ips", results)
        # Now pick a random table with an instance_uuid column and show it's
        # in the results but with 0 hits.
        self.assertEqual(0, results.get("instance_info_caches"))
        # Make sure fixed_ips wasn't touched, but instances and instance_faults
        # records were deleted.
        fixed_ips = db_utils.get_table(self.engine, "fixed_ips")
        record = fixed_ips.select(fixed_ips.c.id == 1).execute().first()
        self.assertIsNotNone(record)

        consoles = db_utils.get_table(self.engine, "consoles")
        record = consoles.select(consoles.c.id == 1).execute().first()
        self.assertIsNone(record)

        instances = db_utils.get_table(self.engine, "instances")
        record = instances.select(instances.c.id == 1).execute().first()
        self.assertIsNone(record)
Ejemplo n.º 4
0
    def test_db_null_instance_uuid_scan_delete(self):
        results = migration.db_null_instance_uuid_scan(delete=True)
        self.assertEqual(1, results.get('instances'))
        self.assertEqual(1, results.get('consoles'))
        # The fixed_ips table should be ignored.
        self.assertNotIn('fixed_ips', results)
        # Now pick a random table with an instance_uuid column and show it's
        # in the results but with 0 hits.
        self.assertEqual(0, results.get('instance_info_caches'))
        # Make sure fixed_ips wasn't touched, but instances and instance_faults
        # records were deleted.
        fixed_ips = db_utils.get_table(self.engine, 'fixed_ips')
        record = fixed_ips.select(fixed_ips.c.id == 1).execute().first()
        self.assertIsNotNone(record)

        consoles = db_utils.get_table(self.engine, 'consoles')
        record = consoles.select(consoles.c.id == 1).execute().first()
        self.assertIsNone(record)

        instances = db_utils.get_table(self.engine, 'instances')
        record = instances.select(instances.c.id == 1).execute().first()
        self.assertIsNone(record)