test: convert to new osbuild executor

Convert the pipeline tests to the new osbuild executor. This will remove
the last users of the "output_id" and "tree_id" identifiers from
osbuild.
This commit is contained in:
David Rheinsberg 2020-05-20 11:15:13 +02:00
parent 845148993c
commit c84f5280c1
3 changed files with 193 additions and 79 deletions

View file

@ -2,35 +2,43 @@
import os
import subprocess
import tempfile
import unittest
from . import osbuildtest
from . import test
class TestBoot(osbuildtest.TestCase):
class TestBoot(unittest.TestCase):
def setUp(self):
self.osbuild = test.OSBuild(self)
def test_boot(self):
_, output_id = self.run_osbuild("test/pipelines/f30-boot.json")
#
# Build an image and test-boot it.
#
with tempfile.TemporaryDirectory() as d:
output_file = os.path.join(d, "output")
with self.osbuild as osb:
osb.compile_file("test/pipelines/f30-boot.json")
with osb.map_output("f30-boot.qcow2") as qcow2, \
tempfile.TemporaryDirectory() as d:
subprocess.run(["qemu-system-x86_64",
"-snapshot",
"-m", "1024",
"-M", "accel=kvm:hvf:tcg",
output_file = os.path.join(d, "output")
subprocess.run(["qemu-system-x86_64",
"-snapshot",
"-m", "1024",
"-M", "accel=kvm:hvf:tcg",
# be silent
"-nographic",
"-monitor", "none",
"-serial", "none",
# be silent
"-nographic",
"-monitor", "none",
"-serial", "none",
# create /dev/vport0p1
"-chardev", f"file,path={output_file},id=stdio",
"-device", "virtio-serial",
"-device", "virtserialport,chardev=stdio",
# create /dev/vport0p1
"-chardev", f"file,path={output_file},id=stdio",
"-device", "virtio-serial",
"-device", "virtserialport,chardev=stdio",
f"{self.get_path_to_store(output_id)}/f30-boot.qcow2"],
encoding="utf-8",
check=True)
with open(output_file, "r") as f:
self.assertEqual(f.read().strip(), "running")
qcow2],
encoding="utf-8",
check=True)
with open(output_file, "r") as f:
self.assertEqual(f.read().strip(), "running")