debian-forge/test/run/test_noop.py
2024-01-02 19:31:31 +01:00

66 lines
1.7 KiB
Python

#
# Runtime Tests for No-op Pipelines
#
import json
import pytest
from .. import test
@pytest.fixture(name="jsondata", scope="module")
def jsondata_fixture():
return json.dumps({
"version": "2",
"pipelines": [
{
"name": "noop",
"stages": [
{
"type": "org.osbuild.noop",
"options": {"zero": 0},
"inputs": {
"tree": {
"type": "org.osbuild.noop",
"origin": "org.osbuild.pipeline",
"references": {
"foo": {}
}
}
}
}
]
}
]
})
@pytest.fixture(name="osb", scope="module")
def osbuild_fixture():
with test.OSBuild() as osb:
yield osb
#
# Run a noop Pipeline. Run twice to verify the cache does not affect
# the operation (we do not have checkpoints, nor any stages that could
# be checkpointed).
#
# Then run the entire thing again, to verify our own `osbuild` executor
# tears things down properly and allows to be executed multiple times.
#
def test_noop(osb):
osb.compile("{}", checkpoints=[])
osb.compile("{}", checkpoints=[])
def test_noop2(osb):
osb.compile("{}", checkpoints=[])
osb.compile("{}", checkpoints=[])
@pytest.mark.skipif(not test.TestBase.can_bind_mount(), reason="root-only")
def test_noop_v2(osb, tmp_path, jsondata):
osb.compile(jsondata, output_dir=tmp_path, exports=["noop"])