Skip to content

Commit c35948e

Browse files
committed
feat: add a getQueue test
1 parent 970cb7a commit c35948e

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

src/DIRAC/ConfigurationSystem/Client/Helpers/test/Test_Helpers.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
from itertools import zip_longest
2+
from diraccfg import CFG
23

34
import pytest
45
from unittest.mock import MagicMock
56

7+
from DIRAC import gConfig
8+
from DIRAC.ConfigurationSystem.Client import ConfigurationData
69
from DIRAC.ConfigurationSystem.Client.Helpers.Resources import (
710
getDIRACPlatform,
811
getCompatiblePlatforms,
912
_platformSortKey,
13+
getQueue,
1014
)
1115

1216

@@ -122,3 +126,79 @@ def test_getCompatiblePlatforms(mocker, mockGCReplyInput, requested, expectedRes
122126
assert res["OK"] is expectedRes, res
123127
if expectedRes:
124128
assert set(res["Value"]) == set(expectedValue), res["Value"]
129+
130+
131+
config = """
132+
Resources
133+
{
134+
Sites
135+
{
136+
LHCb
137+
{
138+
LHCb.CERN.cern
139+
{
140+
CEs
141+
{
142+
ce1.cern.ch
143+
{
144+
CEType = AREX
145+
architecture = x86_64
146+
OS = linux_CentOS_7.9.2009
147+
Tag = Token
148+
Queues
149+
{
150+
nordugrid-SLURM-grid
151+
{
152+
SI00 = 2775
153+
MaxRAM = 128534
154+
CPUTime = 3836159
155+
maxCPUTime = 5760
156+
Tag = MultiProcessor
157+
MaxWaitingJobs = 10
158+
MaxTotalJobs = 200
159+
LocalCEType = Pool/Singularity
160+
OS = linux_AlmaLinux_9.4.2104
161+
}
162+
}
163+
}
164+
}
165+
}
166+
}
167+
}
168+
}
169+
"""
170+
171+
172+
def test_getQueue():
173+
"""Test getQueue function."""
174+
175+
# Set up the configuration file
176+
ConfigurationData.localCFG = CFG()
177+
cfg = CFG()
178+
cfg.loadFromBuffer(config)
179+
gConfig.loadCFG(cfg)
180+
181+
# Test getQueue
182+
site = "LHCb.CERN.cern"
183+
ce = "ce1.cern.ch"
184+
queue = "nordugrid-SLURM-grid"
185+
186+
result = getQueue(site, ce, queue)
187+
assert result["OK"]
188+
189+
expectedDict = {
190+
"CEType": "AREX",
191+
"Queue": "nordugrid-SLURM-grid",
192+
"architecture": "x86_64",
193+
"SI00": "2775",
194+
"MaxRAM": "128534",
195+
"CPUTime": "3836159",
196+
"maxCPUTime": "5760",
197+
"Tag": ["MultiProcessor", "Token"],
198+
"MaxWaitingJobs": "10",
199+
"MaxTotalJobs": "200",
200+
"LocalCEType": "Pool/Singularity",
201+
"OS": "linux_AlmaLinux_9.4.2104",
202+
}
203+
204+
assert result["Value"] == expectedDict

0 commit comments

Comments
 (0)