Skip to content

Commit b17cd7a

Browse files
committed
test: Added tests for pilot history monitoring
1 parent e487029 commit b17cd7a

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/DIRAC/WorkloadManagementSystem/Agent/PilotsHistoryAgent.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ def execute(self):
3737
for record in values:
3838
record = record[1:]
3939
rD = {}
40+
for iP in range(len(self.__summaryKeyFieldsMapping)):
41+
rD[self.__summaryKeyFieldsMapping[iP]] = record[iP]
4042
record = record[len(self.__summaryKeyFieldsMapping) :]
4143
for iP in range(len(self.__summaryValueFieldsMapping)):
4244
rD[self.__summaryValueFieldsMapping[iP]] = int(record[iP])

tests/Integration/Monitoring/Test_MonitoringReporter.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
wmsMonitoringReporter = MonitoringReporter(monitoringType="WMSHistory")
6464
componentMonitoringReporter = MonitoringReporter(monitoringType="ComponentMonitoring")
6565
pilotMonitoringReporter = MonitoringReporter(monitoringType="PilotSubmissionMonitoring")
66-
66+
pilotsHistoryReporter = MonitoringReporter(monitoringType="PilotsHistory")
6767
data = [
6868
{
6969
"Status": "Waiting",
@@ -852,6 +852,25 @@
852852
},
853853
]
854854

855+
pilotsHistoryData = [
856+
{
857+
"TaskQueueID": "1240451",
858+
"GridSite": "LCG.CNAF.it",
859+
"GridType": "",
860+
"Status": "failed",
861+
"Pilots": "7",
862+
"timestamp": 1649161714,
863+
},
864+
{
865+
"TaskQueueID": "12401",
866+
"GridSite": "LCG.CNAF.it",
867+
"GridType": "",
868+
"Status": "failed",
869+
"Pilots": "7",
870+
"timestamp": 1649161714,
871+
},
872+
]
873+
855874

856875
def test_addWMSRecords():
857876
for record in data:
@@ -875,3 +894,11 @@ def test_addPilotSubmissionRecords():
875894
result = pilotMonitoringReporter.commit()
876895
assert result["OK"]
877896
assert result["Value"] == len(pilotMonitoringData)
897+
898+
899+
def test_addPilotHistoryRecords():
900+
for record in pilotsHistoryData:
901+
pilotsHistoryReporter.addRecord(record)
902+
result = pilotsHistoryReporter.commit()
903+
assert result["OK"]
904+
assert result["Value"] == len(pilotsHistoryData)

0 commit comments

Comments
 (0)