Configuration file

To test a module create its configuration file config.yaml similar to an example configuration file described further. If the tested module doesn’t represent any service, the minimal configuration file structure can be used.

An example of config.yaml header:

document: modularity-testing
version: 1

An example of module general description:

name: memcached
modulemd-url: http://raw.githubusercontent.com/container-images/memcached/master/memcached.yaml
compose-url: https://kojipkgs.fedoraproject.org/compose/latest-Fedora-Modular-26/compose/Server/x86_64/os/Packages/m/memcached-1.4.36-1.module_b2e063be.x86_64.rpm
service:
    port: 11211
packages:
    rpms:
        - memcached
        - perl-Carp
testdependencies:
    rpms:
        - nc
  • name defines module name
  • modulemd-url contains a link to a moduleMD file
  • compose-url links to a final compose Pungi build. repo or repos can be used instead, see further
  • service stores a port if a module has any
  • packages defines a module type (at the moment only rpms type is supported)
  • testdependencies covers dependencies to be installed and used in tests

An example of module types specification:

default_module: docker
module:
    openshift:
        template: ./memcached.yaml
        docker_pull: True
        container: docker.io/modularitycontainers/memcached
    docker:
        setup: "docker run -it -e CACHE_SIZE=128 -p 11211:11211"
        cleanup:"echo Cleanup magic"
        labels:
            description: "memcached is a high-performance, distributed memory"
            io.k8s.description: "memcached is a high-performance, distributed memory"
        source: https://github.com/container-images/memcached.git
        url: docker.io/phracek/memcached
    rpm:
        setup: /usr/bin/memcached -p 11211
        cleanup: echo Cleanup magic
        start: systemctl start memcached
        stop: systemctl stop memcached
        status: systemctl status memcached
        url: http://download.englab.brq.redhat.com/pub/fedora/releases/25/Everything/x86_64/os/
    inheriteddocker:
        parent: docker
        start: "docker run -it -p 11211:11211"
  • default_module, if specified, sets the default tested module type
  • setup runs setup commands on a host machine, not in container, and prepares the environment for tests, for example changes selinux policy or hostname
  • cleanup: similar to setup but done after test finished
  • start defines how to start module service if there is any
  • stop defines how to stop module service if there is any
  • status defines how to check the status of module service if there is any
  • labels contains docker labels to check if there is any
  • url contains link to a container or repo (same meaning as container or repo)
  • container contains a link to a container (docker.io or local tar.gz file) (obsolete)
  • repo is used when compose-url is not set and contains a repo to be used for rpm module type testing (obsolete)
  • parent if you would like to have more configs for same module type, it is possible to do it via inheritance. There will be used parent module + overwritten values with this one, you can rewrite whatever you want. You have to set parent (base) module type allowed are just rpm/docker
  • template contains an URL link or a path to an OpenShift template. The template is added into OpenShift resources, like template and new application is created based on the template. The template is used to deploy your application inside OpenShift using command oc new-app …
  • docker_pull specifies if image is pulled by command docker pull or not before adding to an OpenShift registry. Disabling this prevents your local image being overwritten. If it is not present then default value is True. You can specify ‘True’ or ‘False’.

Multiline Bash snippet tests

A config.yaml file may contain multiline Bash snippet tests directly. Every Bash command has to finish with 0 return code otherwise it returns fail:

test:
    processrunning:
        - 'ls  /proc/*/exe -alh | grep memcached'
testhost:
    selfcheck:
        - 'echo errr | nc localhost 11211'
        - 'echo set AAA 0 4 2 | nc localhost 11211'
        - 'echo get AAA | nc localhost 11211'
    selcheckError:
        - 'echo errr | nc localhost 11211 |grep ERROR'
  • test defines a section of multiline bash snippet tests
  • processrunning contains commands to run as tests and displayed as avocado output
  • testhost is optional and similar to test. The difference is that it runs commands on host machine so that there could be more dependencies than there are just in a module.

See also

User Guide
User Guide
webchat.freenode.net
Questions? Help? Ideas? Stop by the #fedora-modularity chat channel on freenode IRC.