From 65d357e49420efc7480ef605c22c4c99108a27fe Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Wed, 25 Sep 2024 22:22:49 -0500 Subject: [PATCH] Added missing tests, removed some fact skips --- docker-compose.yml | 7 +- .../Jobs/RedisJobQueueTests.cs | 6 ++ .../Messaging/RedisMessageBusTests.cs | 2 +- .../Queues/RedisQueueTests.cs | 82 +++++++++++-------- .../Storage/RedisFileStorageTests.cs | 18 ++++ 5 files changed, 80 insertions(+), 35 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 298e235..309a2cc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '2' - services: redis: image: grokzen/redis-cluster:7.0.10 @@ -11,6 +9,11 @@ services: - 7000-7005:7000-7005 # cluster - 7006-7007:7006-7007 # single - 5000-5002:5000-5002 # sentinel + deploy: + resources: + limits: + memory: 2g + ready: image: andrewlock/wait-for-dependencies command: redis:7000 diff --git a/tests/Foundatio.Redis.Tests/Jobs/RedisJobQueueTests.cs b/tests/Foundatio.Redis.Tests/Jobs/RedisJobQueueTests.cs index 43229bc..7af1953 100644 --- a/tests/Foundatio.Redis.Tests/Jobs/RedisJobQueueTests.cs +++ b/tests/Foundatio.Redis.Tests/Jobs/RedisJobQueueTests.cs @@ -43,4 +43,10 @@ public override Task CanRunQueueJobAsync() { return base.CanRunQueueJobAsync(); } + + [Fact] + public override Task ActivityWillFlowThroughQueueJobAsync() + { + return base.ActivityWillFlowThroughQueueJobAsync(); + } } diff --git a/tests/Foundatio.Redis.Tests/Messaging/RedisMessageBusTests.cs b/tests/Foundatio.Redis.Tests/Messaging/RedisMessageBusTests.cs index 7655d08..22c007b 100644 --- a/tests/Foundatio.Redis.Tests/Messaging/RedisMessageBusTests.cs +++ b/tests/Foundatio.Redis.Tests/Messaging/RedisMessageBusTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading; using System.Threading.Tasks; using Foundatio.AsyncEx; diff --git a/tests/Foundatio.Redis.Tests/Queues/RedisQueueTests.cs b/tests/Foundatio.Redis.Tests/Queues/RedisQueueTests.cs index 8da7f80..39bdf69 100644 --- a/tests/Foundatio.Redis.Tests/Queues/RedisQueueTests.cs +++ b/tests/Foundatio.Redis.Tests/Queues/RedisQueueTests.cs @@ -48,7 +48,7 @@ protected override IQueue GetQueue(int retries = 1, TimeSpan? wo .LoggerFactory(Log) ); - _logger.LogDebug("Queue Id: {queueId}", queue.QueueId); + _logger.LogDebug("Queue Id: {QueueId}", queue.QueueId); return queue; } @@ -58,6 +58,24 @@ public override Task CanQueueAndDequeueWorkItemAsync() return base.CanQueueAndDequeueWorkItemAsync(); } + [Fact] + public override Task CanQueueAndDequeueWorkItemWithDelayAsync() + { + return base.CanQueueAndDequeueWorkItemWithDelayAsync(); + } + + [Fact] + public override Task CanUseQueueOptionsAsync() + { + return base.CanUseQueueOptionsAsync(); + } + + [Fact] + public override Task CanDiscardDuplicateQueueEntriesAsync() + { + return base.CanDiscardDuplicateQueueEntriesAsync(); + } + [Fact] public override Task CanDequeueWithCancelledTokenAsync() { @@ -106,12 +124,6 @@ public override Task CanUseQueueWorkerAsync() return base.CanUseQueueWorkerAsync(); } - [Fact] - public override Task CanRenewLockAsync() - { - return base.CanRenewLockAsync(); - } - [Fact] public override Task CanHandleErrorInWorkerAsync() { @@ -136,7 +148,7 @@ public override Task CanAutoCompleteWorkerAsync() return base.CanAutoCompleteWorkerAsync(); } - [RetryFact] + [Fact] public override Task CanHaveMultipleQueueInstancesAsync() { return base.CanHaveMultipleQueueInstancesAsync(); @@ -155,27 +167,21 @@ public override Task CanRunWorkItemWithMetricsAsync() } [Fact] - public override Task CanAbandonQueueEntryOnceAsync() + public override Task CanRenewLockAsync() { - return base.CanAbandonQueueEntryOnceAsync(); + return base.CanRenewLockAsync(); } [Fact] - public override Task CanCompleteQueueEntryOnceAsync() + public override Task CanAbandonQueueEntryOnceAsync() { - return base.CanCompleteQueueEntryOnceAsync(); + return base.CanAbandonQueueEntryOnceAsync(); } [Fact] - public override Task CanHandleAutoAbandonInWorker() - { - return base.CanHandleAutoAbandonInWorker(); - } - - [Fact(Skip = "Need to fix some sort of left over metrics from other tests issue")] - public override Task CanUseQueueOptionsAsync() + public override Task CanCompleteQueueEntryOnceAsync() { - return base.CanUseQueueOptionsAsync(); + return base.CanCompleteQueueEntryOnceAsync(); } [RetryFact] @@ -198,6 +204,30 @@ public override async Task CanHaveMultipleQueueInstancesWithLockingAsync() await CanHaveMultipleQueueInstancesWithLockingImplAsync(distributedLock); } + [Fact] + public override Task MaintainJobNotAbandon_NotWorkTimeOutEntry() + { + return base.MaintainJobNotAbandon_NotWorkTimeOutEntry(); + } + + [Fact] + public override Task VerifyRetryAttemptsAsync() + { + return base.VerifyRetryAttemptsAsync(); + } + + [Fact] + public override Task VerifyDelayedRetryAttemptsAsync() + { + return base.VerifyDelayedRetryAttemptsAsync(); + } + + [Fact] + public override Task CanHandleAutoAbandonInWorker() + { + return base.CanHandleAutoAbandonInWorker(); + } + [Fact] public async Task VerifyCacheKeysAreCorrect() { @@ -687,18 +717,6 @@ await queue.StartWorkingAsync(async workItem => _logger.LogTrace("# Keys: {0}", muxer.CountAllKeysAsync()); } - [Fact] - public override Task VerifyRetryAttemptsAsync() - { - return base.VerifyRetryAttemptsAsync(); - } - - [Fact] - public override Task VerifyDelayedRetryAttemptsAsync() - { - return base.VerifyDelayedRetryAttemptsAsync(); - } - [Fact] public async Task CanHaveDifferentMessageTypeInQueueWithSameNameAsync() { diff --git a/tests/Foundatio.Redis.Tests/Storage/RedisFileStorageTests.cs b/tests/Foundatio.Redis.Tests/Storage/RedisFileStorageTests.cs index 6754c54..66abf0e 100644 --- a/tests/Foundatio.Redis.Tests/Storage/RedisFileStorageTests.cs +++ b/tests/Foundatio.Redis.Tests/Storage/RedisFileStorageTests.cs @@ -32,6 +32,12 @@ public override Task CanGetFileListForSingleFolderAsync() return base.CanGetFileListForSingleFolderAsync(); } + [Fact] + public override Task CanGetFileListForSingleFileAsync() + { + return base.CanGetFileListForSingleFileAsync(); + } + [Fact] public override Task CanGetPagedFileListForSingleFolderAsync() { @@ -127,4 +133,16 @@ public override Task WillRespectStreamOffsetAsync() { return base.WillRespectStreamOffsetAsync(); } + + [Fact(Skip = "Write Stream is not yet supported")] + public override Task WillWriteStreamContentAsync() + { + return base.WillWriteStreamContentAsync(); + } + + [Fact] + public override Task CanSaveOverExistingStoredContent() + { + return base.CanSaveOverExistingStoredContent(); + } }