Skip to content

Commit

Permalink
test: fixed test to correct version
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed Oct 12, 2023
1 parent b2f37ec commit 8816ea1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Pilot/pilotTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,18 +1152,18 @@ def __getSearchPaths(self):
vo = self.__getVO()
paths = [
"/Defaults/Pilot",
"/%s/Pilot" % vo,
"/%s/Pilot" % self.setup,
"/%s/Defaults/Pilot" % vo,
"/%s/%s/Pilot" % (vo, self.setup),
"/%s/Pilot" % vo,
]

return paths

@staticmethod
def getOptionForPaths(paths, inDict):
"""
Get the preferred option from an input dict passed ond a path list. It modifies the inDict.
Get the preferred option from an input dict passed and a path list. It modifies the inDict.
:param list paths: list of paths to walk through to get a preferred option. An option found in
a path which comes later has a preference over options found in earlier paths.
Expand Down
28 changes: 13 additions & 15 deletions Pilot/tests/Test_simplePilotLogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import json
import os
import sys
import string
import random
import string
import sys
import tempfile

try:
Expand Down Expand Up @@ -49,13 +49,19 @@ def test_getOptionForPaths(self):
jsonFile = os.path.join(basedir, "../../tests/CI/pilot_newSchema.json")
vo = "gridpp"
setup = "DIRAC-Certification"
paths = ["/Defaults/Pilot", "/%s/Pilot" % setup, "/%s/Defaults/Pilot" % vo, "/%s/%s/Pilot" % (vo, setup)]
paths = [
"/Defaults/Pilot",
"/%s/Pilot" % setup,
"/%s/Defaults/Pilot" % vo,
"/%s/%s/Pilot" % (vo, setup),
"/%s/Pilot" % vo
]
with open(jsonFile, "r") as fp:
jsonDict = json.load(fp)
res = PilotParams.getOptionForPaths(paths, jsonDict)
self.assertEqual(res["RemoteLogging"], "True")
self.assertEqual(res["UploadSE"], "UKI-LT2-IC-HEP-disk")
del jsonDict[vo][setup]["Pilot"]["RemoteLogging"] # remove a vo-specific settings, a default value is False:
del jsonDict[vo]["Pilot"]["RemoteLogging"] # remove a vo-specific settings, a default value is False:
res = PilotParams.getOptionForPaths(paths, jsonDict)
self.assertEqual(res["RemoteLogging"], "False")

Expand All @@ -80,19 +86,11 @@ def test_pilotOptions(self, argvmock, mockPaths):
"/%s/Pilot" % setup,
"/%s/Defaults/Pilot" % vo,
"/%s/%s/Pilot" % (vo, setup),
"/%s/Pilot" % vo
]
mockPaths.return_value = paths
pp = PilotParams()
lTESTcommands = [
"CheckWorkerNode",
"InstallDIRAC",
"ConfigureBasics",
"CheckCECapabilities",
"CheckWNCapabilities",
"ConfigureSite",
"ConfigureArchitecture",
"ConfigureCPURequirements",
]
lTESTcommands = "CheckWorkerNode, InstallDIRAC, ConfigureBasics, RegisterPilot, CheckCECapabilities, CheckWNCapabilities, ConfigureSite, ConfigureArchitecture, ConfigureCPURequirements"

pp.gridCEType = "TEST"

Expand All @@ -105,7 +103,7 @@ def test_pilotOptions(self, argvmock, mockPaths):
self.assertEqual(res.get("UploadPath"), "/gridpp/pilotlogs/")
self.assertTrue("Commands" in res)
self.assertEqual(res["Commands"].get(pp.gridCEType), lTESTcommands)
self.assertEqual(pp.commands, lTESTcommands)
self.assertEqual(', '.join(pp.commands), lTESTcommands)
self.assertEqual(pp.releaseVersion, "VAR_DIRAC_VERSION")


Expand Down

0 comments on commit 8816ea1

Please sign in to comment.