Skip to content

Commit

Permalink
Enhance test_35 (subscription and notification mechanism test) to all… (
Browse files Browse the repository at this point in the history
#839)

* Since jstasiak/zeroconf#666 (0.32.0) it needs a much much smaller monkeypatch to be able to advertise the overlong service type "_nmos-registration._tcp"

* Fix flake8/pycodestyle E721 do not compare types

* Bump Node 12.x to Node 16.x

* python-zeroconf 0.75.0 strict=False for _nmos-registration._tcp

* Python 3.6 (and 3.7!) is End-Of-Life, and so is Node.js 14.x
Libraries like python-zeroconf are starting to depend on more recent Python features

* Pass IP address of API under test to testssl.sh

So that same one is used by Python tests and testssl.sh tests

Co-authored-by: Simon Lo <simon.lo@sony.com>

* Add MOCK_SERVICES_WARM_UP_DELAY

* Delay running tests until after MOCK_SERVICES_WARM_UP_DELAY

Co-authored-by: Simon Lo <simon.lo@sony.com>

* Tweak message

Co-authored-by: jonathan-r-thorpe <64410119+jonathan-r-thorpe@users.noreply.github.com>

* Enhance test_35 (subscription and notification mechanism test) to allow interference notifications while running test

* Update IS1201Test.py

shorten line for flake8

---------

Co-authored-by: Gareth Sylvester-Bradley <garethsb@nvidia.com>
Co-authored-by: Gareth Sylvester-Bradley <31761158+garethsb@users.noreply.github.com>
Co-authored-by: jonathan-r-thorpe <64410119+jonathan-r-thorpe@users.noreply.github.com>
  • Loading branch information
4 people authored Nov 6, 2023
1 parent b081bb0 commit aa6faa9
Showing 1 changed file with 37 additions and 28 deletions.
65 changes: 37 additions & 28 deletions nmostesting/suites/IS1201Test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,7 @@ def test_35(self, test):

error = False
error_message = ""
received_oids = dict.fromkeys(oids, 0)

for oid in oids:
new_user_label = "NMOS Testing Tool " + str(oid)
Expand All @@ -1391,37 +1392,45 @@ def test_35(self, test):
self.is12_utils.set_property(test, oid, NcObjectProperties.USER_LABEL.value, label)
self.is12_utils.stop_logging_notifications()

if len(self.is12_utils.get_notifications()) == 0:
notifications = self.is12_utils.get_notifications()

if len(notifications) == 0:
error = True
error_message = context + "No notification recieved"

for notification in self.is12_utils.get_notifications():
if notification['oid'] != oid:
error = True
error_message += context + "Unexpected Oid " + str(notification['oid']) + ", "

if notification['eventId'] != NcObjectEvents.PROPERTY_CHANGED.value:
error = True
error_message += context + "Unexpected event type: " + str(notification['eventId']) + ", "

if notification["eventData"]["propertyId"] != NcObjectProperties.USER_LABEL.value:
error = True
error_message += context + "Unexpected property id: " \
+ str(NcObjectProperties(notification["eventData"]["propertyId"]).name) + ", "

if notification["eventData"]["changeType"] != NcPropertyChangeType.ValueChanged.value:
error = True
error_message += context + "Unexpected change type: " \
+ str(NcPropertyChangeType(notification["eventData"]["changeType"]).name) + ", "

if notification["eventData"]["value"] != label:
error = True
error_message += context + "Unexpected value: " + str(notification["eventData"]["value"]) + ", "

if notification["eventData"]["sequenceItemIndex"] is not None:
error = True
error_message += context + "Unexpected sequence item index: " \
+ str(notification["eventData"]["sequenceItemIndex"]) + ", "
for notification in notifications:
if notification['oid'] == oid:

if notification['eventId'] != NcObjectEvents.PROPERTY_CHANGED.value:
error = True
error_message += context + "Unexpected event type: " + str(notification['eventId']) + ", "

if notification["eventData"]["propertyId"] != NcObjectProperties.USER_LABEL.value:
continue

if notification["eventData"]["changeType"] != NcPropertyChangeType.ValueChanged.value:
error = True
error_message += context + "Unexpected change type: " \
+ str(NcPropertyChangeType(notification["eventData"]["changeType"]).name) + ", "

if notification["eventData"]["value"] != label:
error = True
error_message += context + "Unexpected value: " \
+ str(notification["eventData"]["value"]) + ", "

if notification["eventData"]["sequenceItemIndex"] is not None:
error = True
error_message += context + "Unexpected sequence item index: " \
+ str(notification["eventData"]["sequenceItemIndex"]) + ", "

received_oids[oid] += 1

if not all(received_oids.values()):
error = True
error_message += "No expected notifications received"
elif not any(received_oids.values()):
error = True
error_message += "Not all the expected Oid notifications received"

if error:
return test.FAIL(error_message)
Expand Down

0 comments on commit aa6faa9

Please sign in to comment.