diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b04c669 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ + +test: + cd tests; make all diff --git a/debugging-tools.yaml b/debugging-tools.yaml new file mode 100644 index 0000000..3a83516 --- /dev/null +++ b/debugging-tools.yaml @@ -0,0 +1,58 @@ +document: modulemd +version: 1 +data: + summary: Set of debugging tools so I can troubleshoot my running server + description: The list of minimal set of debugging tools except base-runtime. + license: + module: [ MIT ] + dependencies: + buildrequires: + base-runtime: master + requires: + base-runtime: master + references: + community: https://fedoraproject.org/wiki/Modularity + documentation: https://fedoraproject.org/wiki/Fedora_Packaging_Guidelines_for_Modules + tracker: https://taiga.fedorainfracloud.org/project/modularity + profiles: + default: + rpms: + - iputils + - iproute + - lsof + - net-tools + - passwd + - strace + - valgrind + api: + rpms: + - iputils + - iproute + - lsof + - net-tools + - passwd + - strace + - valgrind + components: + rpms: + iputils: + rationale: A dependency of tangerine. + ref: master + iproute: + rationale: A dependency of tangerine. + ref: master + lsof: + rationale: A dependency of tangerine. + ref: master + net-tools: + rationale: A dependency of tangerine. + ref: master + passwd: + rationale: A dependency of tangerine. + ref: master + strace: + rationale: A dependency of tangerine. + ref: master + valgrind: + rationale: A dependency of tangerine. + ref: master diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..6238ea2 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,14 @@ +MODULE_LINT=/usr/lib/python2.7/site-packages/moduleframework/modulelint.py +CMD=python -m avocado run --filter-by-tags=-WIP $(MODULE_LINT) *.py + +# +generate: + generator + +check-docker: + MODULE=docker $(CMD) + +check-rpm: + MODULE=rpm $(CMD) + +all: generate check-docker check-rpm diff --git a/tests/config.yaml b/tests/config.yaml new file mode 100644 index 0000000..a112caf --- /dev/null +++ b/tests/config.yaml @@ -0,0 +1,41 @@ +document: modularity-testing +version: 1 +name: debugging-tools +modulemd-url: https://raw.githubusercontent.com/container-images/debugging-tools/master/debugging-tools.yaml +packages: + rpms: + - iputils + - iproute + - lsof + - net-tools + - passwd + - strace + - valgrind +source: https://github.com/container-images/debugging-tools +module: + rpm: + repos: + - http://mirror.vutbr.cz/fedora/releases/25/Everything/x86_64/os/ + - https://phracek.fedorapeople.org/debugging-tools-repo/ +test: + processrunning: + # Tests for iputils + - 'ls /usr/bin/ping' + - 'ls /usr/bin/tracepath' + # Tests for iproute + - 'ls /usr/sbin/ip' + - 'ls /usr/sbin/nstat' + # Tests for lsof + - 'ls /usr/bin/lsof' + # Tests for net-tools + - 'ls /usr/bin/netstat' + - 'ls /usr/sbin/arp' + - 'ls /usr/sbin/ifconfig' + - 'ls /usr/sbin/route' + # Tests for passwd + - 'ls /usr/bin/passwd' + # Tests for strace + - 'ls /usr/bin/strace' + # Tests for valgrind + - 'ls /usr/bin/valgrind' + - 'ls /usr/bin/vgdb' diff --git a/tests/simpleTest.py b/tests/simpleTest.py new file mode 100644 index 0000000..af2ad52 --- /dev/null +++ b/tests/simpleTest.py @@ -0,0 +1,56 @@ +#!/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 Sklenar +# + +from moduleframework import module_framework +import os +import time + + +class simpleTests(module_framework.AvocadoTest): + """ + :avocado: enable + """ + + def testAssertIn(self): + self.start() + # Tests for iputils + self.assertIn('Ping exists!', self.runHost('ls /usr/bin/ping').stdout) + self.assertIn('tracepath exists!', self.runHost('ls /usr/bin/tracepath').stdout) + # Tests for iproute + self.assertIn('IP exists!', self.runHost('ls /usr/sbin/ip').stdout) + self.assertIn('Nstat exists!', self.runHost('ls /usr/sbin/nstat').stdout) + # Tests for lsof + self.assertIn('lsof exists!', self.runHost('ls /usr/bin/lsof').stdout) + # Tests for net-tools + self.assertIn('netstat exists!', self.runHost('ls /usr/bin/netstat').stdout) + self.assertIn('arp exists!', self.runHost('ls /usr/sbin/arp').stdout) + self.assertIn('ifconfig exists!', self.runHost('ls /usr/sbin/ifconfig').stdout) + self.assertIn('route exists!', self.runHost('ls /usr/sbin/route').stdout) + # Tests for passwd + self.assertIn('passwd exists!', self.runHost('ls /usr/bin/passwd').stdout) + # Tests for strace + self.assertIn('strace exists!', self.runHost('ls /usr/bin/strace').stdout) + # Tests for valgrind + self.assertIn('valgrind exists!', self.runHost('ls /usr/bin/valgrind').stdout) + self.assertIn('vgdb exists!', self.runHost('ls /usr/bin/vgdb').stdout) +