@@ -242,6 +242,7 @@ - (void)tearDown
242
242
// existing subscriptions and then fail out due to requesting a subscribe to
243
243
// a nonexistent cluster.
244
244
if (mConnectedDevice != nil ) {
245
+ NSLog (@" JEFFTEST: teardown - unsubscribe" );
245
246
dispatch_queue_t queue = dispatch_get_main_queue ();
246
247
247
248
MTRSubscribeParams * params = [[MTRSubscribeParams alloc ] initWithMinInterval: @(0 ) maxInterval: @(10 )];
@@ -3679,7 +3680,7 @@ - (void)test036_TestStorageBehaviorConfiguration
3679
3680
3680
3681
__auto_type * device = [MTRDevice deviceWithNodeID: kDeviceId deviceController: sController ];
3681
3682
3682
- __auto_type * delegate = [[MTRDeviceTestDelegate alloc ] init ];
3683
+ __auto_type * delegate = [[MTRDeviceTestDelegateWithSubscriptionSetupOverride alloc ] init ];
3683
3684
__block os_unfair_lock lock = OS_UNFAIR_LOCK_INIT;
3684
3685
__block NSDate * reportEndTime = nil ;
3685
3686
__block NSDate * dataPersistedTime = nil ;
@@ -3832,9 +3833,10 @@ - (void)test036_TestStorageBehaviorConfiguration
3832
3833
os_unfair_lock_lock (&lock);
3833
3834
reportToPersistenceDelay = [dataPersistedTime timeIntervalSinceDate: reportEndTime];
3834
3835
os_unfair_lock_unlock (&lock);
3835
- // Check delay exists and approximately base delay times 3
3836
+ // Check delay exists and at least base delay times 3
3836
3837
XCTAssertGreaterThan (reportToPersistenceDelay, baseTestDelayTime * 3 * 0.9 );
3837
- XCTAssertLessThan (reportToPersistenceDelay, baseTestDelayTime * 3 * 1.3 ); // larger upper limit in case machine is slow
3838
+ // upper limit at most max delay times full multiplier + extra in case machine is slow
3839
+ XCTAssertLessThan (reportToPersistenceDelay, baseTestDelayTime * 2 * 5 * 1.3 );
3838
3840
3839
3841
// Test 4: test reporting excessively, and see that persistence does not happen until
3840
3842
// reporting frequency goes back above the threshold
@@ -3888,6 +3890,9 @@ - (void)test036_TestStorageBehaviorConfiguration
3888
3890
[device unitTestInjectAttributeReport: attributeReport fromSubscription: YES ];
3889
3891
3890
3892
[self waitForExpectations: @[ dataPersisted4 ] timeout: 60 ];
3893
+
3894
+ delegate.onReportEnd = nil ;
3895
+ delegate.onClusterDataPersisted = nil ;
3891
3896
}
3892
3897
3893
3898
@end
0 commit comments