#118 Modularity test script install module is broken (`install_module` and `use_module` don't agree on keys)
Closed: Fixed 5 years ago by lruzicka. Opened 5 years ago by adamwill.

Now we fixed the modularity test to try and install stream 11 (not 8) of nodejs module, a new bug is exposed: the test script is just broken, it runs into a key error when trying to install the module.

Looking at the code the problem seems to be that install_module - for some reason - calls self.suite.use_module(module, 'install', stream=None, profile=None) - it explicitly sets the stream and the profile to None when calling use_module - but the key it expects to find in the result dict that use_module returns is based on the stream and profile:

    if stream != None and profile != None:
        key = f"{module}:{stream}/{profile}"
    elif stream != None and profile == None:
        key = f"{module}:{stream}"
    else:
        key = f"{module}"
    res1 = self.suite.use_module(module, 'install', stream=None, profile=None)
    print(f"DNF installs {key} =>", res1[key])

use_module constructs the key in a similar way - though really, it'd be good to factor out key construction to a shared function - but since install_module explicitly passes it None for the stream and the module, the key use_module uses is just going to be "nodejs", while the key install_module is expecting is (as we can see) "nodejs:11".

I don't understand why install_module calls use_module in this way, actually. It was changed in 43a6e183 , but there was no explanation in that commit why it was changed to always pass None.


Metadata Update from @adamwill:
- Issue assigned to lruzicka
- Issue priority set to: Critical (was: Normal)
- Issue tagged with: bug

5 years ago

Yes, I am not sure whether this way of calling the method was always present and some new Python version suddenly started to be less tolerant, or if I broke it somehow in the mean time.

I have already fixed it. See https://pagure.io/fedora-qa/modularity_testing_scripts/c/e1398db1cdda187056d62bc68a9ec871fe144e90?branch=master

I also added some more features to the script:

  • With a huge help of @lbrabec, I redesigned parsing the dnf output using the libdnf code, so there will not be any errors coming from various corner cases of dnf module list anymore.
  • added a test for checking the default streams and profiles
  • added a whitelist support for the above, because some modules do not have defaults set on purpose.

A pull request is there for this.

Metadata Update from @lruzicka:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

5 years ago

Log in to comment on this ticket.

Metadata