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 39592da
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 25 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
19 changes: 11 additions & 8 deletions tests/Workflow/Regression/Test_RegressionUserJobs.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
""" This module will run some job descriptions defined with an older version of DIRAC
"""
# pylint: disable=protected-access, wrong-import-position, missing-docstring
import unittest
import os
import sys
import shutil
import sys
import unittest

import DIRAC

DIRAC.initialize(extra_config_files=["pilot.cfg"]) # Initialize configuration

from DIRAC import gLogger, rootPath

from DIRAC.tests.Utilities.utils import find_all

from DIRAC.tests.Utilities.IntegrationTest import IntegrationTest

from DIRAC.Interfaces.API.Job import Job
from DIRAC.Interfaces.API.Dirac import Dirac
from DIRAC.Interfaces.API.Job import Job
from DIRAC.tests.Utilities.IntegrationTest import IntegrationTest
from DIRAC.tests.Utilities.utils import find_all


class RegressionTestCase(IntegrationTest):
Expand All @@ -33,6 +30,8 @@ def setUp(self):
exeScriptLoc = find_all("exe-script.py", rootPath, "/DIRAC/tests/Workflow")[0]
helloWorldLoc = find_all("helloWorld.py", rootPath, "/DIRAC/tests/Workflow")[0]
except IndexError: # we are in Jenkins
if "GITHUB_WORKSPACE" in os.environ:
os.environ["WORKSPACE"] = os.environ["GITHUB_WORKSPACE"]
exeScriptLoc = find_all("exe-script.py", os.environ["WORKSPACE"], "/DIRAC/tests/Workflow")[0]
helloWorldLoc = find_all("helloWorld.py", os.environ["WORKSPACE"], "/DIRAC/tests/Workflow")[0]

Expand All @@ -42,6 +41,8 @@ def setUp(self):
try:
helloWorldXMLLocation = find_all("helloWorld.xml", rootPath, "/DIRAC/tests/Workflow/Regression")[0]
except IndexError: # we are in Jenkins
if "GITHUB_WORKSPACE" in os.environ:
os.environ["WORKSPACE"] = os.environ["GITHUB_WORKSPACE"]
helloWorldXMLLocation = find_all(
"helloWorld.xml", os.environ["WORKSPACE"], "/DIRAC/tests/Workflow/Regression"
)[0]
Expand All @@ -52,6 +53,8 @@ def setUp(self):
try:
helloWorldXMLFewMoreLocation = find_all("helloWorld.xml", rootPath, "/DIRAC/tests/Workflow/Regression")[0]
except IndexError: # we are in Jenkins
if "GITHUB_WORKSPACE" in os.environ:
os.environ["WORKSPACE"] = os.environ["GITHUB_WORKSPACE"]
helloWorldXMLFewMoreLocation = find_all(
"helloWorld.xml", os.environ["WORKSPACE"], "/DIRAC/tests/Workflow/Regression"
)[0]
Expand Down

0 comments on commit 39592da

Please sign in to comment.