forked from DIRACGrid/DIRAC
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DIRACGrid#7087 from aldbr/rel-v8r0_FIX_ComputingEl…
…ementinitalizeParameters [v8.0] fix: ComputingElement.initializeParameters() concatenate tags instead of overriding them
- Loading branch information
Showing
3 changed files
with
142 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/DIRAC/Resources/Computing/test/Test_ComputingElement.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
from diraccfg import CFG | ||
import pytest | ||
|
||
from DIRAC import gConfig | ||
from DIRAC.ConfigurationSystem.Client.ConfigurationData import gConfigurationData | ||
from DIRAC.Resources.Computing.ComputingElement import ComputingElement | ||
|
||
|
||
pilotCfg1 = """ | ||
LocalSite | ||
{ | ||
Tag = Token | ||
CPUTime = 500 | ||
Test | ||
{ | ||
MaxTotalJobs = 20 | ||
Tag = WholeNode | ||
} | ||
} | ||
Resources | ||
{ | ||
Computing | ||
{ | ||
CEDefaults | ||
{ | ||
CPUTime = 50 | ||
Tag = Token | ||
Tag += /cvmfs/dirac/ | ||
} | ||
ComputingElement | ||
{ | ||
CPUTime = 5000 | ||
Tag = Test | ||
Tag += Token | ||
} | ||
} | ||
} | ||
""" | ||
|
||
|
||
pilotCfg2 = """ | ||
LocalSite | ||
{ | ||
Tag = | ||
} | ||
""" | ||
|
||
|
||
def setupConfig(config): | ||
"""Set up the configuration file | ||
:param str config: configuration content to load | ||
""" | ||
gConfigurationData.localCFG = CFG() | ||
cfg = CFG() | ||
cfg.loadFromBuffer(config) | ||
gConfig.loadCFG(cfg) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"config, expectedValue", | ||
[ | ||
( | ||
pilotCfg1, | ||
{ | ||
"Tag": {"/cvmfs/dirac/", "Token", "WholeNode"}, | ||
"CPUTime": 500, | ||
"MaxTotalJobs": 20, | ||
"WaitingToRunningRatio": 0.5, | ||
"MaxWaitingJobs": 1, | ||
}, | ||
), | ||
(pilotCfg2, {"MaxTotalJobs": 1, "WaitingToRunningRatio": 0.5, "MaxWaitingJobs": 1}), | ||
], | ||
) | ||
def test_initializeParameters(config, expectedValue): | ||
"""Test the initialization of the CE parameters""" | ||
setupConfig(config) | ||
|
||
ce = ComputingElement("Test") | ||
ce.initializeParameters() | ||
assert ce.ceParameters == expectedValue |