Skip to content

Commit 678ef62

Browse files
committed
fix: few test simplifications
1 parent 61a98c7 commit 678ef62

File tree

6 files changed

+49
-70
lines changed

6 files changed

+49
-70
lines changed

src/DIRAC/Core/scripts/dirac_install_db.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ def main():
2626
for db in args:
2727
result = gComponentInstaller.installDatabase(db)
2828
if not result["OK"]:
29-
gLogger.error(f"ERROR: failed to correctly install {db}", result["Message"])
29+
gLogger.error(f"Failed to correctly install {db}:", result["Message"])
3030
DIRACExit(1)
3131
extension, system = result["Value"]
3232
result = gComponentInstaller.addDatabaseOptionsToCS(gConfig, system, db, overwrite=True)
3333
if not result["OK"]:
34-
gLogger.error(f"ERROR: failed to add database options to CS: {result['Message']}")
34+
gLogger.error("Failed to add database options to CS:", result["Message"])
3535
DIRACExit(1)
3636

3737
if db != "InstalledComponentsDB":
@@ -46,7 +46,7 @@ def main():
4646

4747
result = MonitoringUtilities.monitorInstallation("DB", system, db, user=user)
4848
if not result["OK"]:
49-
gLogger.error(f"ERROR: failed to register installation in database: {result['Message']}")
49+
gLogger.error("Failed to register installation in database:", result["Message"])
5050
DIRACExit(1)
5151

5252

