This Page

Psst... hey. You're reading the latest content, but it might be out of sync with code. You can read Nova 2011.2 docs or all OpenStack docs too.

The nova.tests.test_xenapi Module

Test suite for XenAPI.

class nova.tests.test_xenapi.CompareVersionTestCase(methodName='runTest')

Bases: nova.test.TestCase

test_equal()

Test that cmp_version compares a as equal to b

test_greater_than()

Test that cmp_version compares a as greater than b

test_length()

Test that cmp_version compares by length as last resort

test_less_than()

Test that cmp_version compares a as less than b

test_non_lexical()

Test that cmp_version compares non-lexically

class nova.tests.test_xenapi.FakeSession

Bases: object

Fake Session class for HostState testing.

async_call_plugin(*args)
get_xenapi()
wait_for_task(*args)
class nova.tests.test_xenapi.FakeXenApi

Bases: object

Fake XenApi for testing HostState.

class FakeSR

Bases: object

get_record(ref)
class nova.tests.test_xenapi.HostStateTestCase(methodName='runTest')

Bases: nova.test.TestCase

Tests HostState, which holds metrics from XenServer that get reported back to the Schedulers.

test_host_state()
class nova.tests.test_xenapi.XenAPIDetermineDiskImageTestCase(methodName='runTest')

Bases: nova.test.TestCase

Unit tests for code that detects the ImageType.

assert_disk_type(disk_type)
setUp()
test_glance_disk_raw()

If we’re using Glance, then defer to the image_type field, which in this case will be ‘raw’.

test_glance_disk_vhd()

If we’re using Glance, then defer to the image_type field, which in this case will be ‘vhd’.

test_instance_disk()

If a kernel is specified, the image type is DISK (aka machine).

test_instance_disk_raw()

If the kernel isn’t specified, and we’re not using Glance, then DISK_RAW is assumed.

class nova.tests.test_xenapi.XenAPIDiffieHellmanTestCase(methodName='runTest')

Bases: nova.test.TestCase

Unit tests for Diffie-Hellman code.

setUp()
tearDown()
test_encrypt_many_newlines_at_end()
test_encrypt_message_with_newlines_at_end()
test_encrypt_newlines_inside_message()
test_encrypt_really_long_message()
test_encrypt_simple_message()
test_encrypt_with_leading_newlines()
test_shared()
class nova.tests.test_xenapi.XenAPIImageTypeTestCase(methodName='runTest')

Bases: nova.test.TestCase

Test ImageType class.

test_from_string()

Can convert from string to type id.

test_to_string()

Can convert from type id to type string.

class nova.tests.test_xenapi.XenAPIMigrateInstance(methodName='runTest')

Bases: nova.test.TestCase

Unit test for verifying migration-related actions.

setUp()
test_finish_migrate()
test_finish_migrate_no_local_storage()
test_finish_migrate_no_resize_vdi()
test_migrate_disk_and_power_off()
test_revert_migrate()
class nova.tests.test_xenapi.XenAPIVMTestCase(methodName='runTest')

Bases: nova.test.TestCase

Unit tests for VM operations.

check_vm_params_for_linux()
check_vm_params_for_linux_with_external_kernel()
check_vm_params_for_windows()
check_vm_record(conn, check_injection=False)
create_vm_record(conn, os_type, instance_id=1)
setUp()
test_get_diagnostics()
test_instance_snapshot()
test_instance_snapshot_fails_with_no_primary_vdi()
test_list_instances_0()
test_rescue()
test_revert_migration()
test_spawn_empty_dns()

“Test spawning with an empty dns list

test_spawn_fail_cleanup_1()

Simulates an error while downloading an image.

Verifies that VDIs created are properly cleaned up.

test_spawn_fail_cleanup_2()

Simulates an error while creating VM record.

It verifies that VDIs created are properly cleaned up.

test_spawn_glance()
test_spawn_iso_glance()
test_spawn_netinject_file()
test_spawn_netinject_xenstore()
test_spawn_not_enough_memory()
test_spawn_raw_glance(*args, **kwargs)
test_spawn_vhd_glance_linux()
test_spawn_vhd_glance_swapdisk()
test_spawn_vhd_glance_windows()
test_spawn_vlanmanager()
test_spawn_with_network_qos()
test_unrescue()
class nova.tests.test_xenapi.XenAPIVolumeTestCase(methodName='runTest')

Bases: nova.test.TestCase

Unit tests for Volume operations.

setUp()
tearDown()
test_attach_volume()

This shows how to test Ops classes’ methods.

test_attach_volume_raise_exception()

This shows how to test when exceptions are raised.

test_create_iscsi_storage()

This shows how to test helper classes’ methods.

test_parse_volume_info_raise_exception()

This shows how to test helper classes’ methods.

nova.tests.test_xenapi.reset_network(*args)
nova.tests.test_xenapi.stub_vm_utils_with_vdi_attached_here(function, should_return=True)

vm_utils.with_vdi_attached_here needs to be stubbed out because it calls down to the filesystem to attach a vdi. This provides a decorator to handle that.