@@ -317,25 +317,29 @@ def __init__(self, expected_attribute: ClusterObjects.ClusterAttributeDescriptor
317
317
self ._expected_attribute = expected_attribute
318
318
319
319
def __call__ (self , path : TypedAttributePath , transaction : SubscriptionTransaction ):
320
- if path .AttributeType == self ._expected_attribute :
321
- q = (path , transaction )
322
- logging .info (f'[callback] Got subscription report for { path .AttributeType } ' )
323
- self ._output .put (q )
324
- else :
325
- logging .error (f"Expected attribute { self ._expected_attribute } mismatch: { path .AttributeType } " )
320
+ """This is the subscription callback when an attribute is updated.
321
+ It checks the passed in attribute is the same as the subscribed to attribute and
322
+ then posts it into the queue for later processing."""
323
+
324
+ asserts .assert_equal (path .AttributeType , self ._expected_attribute ,
325
+ f"[AttributeChangeCallback] Attribute mismatch. Expected: { self ._expected_attribute } , received: { path .AttributeType } " )
326
+ logging .info (f"[AttributeChangeCallback] Attribute update callback for { path .AttributeType } " )
327
+ q = (path , transaction )
328
+ self ._output .put (q )
326
329
327
330
def wait_for_report (self ):
328
331
try :
329
332
path , transaction = self ._output .get (block = True , timeout = 10 )
330
333
except queue .Empty :
331
- asserts .fail (f"Failed to receive a report for the attribute change for { self ._expected_attribute } " )
334
+ asserts .fail (f"[AttributeChangeCallback] Failed to receive a report for the { self ._expected_attribute } attribute change " )
332
335
333
336
asserts .assert_equal (path .AttributeType , self ._expected_attribute ,
334
- f"Received incorrect attribute report. Expected: { self ._expected_attribute } , received: { path .AttributeType } " )
337
+ f"[AttributeChangeCallback] Received incorrect report. Expected: { self ._expected_attribute } , received: { path .AttributeType } " )
335
338
try :
336
- transaction .GetAttribute (path )
339
+ attribute_value = transaction .GetAttribute (path )
340
+ logging .info (f"[AttributeChangeCallback] Got attribute subscription report. Attribute { path .AttributeType } . Updated value: { attribute_value } . SubscriptionId: { transaction .subscriptionId } " )
337
341
except KeyError :
338
- asserts .fail ("Attribute {expected_attribute} not found in returned report" )
342
+ asserts .fail ("[AttributeChangeCallback] Attribute {expected_attribute} not found in returned report" )
339
343
340
344
341
345
class InternalTestRunnerHooks (TestRunnerHooks ):
0 commit comments