src/DIRAC/tests/Utilities/testJobDefinitions.py

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def helloWorld():
5959
try:
6060
J.setInputSandbox([find_all("exe-script.py", ".", "DIRAC/tests/Workflow")[0]])
6161
except IndexError: # we are in Jenkins
62-
J.setInputSandbox([find_all("exe-script.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]])
62+
J.setInputSandbox([find_all("exe-script.py", "/home/dirac", "DIRAC/tests/Workflow")[0]])
6363
J.setExecutable("exe-script.py", "", "helloWorld.log")
6464
return endOfAllJobs(J)
6565

@@ -74,7 +74,7 @@ def helloWorldJenkins():
7474
try:
7575
J.setInputSandbox([find_all("exe-script.py", ".", "DIRAC/tests/Workflow")[0]])
7676
except IndexError: # we are in Jenkins
77-
J.setInputSandbox([find_all("exe-script.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]])
77+
J.setInputSandbox([find_all("exe-script.py", "/home/dirac", "DIRAC/tests/Workflow")[0]])
7878
J.setExecutable("exe-script.py", "", "helloWorld.log")
7979
J.setDestination("DIRAC.Jenkins.ch")
8080
return endOfAllJobs(J)
@@ -90,9 +90,7 @@ def helloWorld_input():
9090
try:
9191
J.setInputSandbox([find_all("exe-script-with-input.py", ".", "DIRAC/tests/Workflow")[0]])
9292
except IndexError: # we are in Jenkins
93-
J.setInputSandbox(
94-
[find_all("exe-script-with-input.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]]
95-
)
93+
J.setInputSandbox([find_all("exe-script-with-input.py", "/home/dirac", "DIRAC/tests/Workflow")[0]])
9694
J.setExecutable("exe-script-with-input.py", "", "helloWorld.log")
9795
return endOfAllJobs(J)
9896

@@ -108,11 +106,7 @@ def helloWorld_input_single():
108106
J.setInputSandbox([find_all("exe-script-with-input-single-location.py", ".", "DIRAC/tests/Workflow")[0]])
109107
except IndexError: # we are in Jenkins
110108
J.setInputSandbox(
111-
[
112-
find_all(
113-
"exe-script-with-input-single-location.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow"
114-
)[0]
115-
]
109+
[find_all("exe-script-with-input-single-location.py", "/home/dirac", "DIRAC/tests/Workflow")[0]]
116110
)
117111
J.setExecutable("exe-script-with-input-single-location.py", "", "helloWorld.log")
118112
return endOfAllJobs(J)
@@ -128,7 +122,7 @@ def helloWorldCERN():
128122
try:
129123
J.setInputSandbox([find_all("exe-script.py", ".", "DIRAC/tests/Workflow")[0]])
130124
except IndexError: # we are in Jenkins
131-
J.setInputSandbox([find_all("exe-script.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]])
125+
J.setInputSandbox([find_all("exe-script.py", "/home/dirac", "DIRAC/tests/Workflow")[0]])
132126
J.setExecutable("exe-script.py", "", "helloWorld.log")
133127
J.setDestination("LCG.CERN.cern")
134128
return endOfAllJobs(J)
@@ -144,7 +138,7 @@ def helloWorldNCBJ():
144138
try:
145139
J.setInputSandbox([find_all("exe-script.py", ".", "DIRAC/tests/Workflow")[0]])
146140
except IndexError: # we are in Jenkins
147-
J.setInputSandbox([find_all("exe-script.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]])
141+
J.setInputSandbox([find_all("exe-script.py", "/home/dirac", "DIRAC/tests/Workflow")[0]])
148142
J.setExecutable("exe-script.py", "", "helloWorld.log")
149143
J.setDestination("LCG.NCBJ.pl")
150144
return endOfAllJobs(J)
@@ -160,7 +154,7 @@ def helloWorldGRIDKA():
160154
try:
161155
J.setInputSandbox([find_all("exe-script.py", ".", "DIRAC/tests/Workflow")[0]])
162156
except IndexError: # we are in Jenkins
163-
J.setInputSandbox([find_all("exe-script.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]])
157+
J.setInputSandbox([find_all("exe-script.py", "/home/dirac", "DIRAC/tests/Workflow")[0]])
164158
J.setExecutable("exe-script.py", "", "helloWorld.log")
165159
J.setDestination("LCG.GRIDKA.de")
166160
return endOfAllJobs(J)
@@ -176,7 +170,7 @@ def helloWorldRAL():
176170
try:
177171
J.setInputSandbox([find_all("exe-script.py", ".", "DIRAC/tests/Workflow")[0]])
178172
except IndexError: # we are in Jenkins
179-
J.setInputSandbox([find_all("exe-script.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]])
173+
J.setInputSandbox([find_all("exe-script.py", "/home/dirac", "DIRAC/tests/Workflow")[0]])
180174
J.setExecutable("exe-script.py", "", "helloWorld.log")
181175
J.setDestination("LCG.RAL.uk")
182176
return endOfAllJobs(J)
@@ -192,7 +186,7 @@ def helloWorldPIC():
192186
try:
193187
J.setInputSandbox([find_all("exe-script.py", ".", "DIRAC/tests/Workflow")[0]])
194188
except IndexError: # we are in Jenkins
195-
J.setInputSandbox([find_all("exe-script.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]])
189+
J.setInputSandbox([find_all("exe-script.py", "/home/dirac", "DIRAC/tests/Workflow")[0]])
196190
J.setExecutable("exe-script.py", "", "helloWorld.log")
197191
J.setDestination("LCG.PIC.es")
198192
return endOfAllJobs(J)
@@ -208,7 +202,7 @@ def helloWorldRALPP():
208202
try:
209203
J.setInputSandbox([find_all("exe-script.py", ".", "DIRAC/tests/Workflow")[0]])
210204
except IndexError: # we are in Jenkins
211-
J.setInputSandbox([find_all("exe-script.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]])
205+
J.setInputSandbox([find_all("exe-script.py", "/home/dirac", "DIRAC/tests/Workflow")[0]])
212206
J.setExecutable("exe-script.py", "", "helloWorld.log")
213207
J.setDestination("LCG.UKI-SOUTHGRID-RALPP.uk")
214208
return endOfAllJobs(J)
@@ -224,7 +218,7 @@ def helloWorldGRIF():
224218
try:
225219
J.setInputSandbox([find_all("exe-script.py", ".", "DIRAC/tests/Workflow")[0]])
226220
except IndexError: # we are in Jenkins
227-
J.setInputSandbox([find_all("exe-script.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]])
221+
J.setInputSandbox([find_all("exe-script.py", "/home/dirac", "DIRAC/tests/Workflow")[0]])
228222
J.setExecutable("exe-script.py", "", "helloWorld.log")
229223
J.setDestination("LCG.GRIF.fr")
230224
return endOfAllJobs(J)
@@ -240,7 +234,7 @@ def helloWorldSSHBatch():
240234
try:
241235
J.setInputSandbox([find_all("exe-script.py", ".", "DIRAC/tests/Workflow")[0]])
242236
except IndexError: # we are in Jenkins
243-
J.setInputSandbox([find_all("exe-script.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]])
237+
J.setInputSandbox([find_all("exe-script.py", "/home/dirac", "DIRAC/tests/Workflow")[0]])
244238
J.setExecutable("exe-script.py", "", "helloWorld.log")
245239
J.setDestination("DIRAC.Jenkins_SSHBatch.ch")
246240
return endOfAllJobs(J)
@@ -256,7 +250,7 @@ def helloWorldARM():
256250
try:
257251
J.setInputSandbox([find_all("exe-script.py", ".", "DIRAC/tests/Workflow")[0]])
258252
except IndexError: # we are in Jenkins
259-
J.setInputSandbox([find_all("exe-script.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]])
253+
J.setInputSandbox([find_all("exe-script.py", "/home/dirac", "DIRAC/tests/Workflow")[0]])
260254
J.setExecutable("exe-script.py", "", "helloWorld.log")
261255
J.setDestination("DIRAC.ARM.ch")
262256
return endOfAllJobs(J)
@@ -272,7 +266,7 @@ def helloWorldCloudCE():
272266
try:
273267
J.setInputSandbox([find_all("exe-script.py", ".", "DIRAC/tests/Workflow")[0]])
274268
except IndexError: # we are in Jenkins
275-
J.setInputSandbox([find_all("exe-script.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]])
269+
J.setInputSandbox([find_all("exe-script.py", "/home/dirac", "DIRAC/tests/Workflow")[0]])
276270
J.setExecutable("exe-script.py", "", "helloWorldCloud.log")
277271
J.setDestinationCE("stealthcloud.ic.ac.uk", "LCG.UKI-LT2-IC-HEP.uk")
278272
return endOfAllJobs(J)
@@ -288,7 +282,7 @@ def mpJob():
288282
try:
289283
J.setInputSandbox([find_all("mpTest.py", ".", "DIRAC/tests/Utilities")[0]])
290284
except IndexError: # we are in Jenkins
291-
J.setInputSandbox([find_all("mpTest.py", os.environ["WORKSPACE"], "DIRAC/tests/Utilities")[0]])
285+
J.setInputSandbox([find_all("mpTest.py", "/home/dirac", "DIRAC/tests/Utilities")[0]])
292286

293287
J.setExecutable("mpTest.py")
294288
J.setTag(["4Processors", "MultiProcessor"])
@@ -305,7 +299,7 @@ def mp3Job():
305299
try:
306300
J.setInputSandbox([find_all("mpTest.py", ".", "DIRAC/tests/Utilities")[0]])
307301
except IndexError: # we are in Jenkins
308-
J.setInputSandbox([find_all("mpTest.py", os.environ["WORKSPACE"], "DIRAC/tests/Utilities")[0]])
302+
J.setInputSandbox([find_all("mpTest.py", "/home/dirac", "DIRAC/tests/Utilities")[0]])
309303

310304
J.setExecutable("mpTest.py")
311305
J.setNumberOfProcessors(numberOfProcessors=3)
@@ -322,7 +316,7 @@ def min2max4Job():
322316
try:
323317
J.setInputSandbox([find_all("mpTest.py", ".", "DIRAC/tests/Utilities")[0]])
324318
except IndexError: # we are in Jenkins
325-
J.setInputSandbox([find_all("mpTest.py", os.environ["WORKSPACE"], "DIRAC/tests/Utilities")[0]])
319+
J.setInputSandbox([find_all("mpTest.py", "/home/dirac", "DIRAC/tests/Utilities")[0]])
326320

327321
J.setExecutable("mpTest.py")
328322
J.setNumberOfProcessors(minNumberOfProcessors=2, maxNumberOfProcessors=4)
@@ -339,7 +333,7 @@ def wholeNodeJob():
339333
try:
340334
J.setInputSandbox([find_all("mpTest.py", ".", "DIRAC/tests/Utilities")[0]])
341335
except IndexError: # we are in Jenkins
342-
J.setInputSandbox([find_all("mpTest.py", os.environ["WORKSPACE"], "DIRAC/tests/Utilities")[0]])
336+
J.setInputSandbox([find_all("mpTest.py", "/home/dirac", "DIRAC/tests/Utilities")[0]])
343337

344338
J.setExecutable("mpTest.py")
345339
J.setTag(["WholeNode", "MultiProcessor"])
@@ -356,7 +350,7 @@ def parametricJob():
356350
try:
357351
J.setInputSandbox([find_all("exe-script.py", ".", "DIRAC/tests/Workflow")[0]])
358352
except IndexError: # we are in Jenkins
359-
J.setInputSandbox([find_all("exe-script.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]])
353+
J.setInputSandbox([find_all("exe-script.py", "/home/dirac", "DIRAC/tests/Workflow")[0]])
360354
J.setParameterSequence("args", ["one", "two", "three"])
361355
J.setParameterSequence("iargs", [1, 2, 3])
362356
J.setExecutable("exe-script.py", arguments=": testing %(args)s %(iargs)s", logFile="helloWorld_%n.log")
@@ -373,7 +367,7 @@ def parametricJobInputData():
373367
try:
374368
J.setInputSandbox([find_all("exe-script.py", ".", "DIRAC/tests/Workflow")[0]])
375369
except IndexError: # we are in Jenkins
376-
J.setInputSandbox([find_all("exe-script.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]])
370+
J.setInputSandbox([find_all("exe-script.py", "/home/dirac", "DIRAC/tests/Workflow")[0]])
377371
J.setParameterSequence("args", ["one", "two", "three"])
378372
J.setParameterSequence("iargs", [1, 2, 3])
379373
J.setParameterSequence(
@@ -404,7 +398,7 @@ def jobWithOutput():
404398
try:
405399
inp2 = [find_all("exe-script.py", ".", "DIRAC/tests/Workflow")[0]]
406400
except IndexError: # we are in Jenkins
407-
inp2 = [find_all("exe-script.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]]
401+
inp2 = [find_all("exe-script.py", "/home/dirac", "DIRAC/tests/Workflow")[0]]
408402
J.setInputSandbox(inp1 + inp2)
409403
J.setExecutable("exe-script.py", "", "helloWorld.log")
410404
J.setOutputData([timenow + "testFileUpload.txt"])
@@ -434,7 +428,7 @@ def jobWithOutputs():
434428
try:
435429
inp2 = [find_all("exe-script.py", ".", "DIRAC/tests/Workflow")[0]]
436430
except IndexError: # we are in Jenkins
437-
inp2 = [find_all("exe-script.py", os.environ["WORKSPACE"], "DIRAC/tests/Workflow")[0]]
431+
inp2 = [find_all("exe-script.py", "/home/dirac", "DIRAC/tests/Workflow")[0]]
438432
J.setInputSandbox(inp1 + inp2)
439433
J.setExecutable("exe-script.py", "", "helloWorld.log")
440434
J.setOutputData([timenow + "testFileUpload.txt"], outputSE=["RAL-SE", "IN2P3-SE"])

tests/CI/run_tests.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ echo -e "*** $(date -u) **** Starting integration tests on ${INSTALLTYPE} ****\n
2525

2626
if [[ "$INSTALLTYPE" == "server" ]]; then
2727
# shellcheck source=/dev/null
28-
source "$WORKSPACE/ServerInstallDIR/bashrc"
28+
source /home/dirac/ServerInstallDIR/bashrc
2929
# If not unset, assert will not trigger
3030
unset PYTHONOPTIMIZE
3131
# shellcheck disable=SC2034
@@ -34,14 +34,14 @@ if [[ "$INSTALLTYPE" == "server" ]]; then
3434
ERR=0
3535
for repo_path in "${TESTREPO[@]}"; do
3636
# TODO: The tests should be refactored to remove the need for this
37-
cp -r "${repo_path}/tests" "$WORKSPACE/ServerInstallDIR/$(basename "${repo_path}")"
37+
cp -r "${repo_path}/tests" "/home/dirac/ServerInstallDIR/$(basename "${repo_path}")"
3838
done
3939
for repo_path in "${TESTREPO[@]}"; do
4040
source "${repo_path}/tests/Integration/all_integration_server_tests.sh"
4141
done
4242
elif [[ "$INSTALLTYPE" == "client" ]]; then
4343
# shellcheck source=/dev/null
44-
source "$WORKSPACE/ClientInstallDIR/bashrc"
44+
source /home/dirac/ClientInstallDIR/bashrc
4545
# If not unset, assert will not trigger
4646
unset PYTHONOPTIMIZE
4747
set -o pipefail
@@ -52,7 +52,7 @@ elif [[ "$INSTALLTYPE" == "client" ]]; then
5252

5353
elif [[ "$INSTALLTYPE" == "pilot" ]]; then
5454
# shellcheck source=/dev/null
55-
source "$WORKSPACE/bashrc"
55+
source /home/dirac/bashrc
5656
# If not unset, assert will not trigger
5757
unset PYTHONOPTIMIZE
5858
set -o pipefail

tests/Jenkins/dirac_ci.sh

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#
1919
# === optional environment variables:
2020
#
21-
# WORKSPACE (/home/dirac)
2221
# DEBUG (set it to whatever value to turn on debug messages)
2322
#
2423
# DIRAC_RELEASE (for installing a specific release)
@@ -52,18 +51,12 @@ else
5251
DEBUG='-dd'
5352
fi
5453

55-
if [[ "$WORKSPACE" ]]; then
56-
echo "==> We are in Jenkins I guess"
57-
else
58-
WORKSPACE=$PWD
59-
fi
60-
6154
# Creating default structure
62-
mkdir -p "$WORKSPACE/TestCode" # Where the test code resides
55+
mkdir -p /home/dirac/TestCode # Where the test code resides
6356
TESTCODE=${_}
64-
mkdir -p "$WORKSPACE/ServerInstallDIR" # Where servers are installed
57+
mkdir -p /home/dirac/ServerInstallDIR # Where servers are installed
6558
SERVERINSTALLDIR=${_}
66-
mkdir -p "$WORKSPACE/ClientInstallDIR" # Where clients are installed
59+
mkdir -p /home/dirac/ClientInstallDIR # Where clients are installed
6760
CLIENTINSTALLDIR=${_}
6861

6962
# Location of the CFG file to be used (this can be replaced by the extensions)

0 commit comments

Comments
 (0)