Skip to content

Commit

Permalink
test: adding support for GA
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed Mar 22, 2024
1 parent 8955aac commit 7d6ffe4
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions tests/Workflow/Integration/Test_UserJobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def setUp(self):
self.helloWorld = find_all("helloWorld.py", rootPath, integration_test_dir)[0]
self.mpExe = find_all("mpTest.py", rootPath, "/DIRAC/tests/Utilities")[0]
self.mpExeFlex = find_all("mpTest-flexible.py", rootPath, "/DIRAC/tests/Utilities")[0]
except IndexError: # we are in Jenkins
except IndexError:
if "GITHUB_WORKSPACE" in os.environ:
os.environ["WORKSPACE"] = os.environ["GITHUB_WORKSPACE"]
self.exeScriptLocation = find_all("exe-script.py", os.environ["WORKSPACE"], integration_test_dir)[0]
self.helloWorld = find_all("helloWorld.py", os.environ["WORKSPACE"], integration_test_dir)[0]
self.mpExe = find_all("mpTest.py", os.environ["WORKSPACE"], "/DIRAC/tests/Utilities")[0]
Expand All @@ -51,8 +53,9 @@ def test_execute(self):
j.setExecutable(self.exeScriptLocation)
j.setLogLevel("DEBUG")
try:
# This is the standard location in Jenkins
j.setInputSandbox(find_all("pilot.cfg", os.environ["WORKSPACE"] + "/PilotInstallDIR")[0])
if "GITHUB_WORKSPACE" in os.environ:
os.environ["WORKSPACE"] = os.environ["GITHUB_WORKSPACE"]
j.setInputSandbox(find_all("pilot.cfg", os.environ["WORKSPACE"])[0])
except (IndexError, KeyError):
j.setInputSandbox(find_all("pilot.cfg", rootPath)[0])
j.setConfigArgs("pilot.cfg")
Expand Down Expand Up @@ -90,8 +93,9 @@ def test_execute(self):
job.setCPUTime(12345)
job.setLogLevel("DEBUG")
try:
# This is the standard location in Jenkins
job.setInputSandbox(find_all("pilot.cfg", os.environ["WORKSPACE"] + "/PilotInstallDIR")[0])
if "GITHUB_WORKSPACE" in os.environ:
os.environ["WORKSPACE"] = os.environ["GITHUB_WORKSPACE"]
job.setInputSandbox(find_all("pilot.cfg", os.environ["WORKSPACE"])[0])
except (IndexError, KeyError):
job.setInputSandbox(find_all("pilot.cfg", rootPath)[0])
job.setConfigArgs("pilot.cfg")
Expand Down Expand Up @@ -125,8 +129,9 @@ def test_execute_success(self):
job.setCPUTime(12345)
job.setLogLevel("DEBUG")
try:
# This is the standard location in Jenkins
job.setInputSandbox(find_all("pilot.cfg", os.environ["WORKSPACE"] + "/PilotInstallDIR")[0])
if "GITHUB_WORKSPACE" in os.environ:
os.environ["WORKSPACE"] = os.environ["GITHUB_WORKSPACE"]
job.setInputSandbox(find_all("pilot.cfg", os.environ["WORKSPACE"])[0])
except (IndexError, KeyError):
job.setInputSandbox(find_all("pilot.cfg", rootPath)[0])
job.setConfigArgs("pilot.cfg")
Expand All @@ -145,8 +150,9 @@ def test_execute(self):
job.setExecutable("/bin/ls", "-l")
job.setLogLevel("DEBUG")
try:
# This is the standard location in Jenkins
job.setInputSandbox(find_all("pilot.cfg", os.environ["WORKSPACE"] + "/PilotInstallDIR")[0])
if "GITHUB_WORKSPACE" in os.environ:
os.environ["WORKSPACE"] = os.environ["GITHUB_WORKSPACE"]
job.setInputSandbox(find_all("pilot.cfg", os.environ["WORKSPACE"])[0])
except (IndexError, KeyError):
job.setInputSandbox(find_all("pilot.cfg", rootPath)[0])
job.setConfigArgs("pilot.cfg")
Expand All @@ -166,8 +172,9 @@ def test_fixed(self):
j.setNumberOfProcessors(4) # This requires a fixed number of processors
j.setLogLevel("DEBUG")
try:
# This is the standard location in Jenkins
j.setInputSandbox(find_all("pilot.cfg", os.environ["WORKSPACE"] + "/PilotInstallDIR")[0])
if "GITHUB_WORKSPACE" in os.environ:
os.environ["WORKSPACE"] = os.environ["GITHUB_WORKSPACE"]
j.setInputSandbox(find_all("pilot.cfg", os.environ["WORKSPACE"])[0])
except (IndexError, KeyError):
j.setInputSandbox(find_all("pilot.cfg", rootPath)[0])
j.setConfigArgs("pilot.cfg")
Expand All @@ -193,8 +200,9 @@ def test_min2(self):
j.setNumberOfProcessors(minNumberOfProcessors=2) # This requires at least 2 processors
j.setLogLevel("DEBUG")
try:
# This is the standard location in Jenkins
j.setInputSandbox(find_all("pilot.cfg", os.environ["WORKSPACE"] + "/PilotInstallDIR")[0])
if "GITHUB_WORKSPACE" in os.environ:
os.environ["WORKSPACE"] = os.environ["GITHUB_WORKSPACE"]
j.setInputSandbox(find_all("pilot.cfg", os.environ["WORKSPACE"])[0])
except (IndexError, KeyError):
j.setInputSandbox(find_all("pilot.cfg", rootPath)[0])
j.setConfigArgs("pilot.cfg")
Expand All @@ -212,8 +220,9 @@ def test_min2max4(self):
j.setNumberOfProcessors(minNumberOfProcessors=2, maxNumberOfProcessors=4) # This requires 2 to 4 processors
j.setLogLevel("DEBUG")
try:
# This is the standard location in Jenkins
j.setInputSandbox(find_all("pilot.cfg", os.environ["WORKSPACE"] + "/PilotInstallDIR")[0])
if "GITHUB_WORKSPACE" in os.environ:
os.environ["WORKSPACE"] = os.environ["GITHUB_WORKSPACE"]
j.setInputSandbox(find_all("pilot.cfg", os.environ["WORKSPACE"])[0])
except (IndexError, KeyError):
j.setInputSandbox(find_all("pilot.cfg", rootPath)[0])
j.setConfigArgs("pilot.cfg")
Expand All @@ -231,8 +240,9 @@ def test_min1(self):
j.setNumberOfProcessors(minNumberOfProcessors=1) # This requires 1 to infinite processors
j.setLogLevel("DEBUG")
try:
# This is the standard location in Jenkins
j.setInputSandbox(find_all("pilot.cfg", os.environ["WORKSPACE"] + "/PilotInstallDIR")[0])
if "GITHUB_WORKSPACE" in os.environ:
os.environ["WORKSPACE"] = os.environ["GITHUB_WORKSPACE"]
j.setInputSandbox(find_all("pilot.cfg", os.environ["WORKSPACE"])[0])
except (IndexError, KeyError):
j.setInputSandbox(find_all("pilot.cfg", rootPath)[0])
j.setConfigArgs("pilot.cfg")
Expand Down

0 comments on commit 7d6ffe4

Please sign in to comment.