#1153 Return an exception to the user if no dependency combination is determined
Merged 7 months ago by mprahl. Opened 7 months ago by mprahl.

@@ -523,6 +523,9 @@ 

  

      validate_mmd(mmd)

      mmds = generate_expanded_mmds(db.session, mmd, raise_if_stream_ambigous, default_streams)

+     if not mmds:

+         raise ValidationError('No dependency combination was satisfied. Please verify the '

+                               'buildrequires in your modulemd have previously been built.')

      modules = []

  

      # True if all module builds are skipped so MBS will actually not rebuild

@@ -1275,6 +1275,29 @@ 

          assert set(dep.get_buildrequires()['platform'].get()) == expected_br

          assert set(dep.get_requires()['platform'].get()) == expected_req

  

+     @patch('module_build_service.auth.get_user', return_value=user)

+     @patch('module_build_service.scm.SCM')

+     def test_submit_build_invalid_basemodule_stream(self, mocked_scm, mocked_get_user):

+         FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',

+                 '620ec77321b2ea7b0d67d82992dda3e1d67055b4')

+ 

+         data = {

+             'branch': 'master',

+             'scmurl': 'https://src.stg.fedoraproject.org/modules/'

+                       'testmodule.git?#68931c90de214d9d13feefbd35246a81b6cb8d49',

+             'buildrequire_overrides': {'platform': ['28.0.0']},

+             'require_overrides': {'platform': ['f28.0.0']}

+         }

+         rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps(data))

+         result = json.loads(rv.data)

+         assert result == {

+             'error': 'Bad Request',

+             'status': 400,

+             'message': ('No dependency combination was satisfied. Please verify the '

+                         'buildrequires in your modulemd have previously been built.')

+         }

+         assert rv.status_code == 400

+ 

      @pytest.mark.parametrize('dep_type', ('buildrequire', 'require'))

      @patch('module_build_service.auth.get_user', return_value=user)

      @patch('module_build_service.scm.SCM')

This issue comes up if you buildrequire a platform that doesn't exist, but there are platform streams with compatible versions. See the test below for an example.

This returns an error to the user instead of a 500 error.

@jkaluza could you review this please?

While going through this code, I was also wondering if utils.mse._get_base_module_mmds should verify a platform stream exists before looking for compatible base modules. What do you think?

pretty please pagure-ci rebuild

7 months ago

rebased onto d5f9c58

7 months ago

Pull-Request has been merged by mprahl

7 months ago