Skip to content

Commit

Permalink
Fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ejsmith committed Aug 7, 2024
1 parent eea0232 commit e8201fd
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions src/Foundatio.TestHarness/Queue/QueueTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@ await queue.EnqueueAsync(new SimpleWorkItem
Assert.Equal(1, stats.Completed);
Assert.Equal(0, stats.Queued);

Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.enqueued"));
Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.dequeued"));
Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.completed"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.enqueued"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.dequeued"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.completed"));

Assert.Equal(0, metricsCollector.GetSum<int>("foundatio.simpleworkitem.count"));
Assert.Equal(0, metricsCollector.GetSum<int>("foundatio.simpleworkitem.working"));
Assert.Equal(0, metricsCollector.GetSum<int>("foundatio.simpleworkitem.deadletter"));
Assert.Equal(0, metricsCollector.GetSum<long>("foundatio.simpleworkitem.count"));
Assert.Equal(0, metricsCollector.GetSum<long>("foundatio.simpleworkitem.working"));
Assert.Equal(0, metricsCollector.GetSum<long>("foundatio.simpleworkitem.deadletter"));

Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.myitem.enqueued"));
Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.myitem.dequeued"));
Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.myitem.completed"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.myitem.enqueued"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.myitem.dequeued"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.myitem.completed"));
}
}
finally
Expand Down Expand Up @@ -152,9 +152,9 @@ await queue.EnqueueAsync(new SimpleWorkItem
Assert.Equal(0, stats.Queued);

metricsCollector.RecordObservableInstruments();
Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.enqueued"));
Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.dequeued"));
Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.completed"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.enqueued"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.dequeued"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.completed"));

Assert.Equal(0, metricsCollector.GetSum<long>("foundatio.simpleworkitem.count"));
Assert.Equal(0, metricsCollector.GetSum<long>("foundatio.simpleworkitem.working"));
Expand Down Expand Up @@ -213,7 +213,7 @@ await queue.EnqueueAsync(new SimpleWorkItem
if (_assertStats)
{
Assert.Equal(1, (await queue.GetQueueStatsAsync()).Dequeued);
Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.dequeued"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.dequeued"));
}

await workItem.AbandonAsync();
Expand All @@ -229,9 +229,9 @@ await queue.EnqueueAsync(new SimpleWorkItem
Assert.Equal(1, stats.Queued);

metricsCollector.RecordObservableInstruments();
Assert.Equal(0, metricsCollector.GetSum<int>("foundatio.simpleworkitem.completed"));
Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.abandoned"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.count"));
Assert.Equal(0, metricsCollector.GetSum<long>("foundatio.simpleworkitem.completed"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.abandoned"));
Assert.Equal(1, metricsCollector.GetMax<long>("foundatio.simpleworkitem.count"));
}

workItem = await queue.DequeueAsync(TimeSpan.FromSeconds(10));
Expand Down Expand Up @@ -270,7 +270,7 @@ await queue.EnqueueAsync(new SimpleWorkItem
if (_assertStats)
{
Assert.Equal(1, (await queue.GetQueueStatsAsync()).Enqueued);
Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.enqueued"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.enqueued"));
}

await queue.EnqueueAsync(new SimpleWorkItem
Expand All @@ -281,7 +281,7 @@ await queue.EnqueueAsync(new SimpleWorkItem
if (_assertStats)
{
Assert.Equal(1, (await queue.GetQueueStatsAsync()).Enqueued);
Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.enqueued"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.enqueued"));
}

var workItem = await queue.DequeueAsync(TimeSpan.Zero);
Expand All @@ -290,7 +290,7 @@ await queue.EnqueueAsync(new SimpleWorkItem
if (_assertStats)
{
Assert.Equal(1, (await queue.GetQueueStatsAsync()).Dequeued);
Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.dequeued"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.dequeued"));
}

await queue.EnqueueAsync(new SimpleWorkItem
Expand All @@ -301,7 +301,7 @@ await queue.EnqueueAsync(new SimpleWorkItem
if (_assertStats)
{
Assert.Equal(2, (await queue.GetQueueStatsAsync()).Enqueued);
Assert.Equal(2, metricsCollector.GetSum<int>("foundatio.simpleworkitem.enqueued"));
Assert.Equal(2, metricsCollector.GetSum<long>("foundatio.simpleworkitem.enqueued"));
}

await workItem.CompleteAsync();
Expand All @@ -314,10 +314,10 @@ await queue.EnqueueAsync(new SimpleWorkItem
Assert.Equal(1, stats.Queued);

metricsCollector.RecordObservableInstruments();
Assert.Equal(2, metricsCollector.GetSum<int>("foundatio.simpleworkitem.enqueued"));
Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.dequeued"));
Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.completed"));
Assert.Equal(0, metricsCollector.GetSum<int>("foundatio.simpleworkitem.abandoned"));
Assert.Equal(2, metricsCollector.GetSum<long>("foundatio.simpleworkitem.enqueued"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.dequeued"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.completed"));
Assert.Equal(0, metricsCollector.GetSum<long>("foundatio.simpleworkitem.abandoned"));

Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.count"));
Assert.Equal(0, metricsCollector.GetSum<long>("foundatio.simpleworkitem.working"));
Expand Down Expand Up @@ -399,9 +399,9 @@ await queue.EnqueueAsync(new SimpleWorkItem
Assert.Equal(retryCount + 1, stats.Abandoned);

metricsCollector.RecordObservableInstruments();
Assert.Equal(retryCount + 1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.dequeued"));
Assert.Equal(retryCount + 1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.dequeued"));
Assert.Equal(0, metricsCollector.GetSum<int>("foundatio.simpleworkitem.completed"));
Assert.Equal(retryCount + 1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.abandoned"));
Assert.Equal(retryCount + 1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.abandoned"));

Assert.Equal(0, metricsCollector.GetSum<long>("foundatio.simpleworkitem.count"));
}
Expand Down Expand Up @@ -437,7 +437,7 @@ await queue.EnqueueAsync(new SimpleWorkItem
if (_assertStats)
{
Assert.Equal(1, (await queue.GetQueueStatsAsync()).Enqueued);
Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.enqueued"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.enqueued"));
}

var workItem = await queue.DequeueAsync(new CancellationToken(true));
Expand All @@ -453,7 +453,7 @@ await queue.EnqueueAsync(new SimpleWorkItem
var stats = await queue.GetQueueStatsAsync();
Assert.Equal(1, stats.Completed);
Assert.Equal(0, stats.Queued);
Assert.Equal(1, metricsCollector.GetSum<int>("foundatio.simpleworkitem.completed"));
Assert.Equal(1, metricsCollector.GetSum<long>("foundatio.simpleworkitem.completed"));
}
}
finally
Expand Down

0 comments on commit e8201fd

Please sign in to comment.