Skip to content

Commit

Permalink
Merge pull request #41 from fedora-modularity/devel
Browse files Browse the repository at this point in the history
Merge request to master
  • Loading branch information
phracek authored Aug 10, 2017
2 parents e920e58 + 268138a commit 150afae
Show file tree
Hide file tree
Showing 40 changed files with 1,910 additions and 1,575 deletions.
20 changes: 20 additions & 0 deletions .landscape.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Include warnings about missing documentation?
doc-warnings: False

# Include warnings about tests?
test-warnings: True

# tests stricktness
strictness: medium

pylint:
options:
max-line-length: 120

# autodetect dependencies?
autodetect: True

# paths to be ignored
ignore-paths:
- docs
- setup.py
2 changes: 1 addition & 1 deletion .tito/packages/modularity-testing-framework
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.18-1 ./
0.5.19-1 ./
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Code Health](https://landscape.io/github/fedora-modularity/meta-test-family/master/landscape.svg?style=flat)](https://landscape.io/github/fedora-modularity/meta-test-family/master)

Meta test family (MTF) is a tool to test components of [a modular Fedora](https://docs.pagure.org/modularity/).

For more information, check out the documentation page:
Expand Down
4 changes: 2 additions & 2 deletions docs/api/exceptions_debug.rst → docs/api/common.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Exceptions and Debug
====================
Common
=======

.. automodule:: moduleframework.common
:members:
Expand Down
7 changes: 7 additions & 0 deletions docs/api/exceptions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Exceptions
===========

.. automodule:: moduleframework.exceptions
:members:
:undoc-members:

3 changes: 2 additions & 1 deletion docs/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ This section contains the MTF API, auto generated from `the source code`_.
.. toctree::

module_framework
exceptions_debug
common
exceptions
mtf_generator
compose_info
pdc_data
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'MetaTestfamily', u'Meta Test family Documentation',
(master_doc, 'MetaTestFamily', u'MetaTestFamily Documentation',
u'Petr Hracek@*Jan Scotka', 'MetaTestFamily', 'One line description of project.',
'Miscellaneous'),
]
Expand Down
2 changes: 1 addition & 1 deletion docs/example-config-minimal.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
document: modularity-testing
version: 1
name: bash
modulemd-url: https://src.fedoraproject.org/cgit/modules/memcached.git/plain/memcached.yaml
modulemd-url: https://src.fedoraproject.org/modules/memcached/raw/master/f/memcached.yaml
packages:
rpms:
- bash
Expand Down
2 changes: 1 addition & 1 deletion docs/example-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ name: memcached
# link to default moduleMD file (usefull for local testing wihtout any repo)
# env var: MODULEMDURL
# MANDATORY (or compose-url)
modulemd-url: https://src.fedoraproject.org/cgit/modules/memcached.git/plain/memcached.yaml
modulemd-url: https://src.fedoraproject.org/modules/memcached/raw/master/f/memcached.yaml
# final compose done by pungi (contain also modulemd files for modules) can suppy also previous part
# env var: COMPOSEURL
compose-url: url_to_compose_in done in fedora
Expand Down
8 changes: 4 additions & 4 deletions docs/user_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ User Guide

1. In a module's root directory create a directory ``tests`` and place there a module configuration file ``config.yaml`` described in detail in section `Configuration file`_.

.. _Configuration file: how_to_write_conf_file
.. _Configuration file: how_to_write_conf_file.html

2. Optionally write multiline Bash snippet tests directly in the ``tests/config.yaml`` file as described in section `Multiline Bash snippet tests`_.

.. _Multiline Bash snippet tests: how_to_write_conf_file#multiline-bash-snippet-tests
.. _Multiline Bash snippet tests: how_to_write_conf_file.html#multiline-bash-snippet-tests

3. Check the list of `Environment variables`_.

.. _Environment variables: environment_variables
.. _Environment variables: environment_variables.html

4. Write your tests, for example see `sanity tests`_ and various tests examples in ``/usr/share/moduleframework/examples/testing-module/``. All tests methods are listed in section `API Index`_ and alphabetically in :ref:`genindex` section.

.. _sanity tests: https://github.com/fedora-modularity/meta-test-family/blob/master/examples/template/sanity_template.py
.. _API Index: ../api/index
.. _API Index: ../api/index.html

5. In the directory ``tests`` create a ``Makefile`` as below.

Expand Down
10 changes: 5 additions & 5 deletions docs/user_guide/scheduling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Testsuite of project
Taskotron Wokflow
----------------------------
- Production instance: https://taskotron.fedoraproject.org/resultsdb/results?testcases=dist.modularity-testing-framework
- Trigerred fedmsg via **module-stream-version** string
- Trigerred by **Module Build system** done message, list of all: https://apps.fedoraproject.org/datagrepper/raw?topic=org.fedoraproject.prod.mbs.module.state.change
- Triggered fedmsg via **module-stream-version** string
- Triggered by **Module Build system** done message, list of all: https://apps.fedoraproject.org/datagrepper/raw?topic=org.fedoraproject.prod.mbs.module.state.change
- There is general `runtask.yml` taskotron trigger: https://pagure.io/taskotron/task-modularity-testing-framework
- There is just one for every module and it contains whole logic where to find tests for module.
- Not needed to duplicate `runtash.yml` for each component. Scheduler is same (existing Makefile)
Expand All @@ -34,15 +34,15 @@ Taskotron Wokflow
- If None: Try to find module dir in MTF project tests in `/usr/share/moduleframework/examples` directory
- If None: Run at least general ModuleLinter (`/usr/share/moduleframework/tools/modulelint`) with general minimal config.yaml located in `docs` directory

Internal Jenkins Instance
Arbitrary Jenkins Instance
----------------------------
- Production instance: `hidden`
- Trigerred via `fedmsg file`
- Triggered via `fedmsg file`
- Used **tools/run-them.sh** script, for same behaviour as Taskotron
- **run-them.sh** script for Jenkins based on whole fedmsg
- Test Subject: Same as *Taskotron Workflow*
- Located in: Same as *Taskotron Workflow*
- Scheduled as: `run-them.sh testmodule /usr/share/moduleframework/tools/example_message_module.yaml fedmsg`
- Example targets: `check-run-them-fedmsg-testmodule`
- Internal logic
- Same as *Taskotron Workflow*
- Same as *Taskotron Workflow*
2 changes: 1 addition & 1 deletion examples/multios_testing/sanity1.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def testServerInside(self):
time.sleep(2)
b = self.run("cat %s" %TFILE).stdout.strip()
self.assertEqual(a,b)
self.assertIn("25", b)
self.assertIn("26", b)



Expand Down
6 changes: 3 additions & 3 deletions examples/multios_testing/sanityRealMultiHost.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class SanityRealMultihost(module_framework.AvocadoTest):
:avocado: enable
"""
def setUp(self):
self.machineF25 = module_framework.get_correct_backend()[0]
self.machineF26 = module_framework.get_correct_backend()[0]
self.machineRawhide = module_framework.get_correct_backend()[0]
self.machineF25 = module_framework.get_backend()[0]
self.machineF26 = module_framework.get_backend()[0]
self.machineRawhide = module_framework.get_backend()[0]
self.machineF25.setRepositoriesAndWhatToInstall(repos = ["http://ftp.fi.muni.cz/pub/linux/fedora/linux/releases/25/Everything/x86_64/os/"])
self.machineF26.setRepositoriesAndWhatToInstall(repos = ["http://ftp.fi.muni.cz/pub/linux/fedora/linux/development/26/Everything/x86_64/os/"])
self.machineRawhide.setRepositoriesAndWhatToInstall(repos = ["http://ftp.fi.muni.cz/pub/linux/fedora/linux/development/rawhide/Everything/x86_64/os/"])
Expand Down
2 changes: 1 addition & 1 deletion examples/testing-module/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CMD=avocado run --filter-by-tags=-WIP
TESTS=$(shell ls *.py *.sh modulelint/*.py)
TESTS=$(shell ls *.py *.sh ../../tools/modulelint/*.py)
export MTF_REMOTE_REPOS=yes
export DEBUG=yes
export DOCKERFILE=./Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion examples/testing-module/PureAvocadoTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class PureAvocadoTest(Test):

def setUp(self):
self.backend, self.moduletype = module_framework.get_correct_backend()
self.backend, self.moduletype = module_framework.get_backend()
self.backend.setUp()

def testInsideModule(self):
Expand Down
1 change: 0 additions & 1 deletion examples/testing-module/microdnfinside.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#

from moduleframework import module_framework
import os


class microDNFTest(module_framework.AvocadoTest):
Expand Down
1 change: 0 additions & 1 deletion examples/testing-module/moduleframework

This file was deleted.

1 change: 0 additions & 1 deletion examples/testing-module/modulelint

This file was deleted.

5 changes: 3 additions & 2 deletions examples/testing-module/skipTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# Authors: Jan Scotka <[email protected]>
#

from moduleframework import common
from moduleframework import module_framework
from avocado import skipIf
from avocado import skipUnless
Expand All @@ -40,12 +41,12 @@ def testGccSkippedInsideTest(self):
self.start()
self.run("gcc -v")

@skipIf(module_framework.get_correct_profile() == "default")
@skipIf(common.get_profile() == "default")
def testDecoratorNotSkippedForDefault(self):
self.start()
self.run("echo for default profile")

@skipUnless(module_framework.get_correct_profile() == "gcc")
@skipUnless(common.get_profile() == "gcc")
def testDecoratorSkip(self):
self.start()
self.run("gcc -v")
19 changes: 18 additions & 1 deletion meta-test-family.spec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Requires: python2-dockerfile-parse
Requires: python2-pdc-client
Requires: python2-modulemd
Provides: modularity-testing-framework = %{version}-%{release}
Obsoletes: modularity-testing-framework < 0.5.18-1
Obsoletes: modularity-testing-framework < 0.5.18-2

%description
%{summary}.
Expand Down Expand Up @@ -51,6 +51,23 @@ chmod a+x %{buildroot}%{python_sitelib}/%{framework_name}/{module_framework,mtf_
%{_datadir}/moduleframework/

%changelog
* Mon Aug 07 2017 Nils Philippsen <[email protected]> 0.5.19-1
- obsolete modularity-testing-framework-0.5.18-1, too

* Fri Aug 04 2017 Petr "Stone" Hracek <[email protected]> 0.5.19-1
- Add Landscap.io into project (#27) ([email protected])
- Update scheduling.rst ([email protected])
- Several fixes caused by missing testing. ([email protected])
- Draft of refactoring avocado-tests. ([email protected])
- replaced get_correct_backed in all internal tests by get_backend
([email protected])
- fixed typo caused by function moving to other module ([email protected])
- function names cleanup, removed "correct" "latest" words fixing command
sanitizer ([email protected])
- changed return variable to not be same as input param ([email protected])
- improved multihost test handling and created functions for normalizing
commands before run (escaping) ([email protected])

* Tue Aug 01 2017 Petr Hracek <[email protected]> - 0.5.18-2
- Renaming package to the new name meta-test-family

Expand Down
22 changes: 22 additions & 0 deletions moduleframework/avocado_testers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This Modularity Testing Framework helps you to write tests for modules
# Copyright (C) 2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# he Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Authors: Petr Hracek <[email protected]>
#
Loading

0 comments on commit 150afae

Please sign in to comment.