Skip to content

Commit

Permalink
Unit test timing fix and remove debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jtung-apple committed May 23, 2024
1 parent 9a4f3e4 commit d9633ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/darwin/Framework/CHIPTests/MTRDeviceTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ - (void)tearDown
// existing subscriptions and then fail out due to requesting a subscribe to
// a nonexistent cluster.
if (mConnectedDevice != nil) {
NSLog(@"JEFFTEST: teardown - unsubscribe");
dispatch_queue_t queue = dispatch_get_main_queue();

MTRSubscribeParams * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(0) maxInterval:@(10)];
Expand Down
6 changes: 3 additions & 3 deletions src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -1457,12 +1457,12 @@ - (void)doDataStoreMTRDeviceTestWithStorageDelegate:(id<MTRDeviceControllerStora
[device setDelegate:delegate queue:queue];

[self waitForExpectations:@[ subscriptionExpectation ] timeout:60];
__auto_type * afterInitialSubscription = [NSDate now];

if (!disableStorageBehaviorOptimization) {
[self waitForExpectations:@[ gotClusterDataPersisted ] timeout:60];
}

__auto_type * afterInitialSubscription = [NSDate now];

NSUInteger dataStoreValuesCount = 0;
NSDictionary<MTRClusterPath *, MTRDeviceClusterData *> * dataStoreClusterData = [controller.controllerDataStore getStoredClusterDataForNodeID:deviceID];
for (MTRClusterPath * path in dataStoreClusterData) {
Expand Down Expand Up @@ -1509,7 +1509,7 @@ - (void)doDataStoreMTRDeviceTestWithStorageDelegate:(id<MTRDeviceControllerStora
// to the immediately following internal subscription established
// notification, so in fact our measured value can end up shorter than the
// estimated latency the device has. Add some slop to handle that.
const NSTimeInterval timingSlopInSeconds = 0.1;
const NSTimeInterval timingSlopInSeconds = 0.5;
XCTAssertLessThanOrEqual(device.estimatedSubscriptionLatency.doubleValue, [afterInitialSubscription timeIntervalSinceDate:beforeSetDelegate] + timingSlopInSeconds);

// Now set up new delegate for the new device and verify that once subscription reestablishes, the data version filter loaded from storage will work
Expand Down

0 comments on commit d9633ee

Please sign in to comment.