#1390 Fix --add-local-build with MBS Resolver.
Merged 4 years ago by jkaluza. Opened 4 years ago by jkaluza.
jkaluza/fm-orchestrator add-local-build-fix  into  master

@@ -269,6 +269,12 @@ 

          :rtype: list

          :return: List of modulemd metadata.

          """

+         # If user used --add-local-build, we do actually not care about base_module_nsvc,

do actually not => do not actually

+         # because the user directly asked us to use that module.

+         local_modules = models.ModuleBuild.local_modules(self.db_session, name, stream)

+         if local_modules:

+             return [m.mmd() for m in local_modules]

+ 

          modules = self._get_modules(name, stream, strict=False, base_module_br=base_module_nsvc)

          return [load_mmd(module["modulemd"]) for module in modules]

  

@@ -451,3 +451,28 @@ 

                  "virtual_stream": "virtualf28",

              },

          )

+ 

+     @patch(

+         "module_build_service.config.Config.system", new_callable=PropertyMock, return_value="test"

+     )

+     @patch(

+         "module_build_service.config.Config.mock_resultsdir",

+         new_callable=PropertyMock,

+         return_value=tests.staged_data_filename("local_builds")

+     )

+     def test_get_buildrequired_modulemds_local_builds(

+         self, local_builds, conf_system, db_session

+     ):

+         tests.clean_database()

+         with tests.app.app_context():

+             module_build_service.utils.load_local_builds(db_session, ["testmodule"])

+ 

+             resolver = mbs_resolver.GenericResolver.create(db_session, tests.conf, backend="mbs")

+             result = resolver.get_buildrequired_modulemds(

+                 "testmodule", "master", "platform:f28:1:00000000")

+             assert 1 == len(result)

+             mmd = result[0]

+             assert "testmodule" == mmd.get_module_name()

+             assert "master" == mmd.get_stream_name()

+             assert 20170816080816 == mmd.get_version()

+             assert "321" == mmd.get_context()

The MBSResolver.get_buildrequired_modulemds did not try to load
local module builds and always just queried the remote MBS instance.

This commit fixes it by using local module if available.

Commit 9d40a9b fixes this pull-request

Pull-Request has been merged by jkaluza

4 years ago

Pull-Request has been merged by jkaluza

4 years ago