Skip to content

Commit 2c561dd

Browse files
author
Prasanna Santhanam
committed
Summary: Removing ostypeid dependencies from tests
Detail: The listOsTypes API will filter when given the ostype name as centOS 5.3. There is now no need to hardcode the uuids into the test Signed-off-by: Prasanna Santhanam <tsp@apache.org> 1354228309 -0800
1 parent 6036f73 commit 2c561dd

9 files changed

Lines changed: 182 additions & 46 deletions

File tree

test/integration/component/test_snapshots.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def __init__(self):
105105
"templates": {
106106
"displaytext": 'Template',
107107
"name": 'Template',
108-
"ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
108+
"ostype": "CentOS 5.3 (64-bit)",
109109
"templatefilter": 'self',
110110
},
111111
"diskdevice": "/dev/xvda",
@@ -117,8 +117,7 @@ def __init__(self):
117117
"sub_lvl_dir1": "test1",
118118
"sub_lvl_dir2": "test2",
119119
"random_data": "random.data",
120-
121-
"ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
120+
"ostype": "CentOS 5.3 (64-bit)",
122121
# Cent OS 5.3 (64 bit)
123122
"sleep": 60,
124123
"timeout": 10,
@@ -139,11 +138,11 @@ def setUpClass(cls):
139138
template = get_template(
140139
cls.api_client,
141140
cls.zone.id,
142-
cls.services["ostypeid"]
141+
cls.services["ostype"]
143142
)
144143
cls.services["domainid"] = cls.domain.id
145144
cls.services["server_without_disk"]["zoneid"] = cls.zone.id
146-
cls.services["template"] = template.id
145+
cls.services["templates"]["ostypeid"] = template.ostypeid
147146
cls.services["zoneid"] = cls.zone.id
148147

149148
# Create VMs, NAT Rules etc
@@ -364,7 +363,7 @@ def setUpClass(cls):
364363
template = get_template(
365364
cls.api_client,
366365
cls.zone.id,
367-
cls.services["ostypeid"]
366+
cls.services["ostype"]
368367
)
369368

370369
cls.services["domainid"] = cls.domain.id
@@ -373,7 +372,7 @@ def setUpClass(cls):
373372

374373
cls.services["server_without_disk"]["zoneid"] = cls.zone.id
375374

376-
cls.services["template"] = template.id
375+
cls.services["templates"]["ostypeid"] = template.ostypeid
377376
cls.services["zoneid"] = cls.zone.id
378377
cls.services["diskoffering"] = cls.disk_offering.id
379378

@@ -1195,12 +1194,11 @@ def setUpClass(cls):
11951194
cls.template = get_template(
11961195
cls.api_client,
11971196
cls.zone.id,
1198-
cls.services["ostypeid"]
1197+
cls.services["ostype"]
11991198
)
12001199
cls.services["domainid"] = cls.domain.id
12011200
cls.services["server"]["zoneid"] = cls.zone.id
12021201

1203-
cls.services["template"] = cls.template.id
12041202

12051203
# Create VMs, NAT Rules etc
12061204
cls.account = Account.create(
@@ -1491,7 +1489,7 @@ def setUpClass(cls):
14911489
template = get_template(
14921490
cls.api_client,
14931491
cls.zone.id,
1494-
cls.services["ostypeid"]
1492+
cls.services["ostype"]
14951493
)
14961494
cls.services["server"]["zoneid"] = cls.zone.id
14971495

@@ -1843,7 +1841,7 @@ def setUpClass(cls):
18431841
template = get_template(
18441842
cls.api_client,
18451843
cls.zone.id,
1846-
cls.services["ostypeid"]
1844+
cls.services["ostype"]
18471845
)
18481846
cls.services["server"]["zoneid"] = cls.zone.id
18491847
cls.services["server"]["diskoffering"] = cls.disk_offering.id
@@ -2126,7 +2124,7 @@ def setUpClass(cls):
21262124
template = get_template(
21272125
cls.api_client,
21282126
cls.zone.id,
2129-
cls.services["ostypeid"]
2127+
cls.services["ostype"]
21302128
)
21312129
cls.services["server"]["zoneid"] = cls.zone.id
21322130

@@ -2384,7 +2382,7 @@ def setUpClass(cls):
23842382
template = get_template(
23852383
cls.api_client,
23862384
cls.zone.id,
2387-
cls.services["ostypeid"]
2385+
cls.services["ostype"]
23882386
)
23892387
cls.services["server"]["zoneid"] = cls.zone.id
23902388

test/integration/smoke/test_iso.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __init__(self):
5555
"isextractable": True,
5656
"isfeatured": True,
5757
"ispublic": True,
58-
"ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
58+
"ostype": "CentOS 5.3 (64-bit)",
5959
},
6060
"iso_2":
6161
{
@@ -66,7 +66,7 @@ def __init__(self):
6666
"isextractable": True,
6767
"isfeatured": True,
6868
"ispublic": True,
69-
"ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
69+
"ostype": "CentOS 5.3 (64-bit)",
7070
"mode": 'HTTP_DOWNLOAD',
7171
# Used in Extract template, value must be HTTP_DOWNLOAD
7272
},
@@ -79,7 +79,7 @@ def __init__(self):
7979
"passwordenabled": True,
8080
"sleep": 60,
8181
"timeout": 10,
82-
"ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
82+
"ostype": "CentOS 5.3 (64-bit)",
8383
# CentOS 5.3 (64 bit)
8484
"mode": 'advanced'
8585
# Networking mode: Basic or Advanced
@@ -103,7 +103,18 @@ def setUp(self):
103103
self.services["account"],
104104
domainid=self.domain.id
105105
)
106-
106+
# Finding the OsTypeId from Ostype
107+
ostypes = list_os_types(
108+
self.apiclient,
109+
description=self.services["ostype"]
110+
)
111+
if not isinstance(ostypes, list):
112+
raise unittest.SkipTest("OSTypeId for given description not found")
113+
114+
self.services["iso_1"]["ostypeid"] = ostypes[0].id
115+
self.services["iso_2"]["ostypeid"] = ostypes[0].id
116+
self.services["ostypeid"] = ostypes[0].id
117+
107118
self.cleanup = [self.account]
108119
return
109120

