Skip to content

Commit

Permalink
Merge 84f2666 into c110245
Browse files Browse the repository at this point in the history
  • Loading branch information
tnek committed Sep 23, 2021
2 parents c110245 + 84f2666 commit 0e036f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 49 deletions.
39 changes: 7 additions & 32 deletions Source/santad/EventProviders/SNTEndpointSecurityManagerTest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,7 @@ - (void)testDenyOnTimeout {

[mockES triggerHandler:m.message];

[self waitForExpectationsWithTimeout:30.0
handler:^(NSError *error) {
if (error) {
XCTFail(@"Santa auth test timed out without receiving two "
@"events. Instead, had error: %@",
error);
}
}];
[self waitForExpectations:@[ expectation ] timeout:60.0];

for (ESResponse *resp in events) {
XCTAssertEqual(
Expand Down Expand Up @@ -116,12 +109,7 @@ - (void)testDeleteRulesDB {

[mockES triggerHandler:m.message];

[self waitForExpectationsWithTimeout:30.0
handler:^(NSError *error) {
if (error) {
XCTFail(@"Santa auth test timed out with error: %@", error);
}
}];
[self waitForExpectations:@[ expectation ] timeout:60.0];

XCTAssertEqual(got.result, [testCases objectForKey:testPath].intValue,
@"Incorrect handling of delete of %@", testPath);
Expand Down Expand Up @@ -152,12 +140,8 @@ - (void)testSkipOtherESEvents {
}];

[mockES triggerHandler:m.message];
[self waitForExpectationsWithTimeout:30.0
handler:^(NSError *error) {
if (error) {
XCTFail(@"Santa auth test timed out with error: %@", error);
}
}];

[self waitForExpectations:@[ expectation ] timeout:60.0];

XCTAssertEqual(got.result, ES_AUTH_RESULT_ALLOW);
}
Expand Down Expand Up @@ -199,12 +183,7 @@ - (void)testRenameOverwriteRulesDB {

[mockES triggerHandler:m.message];

[self waitForExpectationsWithTimeout:30.0
handler:^(NSError *error) {
if (error) {
XCTFail(@"Santa auth test timed out with error: %@", error);
}
}];
[self waitForExpectations:@[ expectation ] timeout:60.0];

XCTAssertEqual(got.result, [testCases objectForKey:testPath].intValue,
@"Incorrect handling of rename of %@", testPath);
Expand Down Expand Up @@ -254,12 +233,8 @@ - (void)testRenameRulesDB {

[mockES triggerHandler:m.message];

[self waitForExpectationsWithTimeout:30.0
handler:^(NSError *error) {
if (error) {
XCTFail(@"Santa auth test timed out with error: %@", error);
}
}];
[self waitForExpectations:@[ expectation ] timeout:60.0];

XCTAssertEqual(got.result, [testCases objectForKey:testPath].intValue,
@"Incorrect handling of rename of %@", testPath);

Expand Down
19 changes: 2 additions & 17 deletions Source/santad/SNTApplicationTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,7 @@ - (void)checkBinaryExecution:(NSString *)binaryName
[santaInit fulfill];
});

[self waitForExpectationsWithTimeout:30.0
handler:^(NSError *error) {
if (error) {
XCTFail(@"Santa's subscription to EndpointSecurity timed out "
@"with error: %@",
error);
}
}];
[self waitForExpectations:@[ santaInit ] timeout:60.0];

XCTestExpectation *expectation =
[self expectationWithDescription:@"Wait for santa's Auth dispatch queue"];
Expand All @@ -95,15 +88,7 @@ - (void)checkBinaryExecution:(NSString *)binaryName

[mockES triggerHandler:msg.message];

[self
waitForExpectationsWithTimeout:30.0
handler:^(NSError *error) {
if (error) {
XCTFail(
@"Santa auth test on binary \"%@/%@\" timed out with error: %@",
testPath, binaryName, error);
}
}];
[self waitForExpectations:@[ expectation ] timeout:60.0];

XCTAssertEqual(got.result, wantResult, @"received unexpected ES response on executing \"%@/%@\"",
testPath, binaryName);
Expand Down

0 comments on commit 0e036f4

Please sign in to comment.