Modularity prototype testing

Latest Documentation

General Structure

  • YAML Config file

  • Self generated tests

    • there is possible to write simple tests directly in yaml config file
    • Bash style testing
    • It has to have solved dependencies inside each module type
    • Now it just expect to end with 0 return code of command (like: ls / |grep sbin directory sbin exists in root dir)
    • It can contain multiple lines
    • It generates python covered bash tests
    • You has to call generator binary explicitly, it then create these pythonish tests with bash inside, Unittest doesn not allow to have dynamic tests.
  • Avocado tests

    • There is wrapper class what helps you to tests modules not focusing on module type
    • It uses avocado-framework
    • This test could be primarily used for more complex testing, not previous one
    • General test for modules: ./base/
    • Example tests in memcached module
  • Simple bash tests

  • WIP: Behave tests

Running using VAGRANT

  • install vagrant dnf -y install vagrant
  • just run vagrant up


  • base dependencies: docker python-pip
  • python dependencies: avocado-framework yaml json behave
dnf -y install docker python-pip
pip install avocado-framework yaml json behave

Enviromental variables

  • variables allows you to overwrite some values inside config.yaml
  • DEBUG Enable debugging output to test output
  • CONFIG file with MTF configuration default is config.yaml
  • MODULE which module type to test (in case there is not set default-module in config, you HAVE TO set it)

    • =docker uses section docker inside config file and will use docker containerisation
    • =nspawn systemd nspawn, it is lightweight virtualization, it does something like MOCK but it is not just chroot, but has own systemd etc.
    • =rpm testing of local RPM packages directly on HOST (it could be DESTRUCTIVE)
  • URL see example config. It overwrites value module.docker.container or module.rpm.repo to whatever you want. It has to be proper type what is set in MODULE

  • MODULEMDURL overwrite location of moduleMD file
  • COMPOSEURL overwrite location of compose repo location
  • PROFILE overwrite default profile to whatever you want to install instead of that
  • MTF_SKIP_DISABLING_SELINUX In nspawn type on fedora-25 we have to disable selinux, because it does not work well with selinux enabled, this option allows to not do that.
  • MTF_DO_NOT_CLEANUP Do not cleanup modules between tests, in case there is no interference in your tests you can use it, and it will be fast
  • MTF_REMOTE_REPOS It disables downloading of packages done by koji and creating local repo, it make tests fast. (There is issue that composes (repos) are sometimes bad in fedora, unable to use)

Schedule Tests

  • Now it is expected to run this under root
  • Install modularity-testing-framework from COPR repo like:
    • dnf copr enable phracek/Modularity-testing-framework
    • install it by command: dnf install -y modularity-testing-framework
    • It installs packages to python site-packages and to /usr/share/moduleframework
  • To include tests into your module, add to your Makefile section check
  • check section runs script which
  • Your should contain:
    • Docker based module testing: MODULE=docker avocado run /usr/share/moduleframework/tools/ ./*.py
    • Repo based module testing: MODULE=nspawn avocado run /usr/share/moduleframework/tools/ ./*.py
    • Host Rpm based module testing: MODULE=rpm avocado run /usr/share/moduleframework/tools/ ./*.py
    • make check - runs tests in your module directory

How to write tests


Framework is released under the GPL, version 2 or later, see LICENSE file in project


How it works