Commit 219ae9c6 authored by Paul Graydon's avatar Paul Graydon

wendelin_telecom_test: Update tests

parent e8ece533
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>test_example_ors_enb_log_invalid</string> </value> <value> <string>test_example_ors_enb_log_invalid_split_1</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test_example_ors_enb_log_invalid</string> </value> <value> <string>test_example_ors_enb_log_invalid_split_1</string> </value>
</item> </item>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Test ORS Example Log (Invalid)</string> </value> <value> <string>Test ORS Example Log (Invalid) Split 1</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Page" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>test_example_ors_enb_log_invalid_split_2</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_example_ors_enb_log_invalid_split_2</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Test ORS Example Log (Invalid) Split 2</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -57,8 +57,11 @@ class WendelinTelecomTest(SecurityTestCase): ...@@ -57,8 +57,11 @@ class WendelinTelecomTest(SecurityTestCase):
self.test_ors_example_log_valid = { self.test_ors_example_log_valid = {
'log': self.portal.web_page_module.test_example_ors_enb_log_valid.getTextContent() 'log': self.portal.web_page_module.test_example_ors_enb_log_valid.getTextContent()
} }
self.test_ors_example_log_invalid = { self.test_ors_example_log_invalid_split_1 = {
'log': self.portal.web_page_module.test_example_ors_enb_log_invalid.getTextContent() 'log': self.portal.web_page_module.test_example_ors_enb_log_invalid_split_1.getTextContent()
}
self.test_ors_example_log_invalid_split_2 = {
'log': self.portal.web_page_module.test_example_ors_enb_log_invalid_split_2.getTextContent()
} }
self.test_ors_example_log_empty = {'log': ""} self.test_ors_example_log_empty = {'log': ""}
...@@ -644,24 +647,33 @@ class WendelinTelecomTest(SecurityTestCase): ...@@ -644,24 +647,33 @@ class WendelinTelecomTest(SecurityTestCase):
''' '''
Test a simple valid ORS log ingestion: simulate a fluentd gateway forwarding valid ORS logs to the platform, Test a simple valid ORS log ingestion: simulate a fluentd gateway forwarding valid ORS logs to the platform,
and check that all items related to the ingestion are valid. and check that all items related to the ingestion are valid.
These logs are correct, even though some are out of chronological order (which is expected and accounted for).
''' '''
# Register the ORS # Register the ORS
ors_item_dict = self.registerOrs() ors_item_dict = self.registerOrs()
ors_tag = ors_item_dict['data_acquisition_unit'].getReference() ors_tag = ors_item_dict['data_acquisition_unit'].getReference()
# Get the correct data logs according to what is being tested # Get the correct data logs according to what is being tested
test_ors_example_log = None test_ors_example_logs = []
if data_key == "valid": if data_key == "valid":
test_ors_example_log = self.test_ors_example_log_valid test_ors_example_logs = [self.test_ors_example_log_valid]
elif data_key == "invalid": elif data_key == "invalid":
test_ors_example_log = self.test_ors_example_log_invalid test_ors_example_logs = [
self.test_ors_example_log_invalid_split_1,
self.test_ors_example_log_invalid_split_2
]
elif data_key == "empty": elif data_key == "empty":
test_ors_example_log = self.test_ors_example_log_empty test_ors_example_logs = [self.test_ors_example_log_empty]
# Perform ingestion # Perform ingestions, and keep only the last item dictionary
ingestion_item_dict = self.getOrsLogIngestionItems(test_ors_example_log, ors_tag) # as they are all identical
ingestion_item_dicts = [
self.getOrsLogIngestionItems(ors_log, ors_tag) \
for ors_log in test_ors_example_logs
]
ingestion_item_dict = ingestion_item_dicts[-1]
# In all cases, check that all items related to the ingestion exist # In all cases, check that all items related to the ingestions exist
self.assertEqual(NO_CONTENT, ingestion_item_dict['response'].getStatus()) self.assertEqual(NO_CONTENT, ingestion_item_dict['response'].getStatus())
self.assertTrue(ingestion_item_dict['data_acquisition_unit'] is not None) self.assertTrue(ingestion_item_dict['data_acquisition_unit'] is not None)
self.assertTrue(ingestion_item_dict['data_supply'] is not None) self.assertTrue(ingestion_item_dict['data_supply'] is not None)
...@@ -670,41 +682,43 @@ class WendelinTelecomTest(SecurityTestCase): ...@@ -670,41 +682,43 @@ class WendelinTelecomTest(SecurityTestCase):
self.assertTrue(all(data_array is not None for data_array in ingestion_item_dict['data_array_list'])) self.assertTrue(all(data_array is not None for data_array in ingestion_item_dict['data_array_list']))
# Check that the data arrays containing the KPI data have correctly been initialized # Check that the data arrays containing the KPI data have correctly been initialized
self.assertTrue(ingestion_item_dict['data_acquisition_unit'].DataAcquisitionUnit_getERabDataArrayKey() is not None) self.assertTrue(ingestion_item_dict['data_acquisition_unit'].DataAcquisitionUnit_getERabDataArrayUrl() is not None)
self.assertTrue(ingestion_item_dict['data_acquisition_unit'].DataAcquisitionUnit_getEUtranDataArrayKey() is not None) self.assertTrue(ingestion_item_dict['data_acquisition_unit'].DataAcquisitionUnit_getEUtranDataArrayUrl() is not None)
e_rab_shape = (0,) e_rab_array_shape = None
e_rab_dtype = [ e_rab_array_dtype = [
('vt', '<f8'), ('vt', '<f8'),
('vInitialEPSBEstabSR_lo', '<f8'), ('vInitialEPSBEstabSR_lo', '<f8'),
('vInitialEPSBEstabSR_hi', '<f8'), ('vInitialEPSBEstabSR_hi', '<f8'),
('vAddedEPSBEstabSR_lo', '<f8'), ('vAddedEPSBEstabSR_lo', '<f8'),
('vAddedEPSBEstabSR_hi', '<f8') ('vAddedEPSBEstabSR_hi', '<f8')
] ]
e_utran_shape = (0,) e_utran_array_shape = None
e_utran_dtype = [('evt', '<f8'), ('qci', '<f8'), ('dl_lo', '<f8'), ('dl_hi', '<f8'), ('ul_lo', '<f8'), ('ul_hi', '<f8')] e_utran_array_dtype = [('evt', '<f8'), ('dl_lo', '<f8'), ('dl_hi', '<f8'), ('ul_lo', '<f8'), ('ul_hi', '<f8')]
if data_key == "valid": if data_key == "valid":
e_rab_shape = (24,) e_rab_array_shape = (82,)
e_utran_array_shape = (20992,)
elif data_key == "invalid": elif data_key == "invalid":
e_rab_shape = (30,) e_rab_array_shape = (44,)
e_utran_array_shape = (11264,)
elif data_key == "empty": elif data_key == "empty":
e_rab_shape = None e_rab_array_dtype = None
e_rab_dtype = None e_utran_array_dtype = None
e_utran_shape = None
e_utran_dtype = None
for data_array in ingestion_item_dict['data_array_list']: for data_array in ingestion_item_dict['data_array_list']:
if 'e_rab' in data_array.getReference(): if 'e_rab' in data_array.getReference():
self.assertTrue(data_array.getArrayDtype() == e_rab_dtype) self.assertTrue(data_array.getArrayShape() == e_rab_array_shape)
self.assertTrue(data_array.getArrayShape() == e_rab_shape) self.assertTrue(data_array.getArrayDtype() == e_rab_array_dtype)
elif 'e_utran' in data_array.getReference(): elif 'e_utran' in data_array.getReference():
self.assertTrue(data_array.getArrayDtype() == e_utran_dtype) self.assertTrue(data_array.getArrayShape() == e_utran_array_shape)
self.assertTrue(data_array.getArrayShape() == e_utran_shape) self.assertTrue(data_array.getArrayDtype() == e_utran_array_dtype)
def test_04_2_ingestInvalidOrsLogDataFromFluentd(self): def test_04_2_ingestInvalidOrsLogDataFromFluentd(self):
''' '''
Test an invalid ORS log ingestion: simulate a fluentd gateway forwarding invalid ORS logs to the platform. Test an invalid ORS log ingestion: simulate a fluentd gateway forwarding invalid ORS logs to the platform.
Check that all items are still valid, as only the invalid measurements are ignored. Check that all items are still valid, as log chunks containing invalid measurements are skipped and
KPIs can continue to be calculated once they are no longer in the calculation window.
''' '''
# Call the above test, but test with invalid data # Call the above test, but test with invalid data
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment