Skip to content
Snippets Groups Projects
Commit 64afaa59 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-156: refactored test decorators. used new test method...

TMSS-156: refactored test decorators. used new test method skip_integration_tests for t_ingestjobmanagementserver.py
parent dd7ec31c
No related branches found
No related tags found
1 merge request!116TMSS-156: Resolve TMSS-156
...@@ -44,8 +44,18 @@ def assertEqualXML(test, expected): ...@@ -44,8 +44,18 @@ def assertEqualXML(test, expected):
raise AssertionError(msg) raise AssertionError(msg)
def skip_integration_tests() -> bool:
'''returns a boolen True of the environment var SKIP_INTEGRATION_TESTS has been set to a 'true' value'''
return os.environ.get('SKIP_INTEGRATION_TESTS', default='False').lower() in ['1', 'true', 'on']
def skip_unit_tests() -> bool:
'''returns a boolen True of the environment var SKIP_UNIT_TESTS has been set to a 'true' value'''
return os.environ.get('SKIP_UNIT_TESTS', default='False').lower() in ['1', 'true', 'on']
# decorators for selective tests # decorators for selective tests
integration_test = unittest.skipIf(os.environ.get('SKIP_INTEGRATION_TESTS', default='False').lower() in ['1', 'true'], integration_test = unittest.skipIf(skip_integration_tests(),
'Integration tests are disabled via env SKIP_INTEGRATION_TESTS') 'Integration tests are disabled via env SKIP_INTEGRATION_TESTS')
unit_test = unittest.skipIf(os.environ.get('SKIP_UNIT_TESTS', default='False').lower() in ['1', 'true'],
unit_test = unittest.skipIf(skip_unit_tests(),
'Unit tests are disabled via env SKIP_UNIT_TESTS') 'Unit tests are disabled via env SKIP_UNIT_TESTS')
...@@ -11,6 +11,11 @@ import fnmatch ...@@ -11,6 +11,11 @@ import fnmatch
import time import time
import logging import logging
from lofar.common.test_utils import skip_integration_tests
if skip_integration_tests():
exit(3)
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO) logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -102,6 +107,8 @@ with TemporaryExchange(testname+"_bus") as tmp_bus: ...@@ -102,6 +107,8 @@ with TemporaryExchange(testname+"_bus") as tmp_bus:
manager_thread.daemon = True manager_thread.daemon = True
manager_thread.start() manager_thread.start()
time.sleep(1.0) #TODO: should not wait fixed amount of time for IngestJobManager to be up and running, but poll with a timeout
assert manager.nrOfUnfinishedJobs() == 3, 'expected 3 jobs unfinished before any job was started' assert manager.nrOfUnfinishedJobs() == 3, 'expected 3 jobs unfinished before any job was started'
assert manager.nrOfJobs() == 3, 'expected 3 jobs in total before any job was started' assert manager.nrOfJobs() == 3, 'expected 3 jobs in total before any job was started'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment