simple test checking if database is running

This commit is contained in:
mkocka 2017-04-25 14:56:37 +02:00
commit 0b408708ab
4 changed files with 22 additions and 19 deletions

View file

@ -4,17 +4,21 @@ ENV NAME=mongodb ARCH=x86_64
LABEL MAINTAINER "Matus Kocka" <mkocka@redhat.com>
LABEL summary="MongoDB is a scalable, high-performance, open source NoSQL database."
EXPOSE 27017
RUN INSTALL_PKGS="bind-utils gettext iproute rsync tar findutils python3 mongodb mongodb-server mongo-tools" && \
dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
dnf clean all
ENV MONGODB_VERSION=3.2 \
# Set paths to avoid hard-coding them in scripts.
HOME=/var/lib/mongodb \
CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/mongodb
ADD files /
ENTRYPOINT ["container-entrypoint"]
CMD ["run-mongod"]
EXPOSE 27017
CMD ["/usr/bin/run-mongod"]
# Container setup from scl
RUN : > /etc/mongod.conf && \
@ -26,4 +30,3 @@ RUN : > /etc/mongod.conf && \
VOLUME ["/var/lib/mongodb/data"]
USER 184

View file

@ -5,11 +5,11 @@ MODULEMDURL=file://mongodb.yaml
default: run
build:
docker build --tag=$(IMAGE_NAME) .
docker build --tag=$(IMAGE_NAME) .
run: build
docker run -d $(IMAGE_NAME)
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
cd tests; MODULE=docker MODULEMD=$(MODULEMDURL) URL="docker=$(IMAGE_NAME)" make all
# cd tests; MODULE=rpm MODULEMD=$(MODULEMDURL) URL="docker=$(IMAGE_NAME)" make all

View file

@ -19,14 +19,14 @@ packages:
- mongo-tools
testdependecies:
rpms:
- nc
- mongodb
module:
docker:
start: "docker run -d -e MONGODB_USER=user -e MONGODB_PASSWORD=pas -e MONGODB_DATABASE=db -e MONGODB_ADMIN_PASSWORD=admin -v /home/user/database:/var/lib/mongodb/data"
start: "docker run -d -e MONGODB_USER=user -e MONGODB_PASSWORD=pas -e MONGODB_DATABASE=db -e MONGODB_ADMIN_PASSWORD=admin -p 27017:27017"
labels:
description:
io.k8s.description:
source:
description: "MongoDB is a scalable, high-performance, open source NoSQL database."
io.k8s.description: "MongoDB is a scalable, high-performance, open source NoSQL database."
source: https://github.com/container-images/mongodb.git
container:
rpm:
start:
@ -34,7 +34,3 @@ module:
status:
repos:
- http://mirror.vutbr.cz/fedora/releases/26/Everything/x86_64/os/
test:
processrunning:

View file

@ -12,4 +12,8 @@ class SanityCheck1(module_framework.AvocadoTest):
:avocado: enable
"""
def test1(self):
self.start()
t1 = self.runHost('mongo --eval "exit 0;"',ignore_status=True)
self.assertEqual(t1.exit_status,252)