Update tests

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
This commit is contained in:
Petr "Stone" Hracek 2017-04-07 15:09:05 +02:00
commit 660bcdd20e
2 changed files with 17 additions and 13 deletions

View file

@ -10,25 +10,27 @@ packages:
testdependecies:
rpms:
- nc
- docker
source: https://github.com/container-images/haproxy
module:
docker:
setup:
cp my-haproxy.cfg local-haproxy.cfg
setup: cp -f my-haproxy.cfg local-haproxy.cfg;
IPR=`ip r |grep default |cut -d ' ' -f 5`;
IPA=`ip a s dev $IPR |egrep -o 'inet [0-9.]+' |egrep -o [0-9.]+`;
sed s/127.0.0.1/$IPA/ -i local-haproxy.cfg;
start: "docker run -it -p 8077:80 -v $(pwd)/local-haproxy.cfg:/etc/haproxy/haproxy.cfg:Z"
labels:
description: "HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments."
io.k8s.description: "HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments."
container: docker.io/modularitycontainers/haproxy
rpm:
setup:
sed s/127.0.0.1/`hostname -i | egrep -o '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'`/ my-haproxy.cfg > local-haproxy.cfg;
sed -i 's/bind\*/bind :8077/' local-haproxy.cfg;
cp $(pwd)/local-haproxy.cfg /etc/haproxy/haproxy.cfg;
semanage port -a -t http_port_t -p tcp 8001;
semanage port -a -t http_port_t -p tcp 8000;
semanage port -a -t http_port_t -p tcp 8077;
sleep 4;
setup: cp -f my-haproxy.cfg local-haproxy.cfg;
sed -i 's/bind.*/bind :8077/' local-haproxy.cfg;
cp local-haproxy.cfg /etc/haproxy/haproxy.cfg;
semanage port -a -t http_port_t -p tcp 8001;
semanage port -a -t http_port_t -p tcp 8000;
semanage port -a -t http_port_t -p tcp 8077;
sleep 4
start: systemctl start haproxy
stop: systemctl stop haproxy
status: systemctl status haproxy

View file

@ -23,7 +23,8 @@
from moduleframework import module_framework
import os
import time
from avocado.utils import service
class simpleTests(module_framework.AvocadoTest):
"""
@ -31,10 +32,11 @@ class simpleTests(module_framework.AvocadoTest):
"""
def setUp(self):
super(self.__class__, self).setUp()
service_manager = service.ServiceManager()
service_manager.start('docker')
self.runHost('docker pull docker.io/httpd')
self.runHost('docker run --name http_name_8000 -d -p 8000:80 docker.io/httpd')
self.runHost('docker run --name http_name_8001 -d -p 8001:80 docker.io/httpd')
time.sleep(5)
def tearDown(self):
super(self.__class__, self).tearDown()
@ -45,5 +47,5 @@ class simpleTests(module_framework.AvocadoTest):
def testAssertIn(self):
self.start()
self.assertIn('It works!',self.runHost('curl localhost:8077').stdout)
self.assertIn('It works!',self.runHost('curl 127.0.0.1:8077', shell = True).stdout)