nova/nova/tests
Ryan Moore 3e451f1bac use 'os_type' in ephemeral filename only if mkfs defined
Currently for undefined os-types it will use the default mkfs
command, but use the meta 'os_type' in the name of the
ephemeral file (e.g. ephemeral_20_abcdef). Which can result
in a lot of files (DoS?)
This change will only use 'os_type' in the ephemeral filename
if there is a specific mkfs command defined, otherwise it will
use 'default' (e.g. ephemeral_20_default)

Modifed the tests to test for:
  os_type=''
  os_type=None
  os_type='test' - with no mkfs command specified
  os_type='test' - with a mkfs command specified

Closes-Bug: 1253980

Backport of Original Change-Id: Ie4c10f99ce690c5e4ef181624bd688c38923855c
to stable/grizzly

Change-Id: Ia040910e90861a2987eff345ad1c01863655b124
2013-12-18 15:24:15 +01:00
..
CA
api Filter network by project id 2013-09-09 15:58:32 +08:00
baremetal Fix baremetal get_available_nodes 2013-05-01 16:09:02 -04:00
bundle
cells Don't update API cell on get_nwinfo 2013-05-29 16:52:08 +00:00
cert Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
compute Merge "Check instance on dest once during block migration" into stable/grizzly 2013-10-15 00:16:50 +00:00
conductor Make compute/manager use conductor for unrescue() 2013-04-22 10:31:13 -07:00
console Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
consoleauth Delete expired instance console auth tokens 2013-09-03 10:33:03 +08:00
db Allow listing fixed_ips for a given compute host. 2013-05-02 14:45:15 +10: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 Merge "Fix inconsistency between Nova-Net and Neutron" into stable/grizzly 2013-11-19 05:56:06 +00:00
scheduler Merge "Reset migrating task state for MigrationError exceptions" into stable/grizzly 2013-08-02 18:54:25 +00:00
servicegroup Fix zookeeper import and tests 2013-05-09 22:14:43 -04:00
ssl_cert Adds SSL support for API server. 2013-01-23 08:49:16 -05:00
virt Fix hyper-v vhd real size bigger than flavor issue 2013-09-18 13:58:05 +08:00
vmwareapi Naming instance directory by uuid in VMware Hyper. 2013-07-24 00:21:32 -07: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
conf_fixture.py Make nova.virt.fake.FakeDriver useable in integration testing 2013-05-16 16:26:24 -04: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 ensure we don't boot oversized images 2013-10-31 17:05:59 +01:00
fake_network.py Fix simultaneous timeout with smart iptables usage 2013-08-12 08:33:36 -07: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 Fix EC2 instance bdm response 2013-05-06 11:15:18 -04:00
fakeguestfs.py fix libguestfs mount order when inspecting 2013-08-21 12:10:36 +01:00
fakelibvirt.py Don't deallocate network if destroy time out 2013-07-10 15:45:48 -07: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 Further harden boto version checking in EC2 tests 2013-10-14 18:01:15 -07: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 Ensure anti affinity scheduling works 2013-11-07 10:04:43 +08: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 Merge "Check instance on dest once during block migration" into stable/grizzly 2013-10-15 00:16:50 +00: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 ensure we don't boot oversized images 2013-10-31 17:05:59 +01: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 Fix simultaneous timeout with smart iptables usage 2013-08-12 08:33:36 -07:00
test_ipv6.py Update OpenStack LLC to Foundation 2013-02-26 19:15:29 -05:00
test_libvirt.py use 'os_type' in ephemeral filename only if mkfs defined 2013-12-18 15:24:15 +01:00
test_libvirt_blockinfo.py Config drive attached as cdrom 2013-07-30 22:21:27 -07: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 inst_type parameter 2013-07-23 21:08:26 -04:00
test_libvirt_volume.py Detach volume fails when using multipath iscsi 2013-05-16 11:32:40 -07:00
test_linuxscsi.py Fix for missing multipath device name 2013-05-16 16:36:11 -04: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 Prevent spoofing instance_id from neutron to nova 2013-12-11 12:37:08 -08: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 Merge "Raise rather than generating millions of IPs." into stable/grizzly 2013-05-02 18:33:41 +00:00
test_objectstore.py Add boto special casing for param changes in 2.13 2013-10-11 03:49:24 -07: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 Remove junk file when ftp transfer failure 2013-07-02 19:47:56 -07: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 VMware: Ensure Quantum networking works with VMware drivers 2013-08-20 22:22:43 -07: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 fix libguestfs mount order when inspecting 2013-08-21 12:10:36 +01: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 Merge "Fix resizes with attached file-based volumes" into stable/grizzly 2013-08-02 02:25:02 +00:00
test_vmmode.py
test_vmwareapi.py VMWare: Disabling linked clone doesn't cache images 2013-10-09 02:18:59 -07:00
test_vmwareapi_vif.py VMware: Network fallback in case specified one not found 2013-10-08 08:44:01 -07:00
test_vmwareapi_vm_util.py Merge "Fixes host stats for VMWareVCDriver" into stable/grizzly 2013-10-08 21:45:53 +00:00
test_vmwareapi_vmops.py VMware: Ensure Quantum networking works with VMware drivers 2013-08-20 22:22:43 -07:00
test_wsgi.py Increase maximum URI size for EC2 API to 16k 2013-01-24 17:11:10 -06:00
test_xenapi.py xenapi: enforce filters after live-migration 2013-10-29 17:32:38 +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)