OP-3426 - added support for automatic tests into GlobalJobPreLoad

Jobs sent to DL must propagate flag IS_TEST to note that job is an automatic tests, it should use different DBs from regular jobs.
This commit is contained in:
Petr Kalis 2022-10-19 13:39:57 +02:00
parent 29ca3f8556
commit 76de4e4bbb
8 changed files with 30 additions and 8 deletions

View file

@ -486,6 +486,7 @@ def _process_arguments() -> tuple:
use_version = None
use_staging = False
commands = []
automatic_tests = False
# OpenPype version specification through arguments
use_version_arg = "--use-version"
@ -570,7 +571,11 @@ def _process_arguments() -> tuple:
sys.argv.pop(idx)
sys.argv.insert(idx, "tray")
return use_version, use_staging, commands
if "--automatic_tests" in sys.argv:
sys.argv.remove("--automatic_tests")
automatic_tests = True
return use_version, use_staging, commands, automatic_tests
def _determine_mongodb() -> str:
@ -997,7 +1002,7 @@ def boot():
# Process arguments
# ------------------------------------------------------------------------
use_version, use_staging, commands = _process_arguments()
use_version, use_staging, commands, automatic_tests = _process_arguments()
if os.getenv("OPENPYPE_VERSION"):
if use_version:
@ -1024,6 +1029,13 @@ def boot():
os.environ["OPENPYPE_DATABASE_NAME"] = \
os.environ.get("OPENPYPE_DATABASE_NAME") or "openpype"
if automatic_tests:
# change source DBs to predefined ones set for automatic testing
os.environ["IS_TEST"] = "1"
os.environ["OPENPYPE_DATABASE_NAME"] += "_tests"
avalon_db = os.environ.get("AVALON_DB") or "avalon"
os.environ["AVALON_DB"] = avalon_db + "_tests"
global_settings = get_openpype_global_settings(openpype_mongo)
_print(">>> run disk mapping command ...")