Skip to content

Commit 59a4559

Browse files
committed
feat (test): Added tests for pilot submission to monitoring
1 parent d218bab commit 59a4559

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

tests/Integration/Monitoring/Test_MonitoringDB.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
""" Test for MonitoringDB
22
"""
33

4-
from __future__ import absolute_import
5-
from __future__ import division
6-
from __future__ import print_function
7-
8-
__RCSID__ = "$Id$"
9-
104
import time
115
import json
126
import pytest

tests/Integration/Monitoring/Test_MonitoringReporter.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@
5454

5555
# pylint: disable=invalid-name,wrong-import-position
5656

57-
from __future__ import absolute_import
58-
from __future__ import division
59-
from __future__ import print_function
6057
import unittest
6158
import sys
6259

@@ -75,6 +72,7 @@ def setUp(self):
7572

7673
self.wmsMonitoringReporter = MonitoringReporter(monitoringType="WMSHistory")
7774
self.componentMonitoringReporter = MonitoringReporter(monitoringType="ComponentMonitoring")
75+
self.pilotMonitoringReporter = MonitoringReporter(monitoringType="PilotMonitoring")
7876

7977
self.data = [
8078
{
@@ -838,6 +836,20 @@ def setUp(self):
838836
u"timestamp": 1458226213,
839837
},
840838
]
839+
# Test data for the PilotMonitoring type
840+
self.pilotMonitoringData = [
841+
{
842+
"HostName": "blabla",
843+
"SiteDirector": "blabla",
844+
"Site": "blabla",
845+
"CE": "blabla",
846+
"Queue": "blabla",
847+
"Status": "blabla",
848+
"NumTotal": "10",
849+
"NumSucceded": "3",
850+
"timestamp": 1458226213,
851+
}
852+
]
841853

842854
def tearDown(self):
843855
pass
@@ -858,6 +870,13 @@ def test_addComponentRecords(self):
858870
self.assertTrue(result["OK"])
859871
self.assertEqual(result["Value"], len(self.activityMonitoringData))
860872

873+
def test_addPilotRecords(self):
874+
for record in self.pilotMonitoringData:
875+
self.pilotMonitoringReporter.addRecord(record)
876+
result = self.pilotMonitoringReporter.commit()
877+
self.assertTrue(result["OK"])
878+
self.assertEqual(result["Value"], len(self.pilotMonitoringData))
879+
861880

862881
if __name__ == "__main__":
863882
testSuite = unittest.defaultTestLoader.loadTestsFromTestCase(MonitoringTestCase)

0 commit comments

Comments
 (0)