mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-11-28 23:24:49 +08:00
Find compatible base modules based on the virtual streams.
Before this commit, the compatible base modules for Module Stream Expansion have been found without any limitation, just based on the stream version. It was therefore possible that `platform:lp29.0.0` was found as compatible module for `platform:f29.1.0` although those platform streams are not compatible at all. In this commit, the module can be treated as compatible only if it has the same virtual stream as the input module. The idea behind this is that both `platform:f29.0.0` and `platform:f29.1.0` should include the `virtual_streams: [f29]` in their XMD section which tells MBS that they are actually compatible. The `lp29` stream will not have the same virtual stream (most likely it won't have any virtual stream at all). The `virtual_streams` is already used for this use-case in `MMDResolver`, but it was not used to limit the inputs to `MMDResolver` which is what this commit is doing. This commit also fixes the issue in `get_last_builds_in_stream_version_lte` which was simply broken if multiple stream_versions of single base module existed and their builds had different version. In this case, only builds with single (randomly chosen) version were returned.
This commit is contained in:
@@ -24,7 +24,7 @@ import os
|
||||
from module_build_service.utils import to_text_type
|
||||
|
||||
from tests.test_models import init_data, module_build_from_modulemd
|
||||
from tests import (init_data as init_data_contexts, clean_database)
|
||||
from tests import (init_data as init_data_contexts, clean_database, make_module)
|
||||
from module_build_service import conf, Modulemd
|
||||
from module_build_service.models import ComponentBuild, ModuleBuild, make_session
|
||||
|
||||
@@ -142,3 +142,25 @@ class TestModelsGetStreamsContexts:
|
||||
builds = set(["%s:%s:%s:%s" % (build.name, build.stream, str(build.version),
|
||||
build.context) for build in builds])
|
||||
assert builds == set(['platform:f29.0.0:3:00000000', 'platform:f29.1.0:3:00000000'])
|
||||
|
||||
def test_get_last_builds_in_stream_version_lte_different_versions(self):
|
||||
"""
|
||||
Tests that get_last_builds_in_stream_version_lte works in case the
|
||||
name:stream_ver modules have different versions.
|
||||
"""
|
||||
clean_database(False)
|
||||
make_module("platform:f29.1.0:10:old_version", {}, {}, virtual_streams=["f29"])
|
||||
make_module("platform:f29.1.0:15:c11.another", {}, {}, virtual_streams=["f29"])
|
||||
make_module("platform:f29.1.0:15:c11", {}, {}, virtual_streams=["f29"])
|
||||
make_module("platform:f29.2.0:0:old_version", {}, {}, virtual_streams=["f29"])
|
||||
make_module("platform:f29.2.0:1:c11", {}, {}, virtual_streams=["f29"])
|
||||
make_module("platform:f29.3.0:15:old_version", {}, {}, virtual_streams=["f29"])
|
||||
make_module("platform:f29.3.0:20:c11", {}, {}, virtual_streams=["f29"])
|
||||
|
||||
with make_session(conf) as session:
|
||||
builds = ModuleBuild.get_last_builds_in_stream_version_lte(
|
||||
session, "platform", 290200)
|
||||
builds = set(["%s:%s:%s:%s" % (build.name, build.stream, str(build.version),
|
||||
build.context) for build in builds])
|
||||
assert builds == set(['platform:f29.1.0:15:c11', 'platform:f29.1.0:15:c11.another',
|
||||
'platform:f29.2.0:1:c11'])
|
||||
|
||||
Reference in New Issue
Block a user