#1167 Use the scrmod prefix also for build targets for scratch builds.
Merged 4 months ago by jkaluza. Opened 4 months ago by jkaluza.
jkaluza/fm-orchestrator scratch-target  into  master

@@ -525,7 +525,7 @@ 

          target_length = 50 + len('-build')

          target = module_build_service.utils.generate_koji_tag(

              self.module.name, self.module.stream, self.module.version, self.module.context,

-             target_length)

+             target_length, scratch=self.module.scratch, scratch_id=self.module.id)

          # Add main build target.

          self.module_target = self._koji_add_target(target, self.module_build_tag, self.module_tag)

  

@@ -550,6 +550,31 @@ 

              expected_calls = []

          assert session.packageListBlock.mock_calls == expected_calls

  

+     @pytest.mark.parametrize('scratch', [False, True])

+     def test_buildroot_connect_create_target(self, scratch):

+         if scratch:

+             self.module.scratch = scratch

+ 

+         builder = FakeKojiModuleBuilder(

+             owner=self.module.owner, module=self.module, config=conf, tag_name='module-foo',

+             components=["nginx"])

+         session = builder.koji_session

+         session.getBuildTarget = MagicMock()

+         session.getBuildTarget.return_value = {}

+ 

+         groups = OrderedDict()

+         groups['build'] = set(["unzip"])

+         groups['srpm-build'] = set(["fedora-release"])

+         builder.buildroot_connect(groups)

+ 

+         if scratch:

+             expected_calls = [mock.call(

+                 'scrmod-nginx-1-2-00000000+2', 'module-foo-build', 'module-foo')]

+         else:

+             expected_calls = [mock.call(

+                 'module-nginx-1-2-00000000', 'module-foo-build', 'module-foo')]

+         assert session.createBuildTarget.mock_calls == expected_calls

+ 

      @patch('module_build_service.builder.KojiModuleBuilder.KojiClientSession')

      def test_get_built_rpms_in_module_build(self, ClientSession):

          session = ClientSession.return_value

Currently, the Koji tags have properly set the scrmod- prefix, but
the build target still sets module- prefix even for scratch builds.

In this commit, build target has the scrmod- prefix too.

Yes, of course! I should have been caught earlier as the other code that calls generate_koji_tag()--which was modified for scratch builds.

LGTM

Pull-Request has been merged by jkaluza

4 months ago