From e8201fde70cded441ff69365b93897a1a60b16c2 Mon Sep 17 00:00:00 2001 From: "Eric J. Smith" Date: Wed, 7 Aug 2024 11:26:59 -0500 Subject: [PATCH] Fix broken tests --- .../Queue/QueueTestBase.cs | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/Foundatio.TestHarness/Queue/QueueTestBase.cs b/src/Foundatio.TestHarness/Queue/QueueTestBase.cs index 70dd8c2e..50fe0b6f 100644 --- a/src/Foundatio.TestHarness/Queue/QueueTestBase.cs +++ b/src/Foundatio.TestHarness/Queue/QueueTestBase.cs @@ -94,17 +94,17 @@ await queue.EnqueueAsync(new SimpleWorkItem Assert.Equal(1, stats.Completed); Assert.Equal(0, stats.Queued); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.enqueued")); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.dequeued")); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.completed")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.enqueued")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.dequeued")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.completed")); - Assert.Equal(0, metricsCollector.GetSum("foundatio.simpleworkitem.count")); - Assert.Equal(0, metricsCollector.GetSum("foundatio.simpleworkitem.working")); - Assert.Equal(0, metricsCollector.GetSum("foundatio.simpleworkitem.deadletter")); + Assert.Equal(0, metricsCollector.GetSum("foundatio.simpleworkitem.count")); + Assert.Equal(0, metricsCollector.GetSum("foundatio.simpleworkitem.working")); + Assert.Equal(0, metricsCollector.GetSum("foundatio.simpleworkitem.deadletter")); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.myitem.enqueued")); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.myitem.dequeued")); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.myitem.completed")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.myitem.enqueued")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.myitem.dequeued")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.myitem.completed")); } } finally @@ -152,9 +152,9 @@ await queue.EnqueueAsync(new SimpleWorkItem Assert.Equal(0, stats.Queued); metricsCollector.RecordObservableInstruments(); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.enqueued")); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.dequeued")); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.completed")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.enqueued")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.dequeued")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.completed")); Assert.Equal(0, metricsCollector.GetSum("foundatio.simpleworkitem.count")); Assert.Equal(0, metricsCollector.GetSum("foundatio.simpleworkitem.working")); @@ -213,7 +213,7 @@ await queue.EnqueueAsync(new SimpleWorkItem if (_assertStats) { Assert.Equal(1, (await queue.GetQueueStatsAsync()).Dequeued); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.dequeued")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.dequeued")); } await workItem.AbandonAsync(); @@ -229,9 +229,9 @@ await queue.EnqueueAsync(new SimpleWorkItem Assert.Equal(1, stats.Queued); metricsCollector.RecordObservableInstruments(); - Assert.Equal(0, metricsCollector.GetSum("foundatio.simpleworkitem.completed")); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.abandoned")); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.count")); + Assert.Equal(0, metricsCollector.GetSum("foundatio.simpleworkitem.completed")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.abandoned")); + Assert.Equal(1, metricsCollector.GetMax("foundatio.simpleworkitem.count")); } workItem = await queue.DequeueAsync(TimeSpan.FromSeconds(10)); @@ -270,7 +270,7 @@ await queue.EnqueueAsync(new SimpleWorkItem if (_assertStats) { Assert.Equal(1, (await queue.GetQueueStatsAsync()).Enqueued); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.enqueued")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.enqueued")); } await queue.EnqueueAsync(new SimpleWorkItem @@ -281,7 +281,7 @@ await queue.EnqueueAsync(new SimpleWorkItem if (_assertStats) { Assert.Equal(1, (await queue.GetQueueStatsAsync()).Enqueued); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.enqueued")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.enqueued")); } var workItem = await queue.DequeueAsync(TimeSpan.Zero); @@ -290,7 +290,7 @@ await queue.EnqueueAsync(new SimpleWorkItem if (_assertStats) { Assert.Equal(1, (await queue.GetQueueStatsAsync()).Dequeued); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.dequeued")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.dequeued")); } await queue.EnqueueAsync(new SimpleWorkItem @@ -301,7 +301,7 @@ await queue.EnqueueAsync(new SimpleWorkItem if (_assertStats) { Assert.Equal(2, (await queue.GetQueueStatsAsync()).Enqueued); - Assert.Equal(2, metricsCollector.GetSum("foundatio.simpleworkitem.enqueued")); + Assert.Equal(2, metricsCollector.GetSum("foundatio.simpleworkitem.enqueued")); } await workItem.CompleteAsync(); @@ -314,10 +314,10 @@ await queue.EnqueueAsync(new SimpleWorkItem Assert.Equal(1, stats.Queued); metricsCollector.RecordObservableInstruments(); - Assert.Equal(2, metricsCollector.GetSum("foundatio.simpleworkitem.enqueued")); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.dequeued")); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.completed")); - Assert.Equal(0, metricsCollector.GetSum("foundatio.simpleworkitem.abandoned")); + Assert.Equal(2, metricsCollector.GetSum("foundatio.simpleworkitem.enqueued")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.dequeued")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.completed")); + Assert.Equal(0, metricsCollector.GetSum("foundatio.simpleworkitem.abandoned")); Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.count")); Assert.Equal(0, metricsCollector.GetSum("foundatio.simpleworkitem.working")); @@ -399,9 +399,9 @@ await queue.EnqueueAsync(new SimpleWorkItem Assert.Equal(retryCount + 1, stats.Abandoned); metricsCollector.RecordObservableInstruments(); - Assert.Equal(retryCount + 1, metricsCollector.GetSum("foundatio.simpleworkitem.dequeued")); + Assert.Equal(retryCount + 1, metricsCollector.GetSum("foundatio.simpleworkitem.dequeued")); Assert.Equal(0, metricsCollector.GetSum("foundatio.simpleworkitem.completed")); - Assert.Equal(retryCount + 1, metricsCollector.GetSum("foundatio.simpleworkitem.abandoned")); + Assert.Equal(retryCount + 1, metricsCollector.GetSum("foundatio.simpleworkitem.abandoned")); Assert.Equal(0, metricsCollector.GetSum("foundatio.simpleworkitem.count")); } @@ -437,7 +437,7 @@ await queue.EnqueueAsync(new SimpleWorkItem if (_assertStats) { Assert.Equal(1, (await queue.GetQueueStatsAsync()).Enqueued); - Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.enqueued")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.enqueued")); } var workItem = await queue.DequeueAsync(new CancellationToken(true)); @@ -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("foundatio.simpleworkitem.completed")); + Assert.Equal(1, metricsCollector.GetSum("foundatio.simpleworkitem.completed")); } } finally