Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Added Dockerfile in order have containerized runs of tests #167

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
39 changes: 39 additions & 0 deletions .aht.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/python
#if [ -z "$TEST_PATH" ]; then
# echo "No test provided; please supply a value for TEST_PATH"
# exit 1
#fi
#if [ ! -f "/atomic-host-tests/$TEST_PATH" ]; then
# echo "The value for TEST_PATH does not exist"
# exit 1
#fi
#env ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook "/atomic-host-tests/$TEST_PATH" "$@"

import os
import sys
import argparse
import subprocess

def parse_args(args=None):
parser = argparse.ArgumentParser(description='Atomic hosts tests helper script')
parser.add_argument('-tp', '--testpath',
help='Test path relative to \
/atomic-host-test folder \
inside the container',
required='True')
results = parser.parse_args(args[0:2])
actual_path = "/atomic-host-tests/tests/{0}".format(results.testpath)
if not os.path.exists(actual_path):
print("TESTPATH does not exist Please mention the tests from following")
print(os.listdir("/atomic-host-tests/tests/"))
else:
print("env ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook {0} {1}".format(actual_path, " ".join(args[2:])))
os.system("env ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook {0} {1}".format(actual_path, " ".join(args[2:])))
return(actual_path)

if __name__ == '__main__':
path = os.path.dirname("/atomic-host-tests/")
p = subprocess.Popen(["/usr/bin/git", "pull", "origin", "master"], cwd=path)
p.wait()
testpath = parse_args(sys.argv[1:])
print(testpath)
10 changes: 10 additions & 0 deletions .aht.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
if [ -z "$TEST_PATH" ]; then
echo "No test provided; please supply a value for TEST_PATH"
exit 1
fi
if [ ! -f "/atomic-host-tests/$TEST_PATH" ]; then
echo "The value for TEST_PATH does not exist"
exit 1
fi
env ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook "/atomic-host-tests/$TEST_PATH" "$@"
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM registry.fedoraproject.org/fedora:25
RUN dnf -y install \
git \
python-pip \
libselinux-python \
python-devel \
libffi-devel \
redhat-rpm-config \
openssl-devel \
gcc \
rpm-build
RUN git clone https://github.com/projectatomic/atomic-host-tests
WORKDIR "/atomic-host-tests"
RUN pip install -r requirements.txt
COPY .aht.py /aht.py
ENTRYPOINT ["/aht.py"]
6 changes: 6 additions & 0 deletions tests/test/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- hosts: localhost
connection: local
tasks:
- debug:
msg: "Hi there"