1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-22 02:13:44 +01:00

Started testing docker executions

This commit is contained in:
Samúel Jón Gunnarsson 2017-09-27 11:24:48 +02:00
parent d661046464
commit 484e5c3c71
2 changed files with 26 additions and 1 deletions

View File

@ -1 +1,24 @@
echo "Keyrsla fyrir $1" #!/bin/sh -xe
# This script starts docker and systemd (if el7)
# Version of CentOS/RHEL
el_version=$1
# Run tests in Container
if [ "$el_version" = "6" ]; then
sudo docker run --rm=true -v `pwd`:/nagios-plugins:rw centos:centos${OS_VERSION} /bin/bash -c "bash -xe /nagios-plugins/tests/test_inside_docker.sh ${OS_VERSION}"
elif [ "$el_version" = "7" ]; then
docker run --privileged -d -ti -e "container=docker" -v /sys/fs/cgroup:/sys/fs/cgroup -v `pwd`:/nagios-plugins:rw centos:centos${OS_VERSION} /usr/sbin/init
DOCKER_CONTAINER_ID=$(docker ps | grep centos | awk '{print $1}')
docker logs $DOCKER_CONTAINER_ID
docker exec -ti $DOCKER_CONTAINER_ID /bin/bash -xec "bash -xe /nagios-plugins/tests/test_inside_docker.sh ${OS_VERSION};
echo -ne \"------\nEND NAGIOS-PLUGINS TESTS\n\";"
docker ps -a
docker stop $DOCKER_CONTAINER_ID
docker rm -v $DOCKER_CONTAINER_ID
fi

2
tests/test_inside_docker.sh Executable file
View File

@ -0,0 +1,2 @@
echo "Keyrsla fyrir CentOS $1"
ls -l /