From c786f7cc3e2e3b20bb6ad6a9b76b2e8908bc8ecd Mon Sep 17 00:00:00 2001 From: Andrei Stepanov Date: Aug 17 2018 12:47:58 +0000 Subject: Add info how to use FMF in provisioners. Signed-off-by: Andrei Stepanov --- diff --git a/README.md b/README.md index 3758759..063aa86 100644 --- a/README.md +++ b/README.md @@ -21,15 +21,58 @@ Standard Test Interface as described at # Standard Inventory scripts -The inventory scripts are about taking the subjects produced by a CI system -and transforming them into something testable. That includes launching -a QCow2 image into a virtual machine, or installing an RPM. +The inventory scripts are about taking the subjects produced by a CI system and +transforming them into something testable. That includes launching a QCow2 +image into a virtual machine, or installing an RPM. Tests are not required to use these scripts but they provide useful, usable defaults for this task. +## Flexible Metadata Format for default provisioner(s) -## `standard-inventory-qcow2` +You can find information for FMF [here][1], and for supported FMF attributes +[here][2]. + +### Initialize a new metadata tree + +To add desired parameters for default provisioners first of all make sure that +your `/tests` directory has initialized metadata tree. Directory `.fmf` must be +present. If it is not, run next command: + +``` +fmf init +``` + +### Usage + +Put in `/tests` a file with name `provision.fmf`: + +```yaml +--- + +standard-inventory-qcow2: + qemu: + m: 3G + net_nic: + model: e1000 + +standard-inventory-docker: + dumb_option: dumb_parameter +``` + +### Supported parameters + +#### standard-inventory-qcow2 + +* `qemu.m` - RAM size in megabytes. Optionally, a suffix of `M` or `G`. +* `qemu.net_nic.model` - Use `qemu-system-x86_64 -net nic,model=help` for a list + of available devices. + +You can open a RFE ticket to extend supported parameters according to +https://qemu.weilnetz.de/doc/qemu-doc.html + + +## LOCK_ON_FILE for standard-inventory-qcow2 This inventory script launches a virtual machine via qemu. The VM image should be specified via command line or an environment variable `TEST_SUBJECTS`. @@ -78,3 +121,7 @@ is missing. Let's look at an example: ansible_user: "{{ inventory_data.ansible_user }}" ansible_python_interpreter: "{% if vm_python_interpreter != '' %}{{ vm_python_interpreter }}{% else %}/usr/bin/python2{% endif %}" ``` + + +[1]: https://fedoraproject.org/wiki/CI/Metadata +[2]: http://fmf.readthedocs.io/ diff --git a/roles/standard-test-beakerlib/README.md b/roles/standard-test-beakerlib/README.md index 09897f5..2dee24f 100644 --- a/roles/standard-test-beakerlib/README.md +++ b/roles/standard-test-beakerlib/README.md @@ -6,7 +6,7 @@ testing. You can redefine the following variables in `roles/standard-test-beakerlib/vars/main.yml`: * **tests**: A list of beakerlib test files - * **fmf_filter**: An fmf filter to select tests based on test metadata [1] + * **fmf_filter**: An fmf filter to select tests based on test [metadata][1] * **artifacts**: An artifacts directory on localhost to store logs * **remote_artifacts**: The directory on the system under test where the logs are stored. Note: if this variable is left undefined, it will default to @@ -26,45 +26,55 @@ testing. You can redefine the following variables in Example usage: - - hosts: localhost - roles: - - role: standard-test-beakerlib - tags: - - classic - repositories: - - repo: "https://src.fedoraproject.org/tests/shell.git" - dest: "shell" - tests: - - shell/func - - shell/login - - shell/smoke - required_packages: - - expect - - which +```yaml +- hosts: localhost + roles: + - role: standard-test-beakerlib + tags: + - classic + repositories: + - repo: "https://src.fedoraproject.org/tests/shell.git" + dest: "shell" + tests: + - shell/func + - shell/login + - shell/smoke + required_packages: + - expect + - which +``` -Instead of manually listing all tests to be executed it is also -possible to provide an fmf [1] filter in the following way: +# Flexible Metadata Format support - - hosts: localhost - roles: - - role: standard-test-beakerlib - tags: - - classic - repositories: - - repo: "https://src.fedoraproject.org/tests/shell.git" - dest: "shell" - fmf_filter: "tier: 1" +## Filter required tests + +Instead of manually listing all tests to be executed it is also possible to +provide an [fmf][1] filter in the following way: + +```yaml +- hosts: localhost + roles: + - role: standard-test-beakerlib + tags: + - classic + repositories: + - repo: "https://src.fedoraproject.org/tests/shell.git" + dest: "shell" + fmf_filter: "tier: 1" +``` Filter can be used also if tests are stored directly in the git: - - hosts: localhost - roles: - - role: standard-test-beakerlib - tags: - - classic - fmf_filter: "tier: 1" +```yaml +- hosts: localhost + roles: + - role: standard-test-beakerlib + tags: + - classic + fmf_filter: "tier: 1" +``` -See the Fedora CI metadata wiki [1] for more details and examples -on test metadata. +See the Fedora CI [metadata wiki][1] for more details and examples on test +metadata. -[1] https://fedoraproject.org/wiki/CI/Metadata +[1]: https://fedoraproject.org/wiki/CI/Metadata