Skip to content

Commit c9a596f

Browse files
committed
fixup! WIP export to XVA after install, and use it for separate firstboot test
1 parent 71c93d3 commit c9a596f

File tree

3 files changed

+15
-42
lines changed

3 files changed

+15
-42
lines changed

conftest.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import lib.config as global_config
99

10-
from lib.common import callable_marker
10+
from lib.common import callable_marker, shortened_nodeid
1111
from lib.common import wait_for, vm_image, is_uuid
1212
from lib.common import setup_formatted_and_mounted_disk, teardown_formatted_and_mounted_disk
1313
from lib.netutil import is_ipv6
@@ -424,6 +424,13 @@ def create_vms(request, host):
424424
_import_vm(vm_def, host, vms, use_cache=CACHE_IMPORTED_VM)
425425
yield vms
426426

427+
# record this state
428+
for vm_def, vm in zip(vm_defs, vms):
429+
# FIXME where to store?
430+
xva_name = f"{shortened_nodeid(request.node.nodeid)}-{vm_def['name']}.xva"
431+
host.ssh(["rm -f", xva_name])
432+
vm.export(xva_name, "zstd", use_cache=CACHE_IMPORTED_VM)
433+
427434
except Exception:
428435
logging.error("exception caught...")
429436
raise

tests/install/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,11 @@ def xcpng_chained(request):
210210
continuation_of = callable_marker(marker.args[0], request, param_mapping=param_mapping)
211211

212212
vm_defs = [dict(name=vm_spec['vm'],
213-
image=shortened_nodeid(
213+
image="{}-{}.xva".format(shortened_nodeid(
214214
_expand_scope_relative_nodeid(vm_spec['test'],
215215
vm_spec.get("scope", "module"),
216216
request.node.nodeid)),
217+
vm_spec['vm'])
217218
)
218219
for vm_spec in continuation_of]
219220

tests/install/test.py

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88
from lib.host import Host
99
from lib.pool import Pool
1010

11-
try:
12-
from data import CACHE_IMPORTED_VM
13-
except ImportError:
14-
CACHE_IMPORTED_VM = False
15-
assert CACHE_IMPORTED_VM in [True, False]
16-
1711
@pytest.mark.dependency()
1812
class TestNested:
1913
@pytest.mark.parametrize("iso_version", (
@@ -35,7 +29,7 @@ class TestNested:
3529
}[version],
3630
param_mapping={"version": "iso_version"})
3731
@pytest.mark.vm_definitions(lambda firmware: dict(
38-
name="vm 1",
32+
name="vm1",
3933
template="Other install media",
4034
params=(
4135
# dict(param_name="", value=""),
@@ -51,7 +45,7 @@ class TestNested:
5145
),
5246
"bios": (),
5347
}[firmware],
54-
vdis=[dict(name="vm 1 system disk", size="100GiB", device="xvda", userdevice="0")],
48+
vdis=[dict(name="vm1 system disk", size="100GiB", device="xvda", userdevice="0")],
5549
vifs=[dict(index=0, network_uuid="eabc1038-e40f-2ae5-0781-a3adbec1cae8")], # FIXME
5650
),
5751
param_mapping={"firmware": "firmware"})
@@ -138,14 +132,6 @@ def test_install(self, request, firmware, iso_version, iso_remaster, create_vms)
138132
host_vm.shutdown(force=True)
139133
raise
140134

141-
# record this state
142-
# FIXME move to fixture
143-
# FIXME where to store?
144-
xva_name = shortened_nodeid(request.node.nodeid) + ".xva"
145-
host_vm.host.ssh(["rm -f", xva_name])
146-
host_vm.export(xva_name, "zstd", use_cache=CACHE_IMPORTED_VM)
147-
148-
149135
@pytest.mark.usefixtures("xcpng_chained")
150136
# FIXME take "uefi" outa here and allow "bios"
151137
@pytest.mark.parametrize("mode", [
@@ -164,7 +150,7 @@ def test_install(self, request, firmware, iso_version, iso_remaster, create_vms)
164150
])
165151
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
166152
@pytest.mark.continuation_of(
167-
lambda params, firmware: [dict(vm="vm 1",
153+
lambda params, firmware: [dict(vm="vm1",
168154
test=(f"TestNested::{{}}[{firmware}-{params}]".format(
169155
{
170156
1: "test_install",
@@ -327,13 +313,6 @@ def test_firstboot(self, firmware, request, create_vms, mode):
327313
host_vm.shutdown(force=True)
328314
raise
329315

330-
# record this state
331-
# FIXME move to fixture
332-
# FIXME where to store?
333-
xva_name = shortened_nodeid(request.node.nodeid) + ".xva"
334-
host_vm.host.ssh(["rm -f", xva_name])
335-
host_vm.export(xva_name, "zstd", use_cache=CACHE_IMPORTED_VM)
336-
337316
@pytest.mark.usefixtures("xcpng_chained")
338317
@pytest.mark.parametrize(("orig_version", "iso_version"), [
339318
("821.1", "821.1"),
@@ -347,7 +326,7 @@ def test_firstboot(self, firmware, request, create_vms, mode):
347326
])
348327
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
349328
@pytest.mark.continuation_of(
350-
lambda firmware, params: [dict(vm="vm 1",
329+
lambda firmware, params: [dict(vm="vm1",
351330
test=f"TestNested::test_firstboot[{firmware}-{params}]")],
352331
param_mapping={"params": "orig_version", "firmware": "firmware"},
353332
)
@@ -439,13 +418,6 @@ def test_upgrade(self, request, firmware, orig_version, iso_version, iso_remaste
439418
host_vm.shutdown(force=True)
440419
raise
441420

442-
# record this state
443-
# FIXME move to fixture
444-
# FIXME where to store?
445-
xva_name = shortened_nodeid(request.node.nodeid) + ".xva"
446-
host_vm.host.ssh(["rm -f", xva_name])
447-
host_vm.export(xva_name, "zstd", use_cache=CACHE_IMPORTED_VM)
448-
449421
@pytest.mark.usefixtures("xcpng_chained")
450422
@pytest.mark.parametrize(("orig_version", "iso_version"), [
451423
("821.1-83b2", "83b2"),
@@ -457,7 +429,7 @@ def test_upgrade(self, request, firmware, orig_version, iso_version, iso_remaste
457429
])
458430
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
459431
@pytest.mark.continuation_of(
460-
lambda firmware, params: [dict(vm="vm 1",
432+
lambda firmware, params: [dict(vm="vm1",
461433
test=f"TestNested::test_firstboot[{firmware}-{params}]")],
462434
param_mapping={"params": "orig_version", "firmware": "firmware"},
463435
)
@@ -547,10 +519,3 @@ def test_restore(self, request, firmware, orig_version, iso_version, iso_remaste
547519
# wait_for(lambda: False, 'Wait "forever"', timeout_secs=100*60)
548520
host_vm.shutdown(force=True)
549521
raise
550-
551-
# record this state
552-
# FIXME move to fixture
553-
# FIXME where to store?
554-
xva_name = shortened_nodeid(request.node.nodeid) + ".xva"
555-
host_vm.host.ssh(["rm -f", xva_name])
556-
host_vm.export(xva_name, "zstd", use_cache=CACHE_IMPORTED_VM)

0 commit comments

Comments
 (0)