Instantiate novaclient managers for test data.
Some novaclient resources now have a "human_id" property which requires a call to a bound method on the manager. Thereby we need to instantiate the managers in the test data rather than simply passing the class. Fixes bug 958857. There's also some cleanup on the test settings here, to remove some outdated settings and to use an in-memory database instead of a file on disk. Change-Id: I1331e4ae5658b45d01b8247623554c5c43f67578
This commit is contained in:
parent
9fbca56439
commit
b53d08386f
@ -142,7 +142,7 @@ def data(TEST):
|
||||
TEST.volume_snapshots = TestDataContainer()
|
||||
|
||||
# Volumes
|
||||
volume = volumes.Volume(volumes.VolumeManager,
|
||||
volume = volumes.Volume(volumes.VolumeManager(None),
|
||||
dict(id="1",
|
||||
name='test_volume',
|
||||
status='available',
|
||||
@ -152,14 +152,14 @@ def data(TEST):
|
||||
TEST.volumes.add(volume)
|
||||
|
||||
# Flavors
|
||||
flavor_1 = flavors.Flavor(flavors.FlavorManager,
|
||||
flavor_1 = flavors.Flavor(flavors.FlavorManager(None),
|
||||
{'id': "1",
|
||||
'name': 'm1.tiny',
|
||||
'vcpus': 1,
|
||||
'disk': 0,
|
||||
'ram': 512,
|
||||
'OS-FLV-EXT-DATA:ephemeral': 0})
|
||||
flavor_2 = flavors.Flavor(flavors.FlavorManager,
|
||||
flavor_2 = flavors.Flavor(flavors.FlavorManager(None),
|
||||
{'id': "2",
|
||||
'name': 'm1.massive',
|
||||
'vcpus': 1000,
|
||||
@ -169,18 +169,19 @@ def data(TEST):
|
||||
TEST.flavors.add(flavor_1, flavor_2)
|
||||
|
||||
# Keypairs
|
||||
keypair = keypairs.Keypair(keypairs.KeypairManager,
|
||||
keypair = keypairs.Keypair(keypairs.KeypairManager(None),
|
||||
dict(name='keyName'))
|
||||
TEST.keypairs.add(keypair)
|
||||
|
||||
# Security Groups
|
||||
sec_group_1 = sec_groups.SecurityGroup(sec_groups.SecurityGroupManager,
|
||||
sg_manager = sec_groups.SecurityGroupManager(None)
|
||||
sec_group_1 = sec_groups.SecurityGroup(sg_manager,
|
||||
{"rules": [],
|
||||
"tenant_id": TEST.tenant.id,
|
||||
"id": 1,
|
||||
"name": u"default",
|
||||
"description": u"default"})
|
||||
sec_group_2 = sec_groups.SecurityGroup(sec_groups.SecurityGroupManager,
|
||||
sec_group_2 = sec_groups.SecurityGroup(sg_manager,
|
||||
{"rules": [],
|
||||
"tenant_id": TEST.tenant.id,
|
||||
"id": 2,
|
||||
@ -193,7 +194,8 @@ def data(TEST):
|
||||
'to_port': u"80",
|
||||
'parent_group_id': 1,
|
||||
'ip_range': {'cidr': u"0.0.0.0/32"}}
|
||||
rule_obj = rules.SecurityGroupRule(rules.SecurityGroupRuleManager, rule)
|
||||
rule_obj = rules.SecurityGroupRule(rules.SecurityGroupRuleManager(None),
|
||||
rule)
|
||||
TEST.security_group_rules.add(rule_obj)
|
||||
|
||||
sec_group_1.rules = [rule_obj]
|
||||
@ -212,7 +214,7 @@ def data(TEST):
|
||||
instances='10',
|
||||
injected_files='1',
|
||||
cores='10')
|
||||
quota = quotas.QuotaSet(quotas.QuotaSetManager, quota_data)
|
||||
quota = quotas.QuotaSet(quotas.QuotaSetManager(None), quota_data)
|
||||
TEST.quotas.add(quota)
|
||||
|
||||
# Quota Usages
|
||||
@ -239,12 +241,12 @@ def data(TEST):
|
||||
"flavor_id": flavor_1.id,
|
||||
"image_id": TEST.images.first().id,
|
||||
"key_name": keypair.name}
|
||||
server_1 = servers.Server(servers.ServerManager,
|
||||
server_1 = servers.Server(servers.ServerManager(None),
|
||||
json.loads(SERVER_DATA % vals)['server'])
|
||||
vals.update({"name": "server_2",
|
||||
"status": "BUILD",
|
||||
"server_id": "2"})
|
||||
server_2 = servers.Server(servers.ServerManager,
|
||||
server_2 = servers.Server(servers.ServerManager(None),
|
||||
json.loads(SERVER_DATA % vals)['server'])
|
||||
TEST.servers.add(server_1, server_2)
|
||||
|
||||
@ -253,7 +255,7 @@ def data(TEST):
|
||||
u'type': u'novnc'}}
|
||||
TEST.servers.console_data = console
|
||||
# Floating IPs
|
||||
fip_1 = floating_ips.FloatingIP(floating_ips.FloatingIPManager,
|
||||
fip_1 = floating_ips.FloatingIP(floating_ips.FloatingIPManager(None),
|
||||
{'id': 1,
|
||||
'fixed_ip': '10.0.0.4',
|
||||
'instance_id': server_1.id,
|
||||
@ -267,11 +269,11 @@ def data(TEST):
|
||||
"flavor_vcpus": flavor_1.vcpus,
|
||||
"flavor_disk": flavor_1.disk,
|
||||
"flavor_ram": flavor_1.ram}
|
||||
usage_obj = usage.Usage(usage.UsageManager,
|
||||
usage_obj = usage.Usage(usage.UsageManager(None),
|
||||
json.loads(USAGE_DATA % usage_vals))
|
||||
TEST.usages.add(usage_obj)
|
||||
|
||||
volume_snapshot = vol_snaps.Snapshot(vol_snaps.SnapshotManager,
|
||||
volume_snapshot = vol_snaps.Snapshot(vol_snaps.SnapshotManager(None),
|
||||
{'id': 2,
|
||||
'displayName': 'test snapshot',
|
||||
'displayDescription': 'vol snap!',
|
||||
@ -282,5 +284,5 @@ def data(TEST):
|
||||
|
||||
cert_data = {'private_key': 'private',
|
||||
'data': 'certificate_data'}
|
||||
certificate = certs.Certificate(certs.CertificateManager, cert_data)
|
||||
certificate = certs.Certificate(certs.CertificateManager(None), cert_data)
|
||||
TEST.certs.add(certificate)
|
||||
|
@ -26,11 +26,8 @@ socket.setdefaulttimeout(1)
|
||||
ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||
DEBUG = True
|
||||
TESTSERVER = 'http://testserver'
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': '/tmp/horizon.db',
|
||||
'TEST_NAME': '/tmp/test_horizon.db'}}
|
||||
|
||||
DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3'}}
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.sessions',
|
||||
@ -67,14 +64,6 @@ TEMPLATE_DIRS = (os.path.join(ROOT_PATH, 'tests', 'templates'))
|
||||
SITE_ID = 1
|
||||
SITE_BRANDING = 'OpenStack'
|
||||
SITE_NAME = 'openstack'
|
||||
ENABLE_VNC = True
|
||||
NOVA_DEFAULT_ENDPOINT = None
|
||||
NOVA_DEFAULT_REGION = 'test'
|
||||
NOVA_ACCESS_KEY = 'test'
|
||||
NOVA_SECRET_KEY = 'test'
|
||||
|
||||
CREDENTIAL_AUTHORIZATION_DAYS = 2
|
||||
CREDENTIAL_DOWNLOAD_URL = TESTSERVER + '/credentials/'
|
||||
|
||||
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
|
||||
NOSE_ARGS = ['--nocapture',
|
||||
|
@ -6,7 +6,7 @@ set -o errexit
|
||||
# Increment me any time the environment should be rebuilt.
|
||||
# This includes dependncy changes, directory renames, etc.
|
||||
# Simple integer secuence: 1, 2, 3...
|
||||
environment_version=13
|
||||
environment_version=14
|
||||
#--------------------------------------------------------#
|
||||
|
||||
function usage {
|
||||
|
Loading…
Reference in New Issue
Block a user