test/mod: use proper host runner
Instead of hard-coding the use of the "org.osbuild.linux" runner, use the new `osbuild.pipeline.detect_host_runner` function to dynamically detect the runner for the host system. That should fix the tests on RHEL systems, where python3 is by default not present and even if it is manually installed, is an indirection via alternatives (i.e. a link to /etc/alternatives), which must be explicitly configured in the build root container for the host.
This commit is contained in:
parent
25662fbfbc
commit
d7d84a8eb1
3 changed files with 13 additions and 8 deletions
|
|
@ -10,6 +10,7 @@ import unittest
|
|||
|
||||
from osbuild.buildroot import BuildRoot
|
||||
from osbuild.monitor import LogMonitor, NullMonitor
|
||||
from osbuild.pipeline import detect_host_runner
|
||||
from .. import test
|
||||
|
||||
|
||||
|
|
@ -23,7 +24,7 @@ class TestBuildRoot(test.TestBase):
|
|||
self.tmp.cleanup()
|
||||
|
||||
def test_basic(self):
|
||||
runner = "org.osbuild.linux"
|
||||
runner = detect_host_runner()
|
||||
libdir = os.path.abspath(os.curdir)
|
||||
var = pathlib.Path(self.tmp.name, "var")
|
||||
var.mkdir()
|
||||
|
|
@ -64,7 +65,7 @@ class TestBuildRoot(test.TestBase):
|
|||
self.assertEqual(log, r.output)
|
||||
|
||||
def test_output(self):
|
||||
runner = "org.osbuild.linux"
|
||||
runner = detect_host_runner()
|
||||
libdir = os.path.abspath(os.curdir)
|
||||
var = pathlib.Path(self.tmp.name, "var")
|
||||
var.mkdir()
|
||||
|
|
@ -81,7 +82,7 @@ class TestBuildRoot(test.TestBase):
|
|||
|
||||
@unittest.skipUnless(test.TestBase.have_test_data(), "no test-data access")
|
||||
def test_bind_mounts(self):
|
||||
runner = "org.osbuild.linux"
|
||||
runner = detect_host_runner()
|
||||
libdir = os.path.abspath(os.curdir)
|
||||
var = pathlib.Path(self.tmp.name, "var")
|
||||
var.mkdir()
|
||||
|
|
@ -118,7 +119,7 @@ class TestBuildRoot(test.TestBase):
|
|||
# because RPM and other tools must not assume the policy
|
||||
# of the host is the valid policy
|
||||
|
||||
runner = "org.osbuild.linux"
|
||||
runner = detect_host_runner()
|
||||
libdir = os.path.abspath(os.curdir)
|
||||
var = pathlib.Path(self.tmp.name, "var")
|
||||
var.mkdir()
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ from collections import defaultdict
|
|||
import osbuild
|
||||
import osbuild.meta
|
||||
from osbuild.monitor import LogMonitor
|
||||
from osbuild.pipeline import detect_host_runner
|
||||
from .. import test
|
||||
|
||||
|
||||
|
|
@ -53,7 +54,8 @@ class TestMonitor(unittest.TestCase):
|
|||
@unittest.skipUnless(test.TestBase.can_bind_mount(), "root-only")
|
||||
def test_log_monitor_vfuncs(self):
|
||||
# Checks the basic functioning of the LogMonitor
|
||||
pipeline = osbuild.Pipeline("org.osbuild.linux")
|
||||
runner = detect_host_runner()
|
||||
pipeline = osbuild.Pipeline(runner=runner)
|
||||
pipeline.add_stage("org.osbuild.noop", {}, {
|
||||
"isthisthereallife": False
|
||||
})
|
||||
|
|
@ -83,7 +85,8 @@ class TestMonitor(unittest.TestCase):
|
|||
@unittest.skipUnless(test.TestBase.can_bind_mount(), "root-only")
|
||||
def test_monitor_integration(self):
|
||||
# Checks the monitoring API is called properly from the pipeline
|
||||
pipeline = osbuild.Pipeline("org.osbuild.linux")
|
||||
runner = detect_host_runner()
|
||||
pipeline = osbuild.Pipeline(runner=runner)
|
||||
pipeline.add_stage("org.osbuild.noop", {}, {
|
||||
"isthisthereallife": False
|
||||
})
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import unittest
|
|||
import osbuild
|
||||
import osbuild.meta
|
||||
from osbuild.monitor import NullMonitor
|
||||
from osbuild.pipeline import detect_host_runner
|
||||
from .. import test
|
||||
|
||||
|
||||
|
|
@ -52,7 +53,7 @@ class TestDescriptions(unittest.TestCase):
|
|||
data = pathlib.Path(tmpdir, "data")
|
||||
cache = pathlib.Path(tmpdir, "cache")
|
||||
root = pathlib.Path("/")
|
||||
runner = "org.osbuild.linux"
|
||||
runner = detect_host_runner()
|
||||
monitor = NullMonitor(sys.stderr.fileno())
|
||||
libdir = os.path.abspath(os.curdir)
|
||||
|
||||
|
|
@ -86,7 +87,7 @@ class TestDescriptions(unittest.TestCase):
|
|||
cache = pathlib.Path(tmpdir, "cache")
|
||||
output = pathlib.Path(tmpdir, "output")
|
||||
root = pathlib.Path("/")
|
||||
runner = "org.osbuild.linux"
|
||||
runner = detect_host_runner()
|
||||
monitor = NullMonitor(sys.stderr.fileno())
|
||||
libdir = os.path.abspath(os.curdir)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue