First tests

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
This commit is contained in:
Petr "Stone" Hracek 2017-05-02 14:35:14 +02:00
parent 023a0def73
commit a5499de9e0
6 changed files with 108 additions and 0 deletions

1
.gitignore vendored
View File

@ -0,0 +1 @@
*.py[oc]

28
Dockerfile Normal file
View File

@ -0,0 +1,28 @@
FROM registry.fedoraproject.org/fedora:26
# ruby image for OpenShift.
#
# Environment:
ENV NAME=ruby ARCH=x86_64
LABEL MAINTAINER "Jun Aruga" <jaruga@redhat.com>
LABEL summary="An interpreter of object-oriented scripting language" \
name="$FGC/$NAME" \
version="0" \
release="1.$DISTTAG" \
architecture="$ARCH" \
com.redhat.component=$NAME \
usage="docker run f26/ruby" \
help="Runs ruby. No dependencies. See Help File below for more details." \
description="An interpreter of object-oriented scripting language" \
io.k8s.description="An interpreter of object-oriented scripting language" \
io.k8s.diplay-name="Ruby 2.4 " \
io.openshift.tags="ruby"
RUN dnf install -y --setopt=tsflags=nodocs ruby && \
dnf -y clean all
# ruby will be run under standard user on Fedora
USER 1000
CMD /bin/bash

16
Makefile Normal file
View File

@ -0,0 +1,16 @@
IMAGE_NAME = ruby
MODULEMDURL=file://ruby.yaml
default: run
build:
docker build --tag=$(IMAGE_NAME) .
run: build
docker run -d $(IMAGE_NAME)
test: build
cd tests; MODULE=docker MODULEMD=$(MODULEMDURL) URL="docker=$(IMAGE_NAME)" make all
cd tests; MODULE=rpm MODULEMD=$(MODULEMDURL) URL="docker=$(IMAGE_NAME)" make all

8
tests/Makefile Normal file
View File

@ -0,0 +1,8 @@
MODULE_LINT=/usr/share/moduleframework/tools/modulelint.py
# --filter-by-tags=-WIP: ignore WIP tag test that have a issue on F25 avocado.
CMD=python -m avocado run --filter-by-tags=-WIP $(MODULE_LINT) *.py
#
all:
generator
$(CMD)

30
tests/config.yaml Normal file
View File

@ -0,0 +1,30 @@
document: modularity-testing
version: 1
name: ruby
modulemd-url: https://src.fedoraproject.org/cgit/modules/ruby.git/plain/ruby.yaml
service:
port: 8080
packages:
rpms:
# add which here because of the issue.
# https://pagure.io/modularity-testing-framework/issue/45
- ruby
testdependecies:
rpms:
- which
module:
docker:
start: "docker run -it"
container: docker.io/ruby
rpm:
repos:
- http://download.eng.brq.redhat.com/pub/fedora/linux/development/rawhide/Everything/x86_64/os/
- http://download.eng.brq.redhat.com/pub/fedora/linux/development/26/Everything/x86_64/os/
test:
cmd:
- 'which ruby'
version:
- 'ruby -v'
testhost:
hostname:
- 'hostname'

25
tests/generated.py Normal file
View File

@ -0,0 +1,25 @@
#!/usr/bin/python
import socket
from avocado import main
from moduleframework import module_framework
if __name__ == '__main__':
main()
class GeneratedTestsConfig(module_framework.AvocadoTest):
"""
:avocado: enable
"""
def test_cmd(self):
self.start()
self.run("which ruby")
def test_version(self):
self.start()
self.run("ruby -v")
def test_hostname(self):
self.start()
self.runHost("hostname")