pipeline: run method takes store object not dir
Instead of passing the store directory to Pipeline.run, pass an already initialized ObjectStore object. This binds the lifetime of the store and its (temporary) objects to the run of osbuild not the run of the pipeline. This prepares re-using the stores with multiple (non-nested) pipelines.
This commit is contained in:
parent
8d2c7f8160
commit
f38c48086e
3 changed files with 38 additions and 35 deletions
|
|
@ -12,6 +12,7 @@ from collections import defaultdict
|
|||
import osbuild
|
||||
import osbuild.meta
|
||||
from osbuild.monitor import LogMonitor
|
||||
from osbuild.objectstore import ObjectStore
|
||||
from osbuild.pipeline import detect_host_runner
|
||||
from .. import test
|
||||
|
||||
|
|
@ -67,9 +68,9 @@ class TestMonitor(unittest.TestCase):
|
|||
|
||||
logfile = os.path.join(tmpdir, "log.txt")
|
||||
|
||||
with open(logfile, "w") as log:
|
||||
with open(logfile, "w") as log, ObjectStore(storedir) as store:
|
||||
monitor = LogMonitor(log.fileno())
|
||||
res = pipeline.run(storedir,
|
||||
res = pipeline.run(store,
|
||||
monitor,
|
||||
libdir=os.path.abspath(os.curdir),
|
||||
output_directory=outputdir)
|
||||
|
|
@ -100,10 +101,11 @@ class TestMonitor(unittest.TestCase):
|
|||
outputdir = os.path.join(tmpdir, "output")
|
||||
|
||||
tape = TapeMonitor()
|
||||
res = pipeline.run(storedir,
|
||||
tape,
|
||||
libdir=os.path.abspath(os.curdir),
|
||||
output_directory=outputdir)
|
||||
with ObjectStore(storedir) as store:
|
||||
res = pipeline.run(store,
|
||||
tape,
|
||||
libdir=os.path.abspath(os.curdir),
|
||||
output_directory=outputdir)
|
||||
|
||||
assert res
|
||||
self.assertEqual(tape.counter["begin"], 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue