nova/nova/tests
Aaron Rosen c76ee403f2 quantum security group driver nova list shows same group
When using the quantum security group driver nova list shows the
same security group for all instances. This patch fixes this and
corrects the unit test that was hiding this bug. This also adds a unit test
to check that the default security group is added to the response when
not specified.

Fixes bug  1162077

Change-Id: I7a10f81af1bb6c93f634dc0de27841afe0f1f0ea
2013-03-29 17:51:12 -07:00
..
CA
api quantum security group driver nova list shows same group 2013-03-29 17:51:12 -07:00
baremetal Correct substring matching of baremetal VPD node names 2013-03-08 09:40:30 -08:00
bundle
cells Fix console support with cells 2013-03-19 21:54:00 +00:00
cert Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
compute Merge "Fix automatic confirmation of resizes for no-db-compute" into milestone-proposed 2013-03-29 22:02:32 +00:00
conductor Fix automatic confirmation of resizes for no-db-compute 2013-03-29 11:00:03 -07:00
console Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
consoleauth Fix console support with cells 2013-03-19 21:54:00 +00:00
db Compile BigInteger to INTEGER for sqlite 2013-03-08 14:10:28 -06:00
fake_loadables Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
glance delete deleted image 500 bug 2013-03-05 09:03:32 -06:00
hyperv Fixes disk size issue during image boot on Hyper-V 2013-03-04 13:17:49 +02:00
image Reset ec2 image cache between S3 tests. 2013-03-27 11:07:06 +01:00
integrated Set default fixed_ip quota to unlimited. 2013-03-29 14:24:00 +11:00
monkey_patch_example Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
network always quote dhcp-domain, otherwise dnsmasq can fail to start 2013-03-28 10:16:09 -04:00
scheduler Remove uses of instance['instance_type'] from nova/scheduler 2013-03-08 13:09:56 -05:00
servicegroup Fix IBM copyright strings 2013-03-01 14:18:23 -05:00
ssl_cert Adds SSL support for API server. 2013-01-23 08:49:16 -05:00
virt Fix missing argument to QemuImageInfo 2013-03-19 17:38:56 -04:00
vmwareapi Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
volume Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
xenapi Fix rebuild with volumes attached 2013-01-30 18:13:26 +00:00
README.rst Update docs about testing. 2013-02-11 19:04:43 -08:00
__init__.py Move global fixture setup into nova/test.py 2012-11-22 11:23:11 -08:00
conf_fixture.py Use oslo-config-2013.1b4 2013-02-19 21:16:32 -08:00
fake_crypto.py
fake_hosts.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
fake_imagebackend.py Add support for instance disk IO control. 2013-02-19 15:18:56 +08:00
fake_instance_actions.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
fake_ldap.py
fake_libvirt_utils.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
fake_network.py Revert "Remove the usage of instance['extra_specs' 2013-03-16 10:26:02 -04:00
fake_network_cache_model.py Update instance network info cache to include vif_type. 2013-03-27 01:39:11 +08:00
fake_policy.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
fake_utils.py
fake_volume.py Use oslo-config-2013.1b4 2013-02-19 21:16:32 -08:00
fakeguestfs.py Make guestfs use same libvirt URI as Nova. 2013-02-22 09:54:38 -05:00
fakelibvirt.py Merge "Update OpenStack LLC to Foundation" 2013-02-27 17:44:08 +00:00
matchers.py Fix XMLMatcher error reporting 2013-02-19 19:56:26 +00:00
policy_fixture.py Use oslo-config-2013.1b4 2013-02-19 21:16:32 -08:00
test_api.py Fix boto capabilities check 2013-01-30 11:58:42 +00:00
test_availability_zones.py List AZs fails if there are disabled services 2013-03-27 16:27:31 -07:00
test_baremetal_migrations.conf Add better status to baremetal deployments. 2013-02-20 09:55:02 -08:00
test_bdm.py Removed print stmts in test cases 2013-01-29 12:55:14 -05:00
test_block_device.py DRYing up volume_in_mapping code. 2013-01-30 18:10:11 +00:00
test_cinder.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_configdrive2.py Merge "Chown doesn't work on mounted vfat." 2013-01-14 22:28:01 +00:00
test_context.py Fix RequestContext crashes w/ no service catalog 2013-03-18 18:06:52 -04:00
test_crypto.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_db_api.py Merge "Add missing tests for db.virtual_interface_* methods" 2013-03-20 03:22:33 +00:00
test_driver.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_exception.py Add a format_message method to the Exceptions 2013-03-27 19:27:05 -07:00
test_fakelibvirt.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_filters.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_hooks.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_hypervapi.py Fixes Hyper-V live migration with attached volumes 2013-03-14 04:31:27 +02:00
test_image_utils.py Verify the disk file exists before running qemu-img on it. 2012-12-25 07:56:30 +11:00
test_imagebackend.py Merge "Use oslo-config-2013.1b4" 2013-02-20 08:50:18 +00:00
test_imagecache.py Clean unused kernels and ramdisks from image cache 2013-02-23 16:18:47 +00:00
test_instance_types.py Merge "Remove instance['instance_type'] relationship from db api" 2013-03-12 16:58:49 +00:00
test_instance_types_extra_specs.py Remove restoring soft deleted entries part 1 2013-01-18 21:31:03 +04:00
test_iptables_network.py clear up method parameters for _modify_rules 2013-03-08 09:32:31 +01:00
test_ipv6.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_libvirt.py Fix use of libvirt_disk_prefix 2013-03-15 15:13:31 -06:00
test_libvirt_blockinfo.py Remove uses of instance['instance_type'] from libvirt driver. 2013-03-06 17:31:13 -05:00
test_libvirt_config.py Fix XML config tests for disk/net/cpu tuning 2013-02-19 19:56:25 +00:00
test_libvirt_utils.py Verify the disk file exists before running qemu-img on it. 2012-12-25 07:56:30 +11:00
test_libvirt_vif.py Add a 'hw_' namespace to glance hardware config properties 2013-02-27 13:12:49 +00:00
test_libvirt_volume.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_loadables.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_matchers.py Implement an XML matcher 2012-12-11 14:36:31 -06:00
test_metadata.py Remove uses of instance['instance_type'] from nova/api 2013-03-08 13:09:56 -05:00
test_migration_utils.py Compile BigInteger to INTEGER for sqlite 2013-03-08 14:10:28 -06:00
test_migrations.conf
test_migrations.py Update migration 153 for efficiency. 2013-03-14 19:45:38 -04:00
test_misc.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_notifications.py Remove uses of instance['instance_type'] from nova/notifications 2013-03-09 17:17:07 +00:00
test_nova_manage.py Fix: nova-manage throws uncaught exception on invalid host/service 2013-03-12 15:06:07 +01:00
test_objectstore.py Use oslo-config-2013.1b4 2013-02-19 21:16:32 -08:00
test_periodic_tasks.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_pipelib.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_plugin_api_extensions.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_policy.py fix N402 for nova/tests 2013-01-09 00:17:51 -05:00
test_powervm.py Fixes PowerVM spawn failed as missing attr supported_instances 2013-03-19 07:09:00 +08:00
test_quota.py Add quotas for fixed ips. 2013-03-15 03:42:48 +11:00
test_safeutils.py Remove parameters containing passwords from Notifications. 2013-03-05 16:27:29 -04:00
test_service.py Use oslo-config-2013.1b4 2013-02-19 21:16:32 -08:00
test_test.py Use oslo-config-2013.1b4 2013-02-19 21:16:32 -08:00
test_test_utils.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_utils.py Makes safe xml data calls raise 400 http error instead of 500 2013-03-14 13:31:02 +00:00
test_versions.py Use oslo-config-2013.1b4 2013-02-19 21:16:32 -08:00
test_virt.py Teardown container rootfs in host namespace for lxc 2012-12-24 18:08:56 +08:00
test_virt_disk.py Fix authorized_keys file permissions 2013-01-28 21:04:35 -05:00
test_virt_disk_vfs_guestfs.py Correct exception args in vfs/guestfs. 2013-03-10 21:51:39 -04:00
test_virt_disk_vfs_localfs.py Remove unnecessary setUp() and tearDown() methods 2013-03-06 23:58:59 +00:00
test_virt_drivers.py Remove unnecessary setUp() and tearDown() methods 2013-03-06 23:58:59 +00:00
test_vmmode.py
test_vmwareapi.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_vmwareapi_vmops.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_wsgi.py Increase maximum URI size for EC2 API to 16k 2013-01-24 17:11:10 -06:00
test_xenapi.py Merge "Fix XenAPI performance issue" 2013-03-18 22:47:13 +00:00
utils.py Makes safe xml data calls raise 400 http error instead of 500 2013-03-14 13:31:02 +00:00

README.rst

OpenStack Nova Testing Infrastructure

This README file attempts to provide current and prospective contributors with everything they need to know in order to start creating unit tests for nova.

Note: the content for the rest of this file will be added as the work items in the following blueprint are completed: https://blueprints.launchpad.net/nova/+spec/consolidate-testing-infrastructure

Test Types: Unit vs. Functional vs. Integration

TBD

Writing Unit Tests

TBD

Using Fakes

TBD

test.TestCase

The TestCase class from nova.test (generally imported as test) will automatically manage self.stubs using the stubout module and self.mox using the mox module during the setUp step. They will automatically verify and clean up during the tearDown step.

If using test.TestCase, calling the super class setUp is required and calling the super class tearDown is required to be last if tearDown is overriden.

Writing Functional Tests

TBD

Writing Integration Tests

TBD

Tests and Exceptions

A properly written test asserts that particular behavior occurs. This can be a success condition or a failure condition, including an exception. When asserting that a particular exception is raised, the most specific exception possible should be used.

In particular, testing for Exception being raised is almost always a mistake since it will match (almost) every exception, even those unrelated to the exception intended to be tested.

This applies to catching exceptions manually with a try/except block, or using assertRaises().

Example:

self.assertRaises(exception.InstanceNotFound, db.instance_get_by_uuid,
                  elevated, instance_uuid)

If a stubbed function/method needs a generic exception for testing purposes, test.TestingException is available.

Example:

def stubbed_method(self):
    raise test.TestingException()
self.stubs.Set(cls, 'inner_method', stubbed_method)

obj = cls()
self.assertRaises(test.TestingException, obj.outer_method)