Skip to content

Commit

Permalink
Metric: Fix formatting of SNTMetricFormatTestHelper (#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
russellhancox committed Sep 23, 2021
1 parent f93e7ef commit e68fb72
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions Source/santametricservice/Formats/SNTMetricFormatTestHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,19 @@

@implementation SNTMetricFormatTestHelper
+ (NSDictionary *)convertDatesToFixedDateWithExportDict:(NSMutableDictionary *)exportDict {
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"];
NSDate *fixedDate = [formatter dateFromString:@"2021-09-16T21:07:34.826Z"];

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"];
NSDate *fixedDate = [formatter dateFromString:@"2021-09-16T21:07:34.826Z"];

for (NSString *metricName in exportDict[@"metrics"]) {
for (NSString *metricName in exportDict[@"metrics"]) {
NSMutableDictionary *metric = exportDict[@"metrics"][metricName];

for (NSString *field in metric[@"fields"]) {
NSMutableArray<NSMutableDictionary *> *values = metric[@"fields"][field];

[values enumerateObjectsUsingBlock:^(id object, NSUInteger index, BOOL *stop) {
values[index][@"created"] = fixedDate;
values[index][@"last_updated"] = fixedDate;
[values enumerateObjectsUsingBlock:^(id object, NSUInteger index, BOOL *stop) {
values[index][@"created"] = fixedDate;
values[index][@"last_updated"] = fixedDate;
}];
}
}
Expand All @@ -41,8 +40,7 @@ + (NSDictionary *)convertDatesToFixedDateWithExportDict:(NSMutableDictionary *)e
}

+ (NSDictionary *)createValidMetricsDictionary {

SNTMetricSet *metricSet = [[SNTMetricSet alloc] initWithHostname:@"testHost"
SNTMetricSet *metricSet = [[SNTMetricSet alloc] initWithHostname:@"testHost"
username:@"testUser"];

// Add constants
Expand Down

0 comments on commit e68fb72

Please sign in to comment.