Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests to ensure EventTypeToString handles all subscriptions #1374

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ - (void)testEnable {

[authClient enable];

for (const auto &event : expectedEventSubs) {
XCTAssertNoThrow(santa::santad::EventTypeToString(event));
}

XCTBubbleMockVerifyAndClearExpectations(mockESApi.get());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,10 @@ - (void)testEnable {

[deviceClient enable];

for (const auto &event : expectedEventSubs) {
XCTAssertNoThrow(santa::santad::EventTypeToString(event));
}

XCTBubbleMockVerifyAndClearExpectations(mockESApi.get());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,10 @@ - (void)testEnable {

[fileAccessClient enable];

for (const auto &event : expectedEventSubs) {
XCTAssertNoThrow(santa::santad::EventTypeToString(event));
}

XCTBubbleMockVerifyAndClearExpectations(mockESApi.get());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ - (void)testEnable {

[recorderClient enable];

for (const auto &event : expectedEventSubs) {
XCTAssertNoThrow(santa::santad::EventTypeToString(event));
}

XCTBubbleMockVerifyAndClearExpectations(mockESApi.get());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ - (void)testEnable {

[mockTamperClient enable];

for (const auto &event : expectedEventSubs) {
XCTAssertNoThrow(santa::santad::EventTypeToString(event));
}

XCTBubbleMockVerifyAndClearExpectations(mockESApi.get());
[mockTamperClient stopMocking];
}
Expand Down
2 changes: 2 additions & 0 deletions Source/santad/Metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ using FileAccessEventCountTuple =
std::tuple<FileAccessMetricsPolicyVersion, FileAccessMetricsPolicyName, FileAccessMetricStatus,
es_event_type_t, FileAccessPolicyDecision>;

NSString *const EventTypeToString(es_event_type_t eventType);

class Metrics : public std::enable_shared_from_this<Metrics> {
public:
static std::shared_ptr<Metrics> Create(SNTMetricSet *metric_set, uint64_t interval);
Expand Down
Loading