mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
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:
parent
29ca3f8556
commit
76de4e4bbb
8 changed files with 30 additions and 8 deletions
|
|
@ -153,7 +153,8 @@ def get_openpype_global_settings(url: str) -> dict:
|
|||
# Create mongo connection
|
||||
client = MongoClient(url, **kwargs)
|
||||
# Access settings collection
|
||||
col = client["openpype"]["settings"]
|
||||
openpype_db = os.environ.get("OPENPYPE_DATABASE_NAME") or "openpype"
|
||||
col = client[openpype_db]["settings"]
|
||||
# Query global settings
|
||||
global_settings = col.find_one({"type": "global_settings"}) or {}
|
||||
# Close Mongo connection
|
||||
|
|
|
|||
|
|
@ -83,7 +83,8 @@ class AfterEffectsSubmitDeadline(
|
|||
"AVALON_APP_NAME",
|
||||
"OPENPYPE_DEV",
|
||||
"OPENPYPE_LOG_NO_COLORS",
|
||||
"OPENPYPE_VERSION"
|
||||
"OPENPYPE_VERSION",
|
||||
"IS_TEST"
|
||||
]
|
||||
# Add mongo url if it's enabled
|
||||
if self._instance.context.data.get("deadlinePassMongoUrl"):
|
||||
|
|
|
|||
|
|
@ -275,7 +275,8 @@ class HarmonySubmitDeadline(
|
|||
"AVALON_APP_NAME",
|
||||
"OPENPYPE_DEV",
|
||||
"OPENPYPE_LOG_NO_COLORS",
|
||||
"OPENPYPE_VERSION"
|
||||
"OPENPYPE_VERSION",
|
||||
"IS_TEST"
|
||||
]
|
||||
# Add mongo url if it's enabled
|
||||
if self._instance.context.data.get("deadlinePassMongoUrl"):
|
||||
|
|
|
|||
|
|
@ -158,7 +158,8 @@ class MayaSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline):
|
|||
"AVALON_TASK",
|
||||
"AVALON_APP_NAME",
|
||||
"OPENPYPE_DEV",
|
||||
"OPENPYPE_VERSION"
|
||||
"OPENPYPE_VERSION",
|
||||
"IS_TEST"
|
||||
]
|
||||
# Add mongo url if it's enabled
|
||||
if self._instance.context.data.get("deadlinePassMongoUrl"):
|
||||
|
|
|
|||
|
|
@ -142,7 +142,9 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
|||
"OPENPYPE_RENDER_JOB",
|
||||
"OPENPYPE_PUBLISH_JOB",
|
||||
"OPENPYPE_MONGO",
|
||||
"OPENPYPE_VERSION"
|
||||
"OPENPYPE_VERSION",
|
||||
|
||||
"IS_TEST"
|
||||
]
|
||||
|
||||
# custom deadline attributes
|
||||
|
|
@ -247,6 +249,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
|||
environment["OPENPYPE_USERNAME"] = instance.context.data["user"]
|
||||
environment["OPENPYPE_PUBLISH_JOB"] = "1"
|
||||
environment["OPENPYPE_RENDER_JOB"] = "0"
|
||||
environment["IS_TEST"] = os.environ.get("IS_TEST")
|
||||
# Add mongo url if it's enabled
|
||||
if instance.context.data.get("deadlinePassMongoUrl"):
|
||||
mongo_url = os.environ.get("OPENPYPE_MONGO")
|
||||
|
|
|
|||
|
|
@ -176,6 +176,9 @@ def inject_openpype_environment(deadlinePlugin):
|
|||
add_args['app'] = job.GetJobEnvironmentKeyValue('AVALON_APP_NAME')
|
||||
add_args["envgroup"] = "farm"
|
||||
|
||||
if job.GetJobEnvironmentKeyValue('IS_TEST'):
|
||||
add_args["automatic_tests"] = "true"
|
||||
|
||||
if all(add_args.values()):
|
||||
for key, value in add_args.items():
|
||||
args.append("--{}".format(key))
|
||||
|
|
|
|||
16
start.py
16
start.py
|
|
@ -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 ...")
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class TestDeadlinePublishInMaya(MayaDeadlinePublishTestClass):
|
|||
{OPENPYPE_ROOT}/.venv/Scripts/python.exe {OPENPYPE_ROOT}/start.py runtests ../tests/integration/hosts/maya # noqa: E501
|
||||
|
||||
"""
|
||||
PERSIST = False
|
||||
PERSIST = True
|
||||
|
||||
TEST_FILES = [
|
||||
("1dDY7CbdFXfRksGVoiuwjhnPoTRCCf5ea",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue