mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-24 18:52:25 +08:00
Fixed scratch build suffix bug
When building a scratch build of a module with static context the scratch suffix was added twice. Signed-off-by: Martin Curlej <mcurlej@redhat.com>
This commit is contained in:
committed by
Mike McLean
parent
5cdb2127fe
commit
71a44bdfb6
@@ -25,10 +25,15 @@ from tests import (
|
||||
make_module,
|
||||
read_staged_data,
|
||||
init_data,
|
||||
clean_database,
|
||||
)
|
||||
|
||||
|
||||
class TestSubmit:
|
||||
|
||||
def teardown_method(self, tested_method):
|
||||
clean_database()
|
||||
|
||||
def test_get_prefixed_version_f28(self):
|
||||
scheduler_init_data(1)
|
||||
build_one = models.ModuleBuild.get_by_id(db_session, 2)
|
||||
@@ -144,6 +149,77 @@ class TestSubmit:
|
||||
assert "mbs_options" not in xmd
|
||||
assert xmd["mbs"]["static_context"]
|
||||
|
||||
def test_submit_build_module_scratch_v3_static_context(self):
|
||||
"""
|
||||
Test if the static context in the v3 metadata format will contain the correct suffix
|
||||
during a scratch build
|
||||
"""
|
||||
init_data(multiple_stream_versions=True)
|
||||
yaml_str = read_staged_data("v3/mmd_packager")
|
||||
mmd = load_mmd(yaml_str)
|
||||
ux_timestamp = "1613048427"
|
||||
version = provide_module_stream_version_from_timestamp(ux_timestamp)
|
||||
params = {"scratch": True}
|
||||
|
||||
builds = submit_module_build(db_session, "foo", mmd, params, version)
|
||||
|
||||
assert len(builds) == 2
|
||||
|
||||
expected_contexts = {"CTX1_1": {}, "CTX2_1": {}}
|
||||
|
||||
for build in builds:
|
||||
mmd = build.mmd()
|
||||
context = mmd.get_context()
|
||||
assert context in expected_contexts
|
||||
|
||||
def test_submit_build_module_scratch_v2_static_context(self):
|
||||
"""
|
||||
Test if the static context in the v2 metadata format will contain
|
||||
the correct suffix during a scratch build
|
||||
"""
|
||||
scheduler_init_data(1)
|
||||
yaml_str = read_staged_data("static_context_v2")
|
||||
mmd = load_mmd(yaml_str)
|
||||
ux_timestamp = "1613048427"
|
||||
version = provide_module_stream_version_from_timestamp(ux_timestamp)
|
||||
params = {"scratch": True}
|
||||
|
||||
builds = submit_module_build(db_session, "app", mmd, params, version)
|
||||
|
||||
assert len(builds) == 2
|
||||
|
||||
expected_contexts = {"context1_1": {}, "context2_1": {}}
|
||||
|
||||
for build in builds:
|
||||
mmd = build.mmd()
|
||||
context = mmd.get_context()
|
||||
assert context in expected_contexts
|
||||
|
||||
def test_submit_build_module_scratch_increment(self):
|
||||
"""
|
||||
Test if the context suffix is incremented correctly during a repeated scratch build.
|
||||
"""
|
||||
init_data(multiple_stream_versions=True)
|
||||
yaml_str = read_staged_data("v3/mmd_packager")
|
||||
mmd = load_mmd(yaml_str)
|
||||
ux_timestamp = "1613048427"
|
||||
version = provide_module_stream_version_from_timestamp(ux_timestamp)
|
||||
params = {"scratch": True}
|
||||
|
||||
builds = submit_module_build(db_session, "foo", mmd, params, version)
|
||||
|
||||
assert len(builds) == 2
|
||||
|
||||
builds = submit_module_build(db_session, "foo", mmd, params, version)
|
||||
|
||||
assert len(builds) == 2
|
||||
|
||||
expected_contexts = {"CTX1_2": {}, "CTX2_2": {}}
|
||||
for build in builds:
|
||||
mmd = build.mmd()
|
||||
context = mmd.get_context()
|
||||
assert context in expected_contexts
|
||||
|
||||
|
||||
class TestProcessModuleContextConfiguration:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user