@@ -200,6 +211,18 @@ def setUpClass(cls):
200211
domainid=cls.domain.id
201212
)
202213
cls.services["account"] = cls.account.account.name
214+
# Finding the OsTypeId from Ostype
215+
ostypes = list_os_types(
216+
self.apiclient,
217+
description=self.services["ostype"]
218+
)
219+
if not isinstance(ostypes, list):
220+
raise unittest.SkipTest("OSTypeId for given description not found")
221+
222+
self.services["iso_1"]["ostypeid"] = ostypes[0].id
223+
self.services["iso_2"]["ostypeid"] = ostypes[0].id
224+
self.services["ostypeid"] = ostypes[0].id
225+
203226
cls.iso_1 = Iso.create(
204227
cls.api_client,
205228
cls.services["iso_1"],

test/integration/smoke/test_network.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Services:
3636

3737
def __init__(self):
3838
self.services = {
39-
"ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
39+
"ostype": "CentOS 5.3 (64-bit)",
4040
# Cent OS 5.3 (64 bit)
4141
"mode": 'advanced',
4242
# Networking mode: Basic or advanced
@@ -305,7 +305,7 @@ def setUpClass(cls):
305305
template = get_template(
306306
cls.api_client,
307307
cls.zone.id,
308-
cls.services["ostypeid"]
308+
cls.services["ostype"]
309309
)
310310
#Create an account, network, VM and IP addresses
311311
cls.account = Account.create(
@@ -604,7 +604,7 @@ def setUpClass(cls):
604604
template = get_template(
605605
cls.api_client,
606606
cls.zone.id,
607-
cls.services["ostypeid"]
607+
cls.services["ostype"]
608608
)
609609
cls.services["server"]["zoneid"] = cls.zone.id
610610

@@ -1076,7 +1076,7 @@ def setUp(self):
10761076
template = get_template(
10771077
self.apiclient,
10781078
self.zone.id,
1079-
self.services["ostypeid"]
1079+
self.services["ostype"]
10801080
)
10811081
self.services["server"]["zoneid"] = self.zone.id
10821082

@@ -1236,7 +1236,7 @@ def setUp(self):
12361236
template = get_template(
12371237
self.apiclient,
12381238
self.zone.id,
1239-
self.services["ostypeid"]
1239+
self.services["ostype"]
12401240
)
12411241
self.services["server"]["zoneid"] = self.zone.id
12421242

@@ -1495,7 +1495,7 @@ def setUp(self):
14951495
template = get_template(
14961496
self.apiclient,
14971497
self.zone.id,
1498-
self.services["ostypeid"]
1498+
self.services["ostype"]
14991499
)
15001500
self.services["server"]["zoneid"] = self.zone.id
15011501

@@ -1635,7 +1635,7 @@ def setUp(self):
16351635
template = get_template(
16361636
self.apiclient,
16371637
self.zone.id,
1638-
self.services["ostypeid"]
1638+
self.services["ostype"]
16391639
)
16401640
self.services["server"]["zoneid"] = self.zone.id
16411641

test/integration/smoke/test_routers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def __init__(self):
6161
"username": "testuser",
6262
"password": "password",
6363
},
64-
"ostypeid":'01853327-513e-4508-9628-f1f55db1946f',
64+
"ostype": "CentOS 5.3 (64-bit)",
6565
"sleep": 60,
6666
"timeout": 10,
6767
"mode": 'advanced', #Networking mode: Basic, Advanced
@@ -84,7 +84,7 @@ def setUpClass(cls):
8484
template = get_template(
8585
cls.api_client,
8686
cls.zone.id,
87-
cls.services["ostypeid"]
87+
cls.services["ostype"]
8888
)
8989
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
9090

test/integration/smoke/test_templates.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ def __init__(self):
7575
"template_1": {
7676
"displaytext": "Cent OS Template",
7777
"name": "Cent OS Template",
78-
"ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
78+
"ostype": "CentOS 5.3 (64-bit)",
7979
},
8080
"template_2": {
8181
"displaytext": "Public Template",
8282
"name": "Public template",
83-
"ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
83+
"ostype": "CentOS 5.3 (64-bit)",
8484
"isfeatured": True,
8585
"ispublic": True,
8686
"isextractable": True,
@@ -94,7 +94,7 @@ def __init__(self):
9494
"isextractable": False,
9595
"bootable": True,
9696
"passwordenabled": True,
97-
"ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
97+
"ostype": "CentOS 5.3 (64-bit)",
9898
"mode": 'advanced',
9999
# Networking mode: Advanced, basic
100100
"sleep": 30,
@@ -135,8 +135,12 @@ def setUpClass(cls):
135135
template = get_template(
136136
cls.api_client,
137137
cls.zone.id,
138-
cls.services["ostypeid"]
138+
cls.services["ostype"]
139139
)
140+
cls.services["template_1"]["ostypeid"] = template.ostypeid
141+
cls.services["template_2"]["ostypeid"] = template.ostypeid
142+
cls.services["ostypeid"] = template.ostypeid
143+
140144
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
141145
cls.services["volume"]["diskoffering"] = cls.disk_offering.id
142146
cls.services["volume"]["zoneid"] = cls.zone.id
@@ -298,14 +302,18 @@ def setUpClass(cls):
298302
template = get_template(
299303
cls.api_client,
300304
cls.zone.id,
301-
cls.services["ostypeid"]
305+
cls.services["ostype"]
302306
)
303307
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
304308
cls.services["volume"]["diskoffering"] = cls.disk_offering.id
305309
cls.services["volume"]["zoneid"] = cls.zone.id
306310
cls.services["template_2"]["zoneid"] = cls.zone.id
307311
cls.services["sourcezoneid"] = cls.zone.id
308312

313+
cls.services["template_1"]["ostypeid"] = template.ostypeid
314+
cls.services["template_2"]["ostypeid"] = template.ostypeid
315+
cls.services["ostypeid"] = template.ostypeid
316+
309317
cls.account = Account.create(
310318
cls.api_client,
311319
cls.services["account"],

test/integration/smoke/test_vm_life_cycle.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def __init__(self):
109109
"name": "testISO",
110110
"url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
111111
# Source URL where ISO is located
112-
"ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
112+
"ostype": 'CentOS 5.3 (64-bit)',
113113
"mode": 'HTTP_DOWNLOAD', # Downloading existing ISO
114114
},
115115
"template": {
@@ -123,7 +123,7 @@ def __init__(self):
123123
"sleep": 60,
124124
"timeout": 10,
125125
#Migrate VM to hostid
126-
"ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
126+
"ostype": 'CentOS 5.3 (64-bit)',
127127
# CentOS 5.3 (64-bit)
128128
"mode":'advanced',
129129
}
@@ -143,7 +143,7 @@ def setUp(self):
143143
template = get_template(
144144
self.apiclient,
145145
zone.id,
146-
self.services["ostypeid"]
146+
self.services["ostype"]
147147
)
148148
# Set Zones and disk offerings
149149
self.services["small"]["zoneid"] = zone.id
@@ -245,7 +245,7 @@ def setUpClass(cls):
245245
template = get_template(
246246
cls.api_client,
247247
zone.id,
248-
cls.services["ostypeid"]
248+
cls.services["ostype"]
249249
)
250250
# Set Zones and disk offerings
251251
cls.services["small"]["zoneid"] = zone.id
@@ -999,7 +999,7 @@ def setUpClass(cls):
999999
template = get_template(
10001000
cls.api_client,
10011001
zone.id,
1002-
cls.services["ostypeid"]
1002+
cls.services["ostype"]
10031003
)
10041004
# Set Zones and disk offerings
10051005
cls.services["small"]["zoneid"] = zone.id
@@ -1065,7 +1065,7 @@ def setUpClass(cls):
10651065
"Exception: Unable to find root volume foe VM: %s" %
10661066
cls.virtual_machine.id)
10671067

1068-
cls.services["template"]["ostypeid"] = cls.services["ostypeid"]
1068+
cls.services["template"]["ostype"] = cls.services["ostype"]
10691069
#Create templates for Edit, Delete & update permissions testcases
10701070
cls.pw_enabled_template = Template.create(
10711071
cls.api_client,

test/integration/smoke/test_volumes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def __init__(self):
7575
"publicport": 22,
7676
"protocol": 'TCP',
7777
"diskdevice": "/dev/xvdb",
78-
"ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
79-
"mode": 'advanced',
78+
"ostype": 'CentOS 5.3 (64-bit)',
79+
"mode": 'basic',
8080
"sleep": 60,
8181
"timeout": 10,
8282
}
@@ -104,7 +104,7 @@ def setUpClass(cls):
104104
template = get_template(
105105
cls.api_client,
106106
cls.zone.id,
107-
cls.services["ostypeid"]
107+
cls.services["ostype"]
108108
)
109109
cls.services["domainid"] = cls.domain.id
110110
cls.services["zoneid"] = cls.zone.id
@@ -286,7 +286,7 @@ def setUpClass(cls):
286286
template = get_template(
287287
cls.api_client,
288288
cls.zone.id,
289-
cls.services["ostypeid"]
289+
cls.services["ostype"]
290290
)
291291
cls.services["domainid"] = cls.domain.id
292292
cls.services["zoneid"] = cls.zone.id

0 commit comments

Comments
 (0)