Skip to content

Commit 5021243

Browse files
authored
Update OCP-V provisioning tests to use Kickstart default userdata (#21037)
Signed-off-by: Shubham Ganar <sganar@redhat.com>
1 parent 171cd99 commit 5021243

3 files changed

Lines changed: 4 additions & 71 deletions

File tree

pytest_fixtures/component/provision_ocpv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def module_ocpv_image(
5555
description=gen_string('alpha'),
5656
minor=settings.ocpv.image_os.split()[1].split('.')[1],
5757
major=settings.ocpv.image_os.split()[1].split('.')[0],
58-
family='Rhcos',
58+
family='Redhat',
5959
release_name=gen_string('alpha'),
6060
architecture=[default_architecture],
6161
ptable=[default_partitiontable],

tests/foreman/api/test_computeresource_ocpv.py

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -106,49 +106,14 @@ def test_positive_userdata_image_provision_end_to_end(
106106
:steps:
107107
1. Create OCP compute resource
108108
2. Create image for the compute resource
109-
3. Create userdata provisioning template and associate with OS
110-
4. Create hostgroup
111-
5. Provision a host using image-based provisioning
112-
6. Check if the host status is installed.
109+
3. Create hostgroup
110+
4. Provision a host using userdata image-based provisioning
111+
5. Check if the host status is installed.
113112
114113
:expectedresults: Host is provisioned successfully on OpenShift Virtualization
115114
"""
116115
name = gen_string('alpha').lower()
117116
sat = module_ocpv_sat
118-
os = module_ocpv_image.os
119-
120-
USERDATA_TEMPLATE = """\
121-
#cloud-config
122-
<%# Contact Foreman to confirm instance is built -%>
123-
phone_home:
124-
url: <%= foreman_url('built') %>
125-
post: []
126-
tries: 10
127-
"""
128-
129-
# Get the user_data template kind
130-
template_kind = sat.api.TemplateKind().search(query={'search': 'name=user_data'})[0]
131-
132-
# Create custom userdata provisioning template to check host status.
133-
userdata_template = sat.api.ProvisioningTemplate(
134-
name=gen_string('alpha'),
135-
organization=[module_org],
136-
location=[module_location],
137-
snippet=False,
138-
template_kind=template_kind,
139-
operatingsystem=[os],
140-
template=USERDATA_TEMPLATE,
141-
).create()
142-
143-
# assign the userdata template to the os
144-
os.provisioning_template.append(userdata_template)
145-
os.update(['provisioning_template'])
146-
147-
sat.api.OSDefaultTemplate(
148-
operatingsystem=os,
149-
provisioning_template=userdata_template,
150-
template_kind=template_kind,
151-
).create()
152117

153118
host = sat.api.Host(
154119
hostgroup=module_ocpv_hostgroup,

tests/foreman/ui/test_computeresource_ocpv.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
:CaseImportance: High
1111
"""
1212

13-
import textwrap
14-
1513
from fauxfactory import gen_string
1614
import pytest
1715
from wait_for import wait_for
@@ -52,41 +50,11 @@ def test_positive_userdata_image_provision_end_to_end(
5250
"""
5351
name = gen_string('alpha').lower()
5452
sat = module_ocpv_sat
55-
os = module_ocpv_image.os
5653
domain_name = module_ocpv_hostgroup.domain.read().name
5754
host_fqdn = f'{name}.{domain_name}'
5855
memory = '6144'
5956
memory_in_gb = int(memory) / 1024
6057

61-
USERDATA_TEMPLATE = textwrap.dedent("""\
62-
#cloud-config
63-
<%# Contact Foreman to confirm instance is built -%>
64-
phone_home:
65-
url: <%= foreman_url('built') %>
66-
post: []
67-
tries: 10
68-
""")
69-
70-
# Create userdata provisioning template via API
71-
template_kind = sat.api.TemplateKind().search(query={'search': 'name=user_data'})[0]
72-
userdata_template = sat.api.ProvisioningTemplate(
73-
name=gen_string('alpha'),
74-
organization=[module_org],
75-
location=[module_location],
76-
snippet=False,
77-
template_kind=template_kind,
78-
operatingsystem=[os],
79-
template=USERDATA_TEMPLATE,
80-
).create()
81-
82-
os.provisioning_template.append(userdata_template)
83-
os.update(['provisioning_template'])
84-
sat.api.OSDefaultTemplate(
85-
operatingsystem=os,
86-
provisioning_template=userdata_template,
87-
template_kind=template_kind,
88-
).create()
89-
9058
with module_ocpv_sat.ui_session() as session:
9159
session.organization.select(org_name=module_org.name)
9260
session.location.select(loc_name=module_location.name)

0 commit comments

Comments
 (0)