Commit 6e5921c6 authored by Alexander Lercher's avatar Alexander Lercher

Merge branch 'feature/AutomatingTesting' into develop

parents ec6dca7c c611935d
......@@ -35,9 +35,11 @@ for command_arg in command_args:
os.remove(os.path.join(ROOT, DOCKER_COMPOSE_NAME))
res_str.append(f"{image_name} built with exit code {exit_val}")
if exit_val != 0:
error = exit_val
else:
# push created Docker image
exit_val = os.system(f"docker push {image_name}")
......
import os
import sys
import importlib.util
import pathlib
ROOT = pathlib.Path(__file__).parent.parent.absolute()
TESTS_FOLDER_NAME = "/tests"
print("\nSearching for tests at the path: "+ str(ROOT))
count = 0
resultCodeList = []
for (dirname, dirs, files) in os.walk(ROOT):
#I assume all the tests are placed in a folder named "tests"
if (TESTS_FOLDER_NAME in str(dirname)) \
and not(f"{TESTS_FOLDER_NAME}/" in str(dirname)) \
and not("venv" in str(dirname)):
try:
print(f"Executing tests in {dirname}")
os.chdir(os.path.normpath(dirname))
# TODO do this during docker image setup
exit_val = os.system("python3.7 -m pip install -r ../requirements.txt") # install pip dependencies
exit_val = os.system("python3.7 -m unittest discover") # execute the tests
resultCodeList.append(exit_val) #once per folder i.e if 3 tests are in a folder and crash, there will be just one exit val
except Exception as e:
print(e)
continue
firstError = -1
i = 0
while i < len(resultCodeList):
if resultCodeList[i] != 0:
# print("\nA test failed with code: "+ str(resultCodeList[i]))
if (firstError < 0):
firstError = i
i += 1
if(firstError<0): #no errors found
sys.exit(0)
else:
sys.exit(1) #return code>0
\ No newline at end of file
import unittest
import sys
sys.path.insert(1, './')
sys.path.insert(1, '../')
# python -m unittest discover -v tests
# python -m unittest discover
from db.entities.cluster import Cluster
from db.entities import TimeCluster, LocationCluster
......
import unittest
import sys
sys.path.insert(1, './')
sys.path.insert(1, '../')
# python -m unittest discover -v tests
# python -m unittest discover
from processing.clusterer import Clusterer
class TestClusterer(unittest.TestCase):
......
......@@ -5,15 +5,14 @@ ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update
RUN pip install flask
RUN pip install connexion[swagger-ui]
RUN pip install pika
EXPOSE 5000
WORKDIR /app
COPY src/data-hub/semantic-linking-microservice/app/ /app/
COPY src/modules/ /app/
RUN pip install -r requirements.txt
RUN chmod a+x main.py
CMD ["python", "./main.py"]
\ No newline at end of file
# add modules folder to interpreter path
import sys
import os
modules_paths = ['../app/', '../../../modules/']
modules_paths = ['../', '../../../../modules/']
for path in modules_paths:
if os.path.exists(path):
sys.path.insert(1, path)
print(f"added {path}")
......@@ -5,16 +5,14 @@ ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update
RUN pip install flask
RUN pip install connexion[swagger-ui]
RUN pip install pika
RUN pip install deprecated
EXPOSE 5000
WORKDIR /app
COPY src/rest-gateway/app/ /app/
COPY src/modules/ /app/
RUN pip install -r requirements.txt
RUN chmod a+x main.py
CMD ["python", "./main.py"]
\ No newline at end of file
flask
connexion[swagger-ui]
pika
deprecated
# add modules folder to interpreter path
import sys
import os
modules_paths = ['../app/', '../../modules/']
modules_paths = ['../', '../../../modules/']
for path in modules_paths:
if os.path.exists(path):
sys.path.insert(1, path)
......@@ -5,17 +5,14 @@ ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update
RUN pip install flask
RUN pip install connexion[swagger-ui]
RUN pip install pika
RUN pip install pymongo
RUN pip install deprecated
EXPOSE 5000
WORKDIR /app
COPY src/transaction-hub-in/trace-retrieval-microservice/app/ /app/
COPY src/modules/ /app/
RUN pip install -r requirements.txt
RUN chmod a+x main.py
CMD ["python", "./main.py"]
\ No newline at end of file
flask
connexion[swagger-ui]
pika
pymongo
deprecated
# add modules folder to interpreter path
import sys
import os
modules_paths = ['../app/', '../../../modules/']
modules_paths = ['../', '../../../../modules/']
for path in modules_paths:
if os.path.exists(path):
sys.path.insert(1, path)
print(f"added {path}")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment