Fixed nova notifier unit test

This fixed the bug #1221033 caused by the latest nova chagnes.

Temproarily enlarge the max allowed connection to mongoDB as a
workaround for bug #1218488. That bug should be addressed by
https://review.openstack.org/44465

Change-Id: I49d82bcc2c1ac6481b0f5d321db2f70549a95d55
This commit is contained in:
Lianhao Lu 2013-09-05 14:05:11 +08:00
parent 3cd78fdec4
commit 27937c395d
2 changed files with 31 additions and 5 deletions

View File

@ -139,11 +139,37 @@ class TestNovaNotifier(base.TestCase):
"access_ip_v6": "2001:DB8::0", "access_ip_v6": "2001:DB8::0",
"metadata": {}, "metadata": {},
"uuid": "144e08f4-00cb-11e2-888e-5453ed1bbb5f", "uuid": "144e08f4-00cb-11e2-888e-5453ed1bbb5f",
"system_metadata": {}} "system_metadata": {},
"user_data": None,
"cleaned": 0,
"deleted": None,
"vm_mode": None,
"deleted_at": None,
"disable_terminate": False,
"root_device_name": None,
"default_swap_device": None,
"launched_on": None,
"display_description": None,
"key_data": None,
"key_name": None,
"config_drive": None,
"power_state": None,
"default_ephemeral_device": None,
"progress": 0,
"scheduled_at": None,
"updated_at": None,
"shutdown_terminate": False,
"cell_name": 'cell',
"locked": False,
"locked_by": None,
"launch_index": 0,
"auto_disk_config": False,
}
self.instance = nova_instance.Instance() self.instance = nova_instance.Instance()
for key, value in self.instance_data.iteritems(): self.instance = nova_instance.Instance._from_db_object(
setattr(self.instance, key, value) context, self.instance, self.instance_data,
expected_attrs=['metadata', 'system_metadata'])
self.stubs.Set(db, 'instance_info_cache_delete', self.do_nothing) self.stubs.Set(db, 'instance_info_cache_delete', self.do_nothing)
self.stubs.Set(db, 'instance_destroy', self.do_nothing) self.stubs.Set(db, 'instance_destroy', self.do_nothing)
@ -152,7 +178,7 @@ class TestNovaNotifier(base.TestCase):
self.stubs.Set(db, 'block_device_mapping_get_all_by_instance', self.stubs.Set(db, 'block_device_mapping_get_all_by_instance',
lambda context, instance: {}) lambda context, instance: {})
self.stubs.Set(db, 'instance_update_and_get_original', self.stubs.Set(db, 'instance_update_and_get_original',
lambda context, uuid, kwargs: (self.instance, lambda context, uuid, kwargs, update_cells: (self.instance,
self.instance)) self.instance))
self.stubs.Set(flavors, 'extract_flavor', self.stubs.Set(flavors, 'extract_flavor',
lambda ref: {}) lambda ref: {})

View File

@ -26,7 +26,7 @@ MONGO_DATA=`mktemp -d /tmp/CEILO-MONGODB-XXXXX`
trap "clean_exit" EXIT trap "clean_exit" EXIT
mkfifo ${MONGO_DATA}/out mkfifo ${MONGO_DATA}/out
export PATH=${PATH:+$PATH:}/sbin:/usr/sbin export PATH=${PATH:+$PATH:}/sbin:/usr/sbin
mongod --maxConns 128 --nojournal --noprealloc --smallfiles --quiet --noauth --port 29000 --dbpath "${MONGO_DATA}" --bind_ip localhost &>${MONGO_DATA}/out & mongod --maxConns 256 --nojournal --noprealloc --smallfiles --quiet --noauth --port 29000 --dbpath "${MONGO_DATA}" --bind_ip localhost &>${MONGO_DATA}/out &
MONGO_PID=$! MONGO_PID=$!
# Wait for Mongo to start listening to connections # Wait for Mongo to start listening to connections
while read line while read line