diff options
| author | John Tran <jtran@attinteractive.com> | 2011-08-15 13:58:44 -0700 |
|---|---|---|
| committer | John Tran <jtran@attinteractive.com> | 2011-08-15 13:58:44 -0700 |
| commit | 3e561f148fcba627f8fbd4ab1089f426fbc2e61b (patch) | |
| tree | ef8810fa359e338be8830f16645dd71083488e4c | |
| parent | f06f80591a41f5d1b373677937bbbcddcfb0bb7c (diff) | |
| download | nova-3e561f148fcba627f8fbd4ab1089f426fbc2e61b.tar.gz nova-3e561f148fcba627f8fbd4ab1089f426fbc2e61b.tar.xz nova-3e561f148fcba627f8fbd4ab1089f426fbc2e61b.zip | |
adding sqlalchemi api tests for test_instance_get_all_by_filter to ensure doesn't return deleted instances
| -rw-r--r-- | nova/tests/test_cloud.py | 1 | ||||
| -rw-r--r-- | nova/tests/test_db_api.py | 15 |
2 files changed, 15 insertions, 1 deletions
diff --git a/nova/tests/test_cloud.py b/nova/tests/test_cloud.py index 07a35c447..39358eeff 100644 --- a/nova/tests/test_cloud.py +++ b/nova/tests/test_cloud.py @@ -494,7 +494,6 @@ class CloudTestCase(test.TestCase): db.instance_destroy(self.context, inst1.id) result = self.cloud.describe_instances(self.context) result = result['reservationSet'][0]['instancesSet'] - print result self.assertEqual(1, len(result)) def _block_device_mapping_create(self, instance_id, mappings): diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py index 0c07cbb7c..ed363d1be 100644 --- a/nova/tests/test_db_api.py +++ b/nova/tests/test_db_api.py @@ -76,3 +76,18 @@ class DbApiTestCase(test.TestCase): self.assertEqual(instance['id'], result['id']) self.assertEqual(result['fixed_ips'][0]['floating_ips'][0].address, '1.2.1.2') + + def test_instance_get_all_by_filters(self): + args = {'reservation_id': 'a', 'image_ref': 1, 'host': 'host1'} + inst1 = db.instance_create(self.context, args) + inst2 = db.instance_create(self.context, args) + result = db.instance_get_all_by_filters(self.context, {}) + self.assertTrue(2, len(result)) + + def test_instance_get_all_by_filters_deleted(self): + args = {'reservation_id': 'a', 'image_ref': 1, 'host': 'host1'} + inst1 = db.instance_create(self.context, args) + inst2 = db.instance_create(self.context, args) + db.instance_destroy(self.context, inst1.id) + result = db.instance_get_all_by_filters(self.context, {}) + self.assertTrue(1, len(result)) |
