Marvin: Register template

This commit is contained in:
Frank Maximus 2018-09-11 18:20:29 +02:00
parent 41fcf43057
commit b728e23e53
2 changed files with 25 additions and 8 deletions

View File

@ -52,7 +52,7 @@ from marvin.lib.base import (Account,
Hypervisor, Template)
from marvin.lib.common import (get_domain,
get_template,
get_zone)
get_zone, get_test_template)
from marvin.lib.utils import random_gen
# Import System Modules
from nose.plugins.attrib import attr
@ -100,6 +100,19 @@ class Services:
def __init__(self):
self.services = {
"test_templates": {
"kvm": {
"name": "Centos-5.5-configdrive",
"displaytext": "ConfigDrive enabled CentOS",
"format": "qcow2",
"hypervisor": "kvm",
"ostype": "CentOS 5.5 (64-bit)",
"url": "http://people.apache.org/~fmaximus/centos55-extended.qcow2.bz2",
"requireshvm": "False",
"ispublic": "True",
"isextractable": "True"
}
},
"vpc_offering_configdrive": {
"name": 'VPC offering ConfigDrive',
"displaytext": 'VPC offering ConfigDrive',
@ -1144,17 +1157,19 @@ class TestConfigDrive(cloudstackTestCase, ConfigDriveUtils):
cls.api_client = test_client.getApiClient()
cls.db_client = test_client.getDbConnection()
cls.test_data = test_client.getParsedTestDataConfig()
cls.test_data.update(Services().services)
# Get Zone, Domain and templates
cls.zone = get_zone(cls.api_client)
cls.domain = get_domain(cls.api_client)
cls.template = get_template(cls.api_client,
cls.zone.id,
cls.test_data["ostype"]
)
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.template = get_test_template(cls.api_client,
cls.zone.id,
cls.hypervisor,
cls.test_data["test_templates"])
cls.test_data["virtual_machine"]["zoneid"] = cls.zone.id
cls.test_data["virtual_machine"]["template"] = cls.template.id
cls.test_data.update(Services().services)
# Create service offering
cls.service_offering = ServiceOffering.create(

View File

@ -345,14 +345,16 @@ def get_template(
return list_templatesout[0]
def get_test_template(apiclient, zone_id=None, hypervisor=None):
def get_test_template(apiclient, zone_id=None, hypervisor=None, test_templates=None):
"""
@Name : get_test_template
@Desc : Retrieves the test template used to running tests. When the template
is missing it will be download at most one in a zone for a hypervisor.
@Input : returns a template
"""
test_templates = test_data["test_templates"]
if test_templates is None:
test_templates = test_data["test_templates"]
if hypervisor is None:
return FAILED