Commit b0a65a07 authored by Alexander Lercher's avatar Alexander Lercher

Merge branch 'develop' into feature/business-logic-interface

parents 82e8dd19 9ca7503c
...@@ -3,6 +3,14 @@ import sys ...@@ -3,6 +3,14 @@ import sys
import importlib.util import importlib.util
import pathlib import pathlib
'''
This script searches for all 'tests/' directories and executes all tests
by cd'ing into the dir and executing unittest discover.
It additionally installs all dependencies from a '../requirements.txt' via pip.
Use command line argument '-w' to run on windows.
'''
PY = 'py' if (len(sys.argv) > 1 and sys.argv[1] == '-w') else 'python3.7' # use -w to run on windows
ROOT = pathlib.Path(__file__).parent.parent.absolute() ROOT = pathlib.Path(__file__).parent.parent.absolute()
TESTS_FOLDER_NAME = os.path.normpath("/tests") TESTS_FOLDER_NAME = os.path.normpath("/tests")
...@@ -14,14 +22,15 @@ for (dirname, dirs, files) in os.walk(ROOT): ...@@ -14,14 +22,15 @@ for (dirname, dirs, files) in os.walk(ROOT):
#I assume all the tests are placed in a folder named "tests" #I assume all the tests are placed in a folder named "tests"
if (TESTS_FOLDER_NAME in str(dirname)) \ if (TESTS_FOLDER_NAME in str(dirname)) \
and 'src' in str(dirname) \
and not(f"{TESTS_FOLDER_NAME}{os.path.normpath('/')}" in str(dirname)) \ and not(f"{TESTS_FOLDER_NAME}{os.path.normpath('/')}" in str(dirname)) \
and not("venv" in str(dirname)): and not("venv" in str(dirname)):
try: try:
print(f"Executing tests in {dirname}") print(f"Executing tests in {dirname}")
os.chdir(os.path.normpath(dirname)) os.chdir(os.path.normpath(dirname))
# TODO do this during docker image setup # 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(f"{PY} -m pip install -r ../requirements.txt") # install pip dependencies
exit_val = os.system("python3.7 -m unittest discover") # execute the tests exit_val = os.system(f"{PY} -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 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: except Exception as e:
print(e) print(e)
......
import unittest import unittest
import sys import sys
for path in ['../', './', '../../../modules/']: for path in ['../', './', '../../../modules/', '../../../../modules']:
sys.path.insert(1, path) sys.path.insert(1, path)
from db.entities.connected_node import NodeC from db.entities.connected_node import NodeC
......
# Rabbit MQ '''Contains all networking constants for microservices to communicate to each other.'''
RABBIT_MQ_HOSTNAME = 'rabbit-mq'
RABBIT_MQ_PORT = 5672 # set to false to run locally
# RABBIT_MQ_HOSTNAME = 'articonf1.itec.aau.at' # TODO set by using environment variable
# RABBIT_MQ_PORT = 30302 server = True
# Trace Retrieval #region Rabbit MQ
TRACE_RETRIEVAL_HOSTNAME = 'trace-retrieval' if server:
TRACE_RETRIEVAL_REST_PORT = 80 RABBIT_MQ_HOSTNAME = 'rabbit-mq'
TRACE_RETRIEVAL_DB_HOSTNAME = f'{TRACE_RETRIEVAL_HOSTNAME}-db' RABBIT_MQ_PORT = 5672
TRACE_RETRIEVAL_DB_PORT = 27017 else:
RABBIT_MQ_HOSTNAME = 'articonf1.itec.aau.at'
# Semantic Linking RABBIT_MQ_PORT = 30302
SEMANTIC_LINKING_HOSTNAME = 'semantic-linking'
SEMANTIC_LINKING_REST_PORT = 80 #endregion Rabbit MQ
SEMANTIC_LINKING_DB_HOSTNAME = f'{SEMANTIC_LINKING_HOSTNAME}-db'
SEMANTIC_LINKING_DB_PORT = 27017 #region Transaction Hub In
## Trace Retrieval
# Role Stage Discovery if server:
ROLESTAGE_DISCOVERY_HOSTNAME = 'role-stage-discovery' TRACE_RETRIEVAL_HOSTNAME = 'trace-retrieval'
ROLESTAGE_DISCOVERY_REST_PORT = 80 TRACE_RETRIEVAL_REST_PORT = 80
ROLESTAGE_DISCOVERY_DB_HOSTNAME = f'{ROLESTAGE_DISCOVERY_HOSTNAME}-db' TRACE_RETRIEVAL_DB_HOSTNAME = f'{TRACE_RETRIEVAL_HOSTNAME}-db'
ROLESTAGE_DISCOVERY_DB_PORT = 27017 TRACE_RETRIEVAL_DB_PORT = 27017
else:
# Rest Gateway TRACE_RETRIEVAL_HOSTNAME = 'articonf1.itec.aau.at'
# REST_GATEWAY_HOSTNAME = 'articonf1.itec.aau.at' TRACE_RETRIEVAL_REST_PORT = 30001
# REST_GATEWAY_DB_HOSTNAME = 'articonf1.itec.aau.at' TRACE_RETRIEVAL_DB_HOSTNAME = 'articonf1.itec.aau.at'
REST_GATEWAY_HOSTNAME = 'rest-gateway' TRACE_RETRIEVAL_DB_PORT = 30003
REST_GATEWAY_DB_HOSTNAME = 'rest-gateway-db'
REST_GATEWAY_REST_PORT = 80 #endregion Transaction Hub In
REST_GATEWAY_DB_PORT = 27017
#region Data Hub
# Business Logic ## Semantic Linking
# BUSINESS_LOGIC_HOSTNAME = 'articonf1.itec.aau.at' if server:
# BUSINESS_LOGIC_DB_HOSTNAME = 'articonf1.itec.aau.at' SEMANTIC_LINKING_HOSTNAME = 'semantic-linking'
BUSINESS_LOGIC_HOSTNAME = 'business-logic' SEMANTIC_LINKING_REST_PORT = 80
BUSINESS_LOGIC_DB_HOSTNAME = f'{BUSINESS_LOGIC_HOSTNAME}-db' SEMANTIC_LINKING_DB_HOSTNAME = f'{SEMANTIC_LINKING_HOSTNAME}-db'
# BUSINESS_LOGIC_REST_PORT = 80 SEMANTIC_LINKING_DB_PORT = 27017
# BUSINESS_LOGIC_DB_PORT = 30421 else:
BUSINESS_LOGIC_REST_PORT = 80 SEMANTIC_LINKING_HOSTNAME = 'articonf1.itec.aau.at'
BUSINESS_LOGIC_DB_PORT = 27017 SEMANTIC_LINKING_REST_PORT = 30101
SEMANTIC_LINKING_DB_HOSTNAME = 'articonf1.itec.aau.at'
SEMANTIC_LINKING_DB_PORT = 30102
## Role Stage Discovery
if server:
ROLESTAGE_DISCOVERY_HOSTNAME = 'role-stage-discovery'
ROLESTAGE_DISCOVERY_REST_PORT = 80
ROLESTAGE_DISCOVERY_DB_HOSTNAME = f'{ROLESTAGE_DISCOVERY_HOSTNAME}-db'
ROLESTAGE_DISCOVERY_DB_PORT = 27017
else:
ROLESTAGE_DISCOVERY_HOSTNAME = 'articonf1.itec.aau.at'
ROLESTAGE_DISCOVERY_REST_PORT = 30103
ROLESTAGE_DISCOVERY_DB_HOSTNAME = 'articonf1.itec.aau.at'
ROLESTAGE_DISCOVERY_DB_PORT = 30104
#endregion Data Hub
#region Rest Gateway
if server:
REST_GATEWAY_HOSTNAME = 'rest-gateway'
REST_GATEWAY_REST_PORT = 80
REST_GATEWAY_DB_HOSTNAME = f'{REST_GATEWAY_HOSTNAME}-db'
REST_GATEWAY_DB_PORT = 27017
else:
REST_GATEWAY_HOSTNAME = 'articonf1.itec.aau.at'
REST_GATEWAY_REST_PORT = 30401
REST_GATEWAY_DB_HOSTNAME = 'articonf1.itec.aau.at'
REST_GATEWAY_DB_PORT = 30402
#endregion Rest Gateway
#region Participation Hub
## Business Logic
if server:
BUSINESS_LOGIC_HOSTNAME = 'business-logic'
BUSINESS_LOGIC_DB_HOSTNAME = f'{BUSINESS_LOGIC_HOSTNAME}-db'
BUSINESS_LOGIC_REST_PORT = 80
BUSINESS_LOGIC_DB_PORT = 27017
else:
BUSINESS_LOGIC_HOSTNAME = 'articonf1.itec.aau.at'
BUSINESS_LOGIC_DB_HOSTNAME = 'articonf1.itec.aau.at'
BUSINESS_LOGIC_REST_PORT = 30420
BUSINESS_LOGIC_DB_PORT = 30421
#endregion Participation Hub
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