Skip to content

Commit

Permalink
Merge pull request #190 from fedora-modularity/devel
Browse files Browse the repository at this point in the history
Merging devel into master branch
  • Loading branch information
phracek authored Dec 7, 2017
2 parents 9e97a6c + 68b06d3 commit ddbf834
Show file tree
Hide file tree
Showing 123 changed files with 5,308 additions and 977 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,5 @@ ENV/

# Generated files by framework
examples/baseruntime/generated.py
examples/memcached/generated.py
examples/memcached/generated.py

4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[submodule "tools/check_modulemd"]
path = tools/check_modulemd
url = https://github.com/fedora-modularity/check_modulemd

[submodule "build_manpages"]
path = build_manpages
url = https://github.com/praiskup/build_manpages
2 changes: 1 addition & 1 deletion .tito/packages/meta-test-family
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7.3-1 ./
0.7.8-1 ./
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language: python

python:
- "2.7"

Expand All @@ -8,21 +9,22 @@ services:
- docker

before_install:
- sudo apt-get -y install curl python-software-properties software-properties-common python-pip python-dev build-essential git make
- sudo apt-get -y install libkrb5-dev netcat mysql-client-5.5
- sudo pip install avocado-framework
- pip install avocado-framework
- sudo ./requirements.sh
- ./requirements.sh

install: sudo make install
install: sudo make install_pip

script:
- sudo make travis
- sudo make -C examples/testing-module check-inheritance
- sudo make -C examples/testing-module check-default-config
- sudo make -C examples/testing-module check-pure-docker
- sudo make -C examples/testing-module check-exceptions
- sudo make -C examples/testing-module check-test-mtf-bin-modulelint
- sudo make travis
- sudo make -C examples/testing-module check-real-rpm-destructive
- sudo make -C examples/testing-module check-docker-scl-multi-travis
- sudo make -C examples/testing-module check-mtf-pdc-module-info-reader
- sudo make -C mtf/metadata check
- sudo make -C examples/testing-module check-mtf-metadata

after_script: sudo cat ~/avocado/job-results/latest/job.log
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ recursive-include docs *
recursive-include examples *
recursive-include tools *
recursive-include distro *
recursive-include man *
recursive-include build_manpages *.py
22 changes: 19 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,36 @@ NAME=moduleframework
INSTALLPATH=/usr/share/$(NAME)
PYTHONSITE=/usr/lib/python2.7/site-packages

all: install check
all: install_pip check

check:
make -C examples/testing-module check

check-linter:
@# don't use $(shell ) -- it messes out output
cd examples/linter/tools && PYTHONPATH=${PWD} MODULE=docker ${PWD}/tools/mtf -l
cd examples/linter/rhscl-postgresql && PYTHONPATH=${PWD} MODULE=docker ${PWD}/tools/mtf -l
cd examples/linter/rhscl-nginx && PYTHONPATH=${PWD} MODULE=docker ${PWD}/tools/mtf -l
cd examples/linter/f26-etcd && PYTHONPATH=${PWD} MODULE=docker ${PWD}/tools/mtf -l
cd examples/linter/f26-flannel && PYTHONPATH=${PWD} MODULE=docker ${PWD}/tools/mtf -l

travis:
make -C examples/testing-module travis
cd examples/linter/tools && PYTHONPATH=${PWD} MODULE=docker mtf -l

.PHONY: clean

clean_pip:
pip uninstall .
rm -rf build/* dist/*


install_pip: clean_pip
pip install -U .

clean:
@python setup.py clean
git clean -fd
rm -rf build/html
rm -rf build/* dist/*

install: clean
@python setup.py install
Expand Down
2 changes: 1 addition & 1 deletion Makefile.docs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXBUILD = sphinx-build-2
PAPER =
BUILDDIR = build

Expand Down
7 changes: 3 additions & 4 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ Vagrant.configure(2) do |config|
set -x
TARGET=#{ENV['TARGET']}
test -z "$TARGET" && TARGET=check-docker
dnf install -y make docker httpd git python2-avocado python2-avocado-plugins-output-html \
python-netifaces redhat-rpm-config python2-devel python-gssapi krb5-devel
cd /opt/meta-test-family
make install
git submodule update --init
./requirements.sh
make install_pip
make -C examples/testing-module $TARGET
cp -r /root/avocado /var/www/html/
chmod -R a+x /var/www/html/
Expand Down
1 change: 1 addition & 0 deletions build_manpages
Submodule build_manpages added at 44d154
2 changes: 0 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
mtf_dir = os.path.abspath('..')
sys.path.insert(0, mtf_dir)

#from moduleframework import version as mtf_version

# Determine if this script is running inside RTD build environment
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

Expand Down
4 changes: 3 additions & 1 deletion docs/example-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ name: memcached
# MANDATORY (or compose-url)
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
# if you use compose, url,repo,repos in module->rpm will be ignored, and there will not be added more repos
# be carefull when using compose url
# env var: COMPOSEURL
compose-url: url_to_compose_in done in fedora
compose-url: https://kojipkgs.fedoraproject.org/compose/latest-Fedora-Modular-26/compose/Server/x86_64/os/
# variables what could be used in test
service:
port: 11211
Expand Down
Binary file modified docs/howitworks.dia
Binary file not shown.
Binary file modified docs/howitworks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 13 additions & 1 deletion docs/user_guide/environment_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,24 @@ Manual Setup

- No any configuration needed

**OpenShift**

- Install OpenShift if not installed and if environment variable ``OPENSHIFT_LOCAL`` is specified.
- if ``OPENSHIFT_LOCAL`` variable is specified, then it starts an OpenShift by command ``oc cluster up`` or stops it by command ``oc cluster down``.

Automated Setup
~~~~~~~~~~~~~~~

The environment configuration scripts should be executed in the same directory where the tests are, otherwise the environment variable **CONFIG** should be set.

- to setup environment run ``MODULE=docker mtf-env-set``
- to execute tests run ``MODULE=docker avocado run your.test.py``
- to execute tests run ``MODULE=docker mtf your.test.py``
- to cleanup environment ``MODULE=docker mtf-env-clean``

Test Creation
~~~~~~~~~~~~~~~

There is a script called mtf-init which generates easy template of test for module docker as example.

- to create template for module docker ``mtf-init --name your_name --container path_to_your_container``

6 changes: 6 additions & 0 deletions docs/user_guide/environment_variables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ Environment variables allow to overwrite some values of a module configuration f
- **MTF_REUSE=yes** uses the same module between tests. It speeds up test execution. It can cause side effects.
- **MTF_REMOTE_REPOS=yes** disables downloading of Koji packages and creating a local repo, and speeds up test execution.
- **MTF_DISABLE_MODULE=yes** disables module handling to use nonmodular test mode (see `multihost tests`_ as an example).
- **DOCKERFILE="<path_to_dockerfile"** overwrites the location of a Dockerfile.
- **OPENSHIFT_LOCAL=yes** enables installing ``origin`` and ``origin-clients`` on local machine
- **OPENSHIFT_IP=openshift_ip_address** uses this IP address for connecting to an OpenShift environment.
- **OPENSHIFT_USER=developer** uses this ``USER`` name for login to an OpenShift environment.
- **OPENSHIFT_PASSWORD=developer** uses this ``PASSWORD`` name for login to an OpenShift environment.
- **MTF_ODCS=[yes|openIDCtoken_string]** enable ODCS for compose creation. Token has to be placed or it tries contact openIDC token via your web browser. **Experimental feature**

.. _multihost tests: https://github.com/fedora-modularity/meta-test-family/tree/devel/examples/multios_testing

Expand Down
5 changes: 3 additions & 2 deletions docs/user_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ User Guide
test: build
cd tests; MODULE=docker MODULEMD=$(MODULEMDURL) URL="docker=$(IMAGE_NAME)" make all
cd tests; MODULE=nspawn MODULEMD=$(MODULEMDURL) make all
cd tests; MODULE=openshift OPENSHIFT_IP="127.0.0.1" OPENSHIFT_USER="developer" OPENSHIFT_PASSWORD="developer" make all
7. `Prepare the environment`_ to run tests in.

Expand All @@ -71,14 +72,14 @@ User Guide
.. code-block:: shell
#run Python tests from the tests/ directory
$ sudo MODULE=docker avocado run ./*.py
$ sudo MODULE=docker mtf ./*.py
or

.. code-block:: shell
#run Bash tests from the tests/ directory
$ sudo MODULE=docker avocado run ./*.sh
$ sudo MODULE=docker mtf ./*.sh
9. `Clean up the environment`_ after test execution.
Expand Down
8 changes: 8 additions & 0 deletions docs/user_guide/mtf_linters.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Linters
=================

MTF provides a set of linters for checking containers

Dockerfile linters
~~~~~~~~~~~~~~~~~~

7 changes: 7 additions & 0 deletions examples/linter/f26-etcd/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
document: meta-test
version: 1
name: etcd
module:
docker:
start: "docker run -it -d"
container: registry.fedoraproject.org/f26/etcd
7 changes: 7 additions & 0 deletions examples/linter/f26-flannel/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
document: meta-test
version: 1
name: flannel
module:
docker:
start: "docker run -it -d"
container: registry.fedoraproject.org/f26/flannel
7 changes: 7 additions & 0 deletions examples/linter/rhscl-nginx/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
document: meta-test
version: 1
name: etcd
module:
docker:
start: "docker run -it -d"
container: registry.access.redhat.com/rhscl/nginx-18-rhel7
7 changes: 7 additions & 0 deletions examples/linter/rhscl-postgresql/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
document: meta-test
version: 1
name: etcd
module:
docker:
start: "docker run -it -d -e POSTGRESQL_USER=test -e POSTGRESQL_PASSWORD=testt -e POSTGRESQL_DATABASE=db"
container: registry.access.redhat.com/rhscl/postgresql-95-rhel7
59 changes: 59 additions & 0 deletions examples/linter/tools/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
FROM registry.fedoraproject.org/fedora:26
LABEL maintainer "Tomas Tomecek \"[email protected]\""

ENV NAME=tools VERSION=0 RELEASE=2 ARCH=x86_64
LABEL com.redhat.component="$NAME" \
name="$FGC/$NAME" \
version="$VERSION" \
release="$RELEASE.$DISTTAG" \
architecture="$ARCH" \
run="docker run -it --name NAME --privileged --ipc=host --net=host --pid=host -e HOST=/host -e NAME=NAME -e IMAGE=IMAGE -v /run:/run -v /var/log:/var/log -v /etc/machine-id:/etc/machine-id -v /etc/localtime:/etc/localtime -v /:/host IMAGE" \
summary="container with all the management tools you miss in Atomic Host"

# vim-minimal conflicts with vim-enhanced
RUN dnf remove -y vim-minimal && dnf install -y \
bash-completion \
bc \
bind-utils \
blktrace \
crash \
e2fsprogs \
ethtool \
file \
gcc \
gdb \
git-core \
glibc-utils \
gomtree \
htop \
hwloc \
iotop \
iproute \
iputils \
less \
ltrace \
mailx \
net-tools \
netsniff-ng \
nmap-ncat \
numactl \
numactl-devel \
parted \
pciutils \
perf \
procps-ng \
psmisc \
screen \
sos \
strace \
sysstat \
tcpdump \
tmux \
vim-enhanced \
xfsprogs \
&& dnf clean all

# FIXME: current go-md2man can't convert tables :<
COPY ./root/ /

CMD ["/usr/bin/bash"]
7 changes: 7 additions & 0 deletions examples/linter/tools/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
document: meta-test
version: 1
name: tools
module:
docker:
start: "docker run -it -d"
container: candidate-registry.fedoraproject.org/f26/tools:latest
Loading

0 comments on commit ddbf834

Please sign in to comment.