From f2b8503401d9719b8cf674d5b4c53c79def46ce6 Mon Sep 17 00:00:00 2001 From: Tetsuya Shiota Date: Wed, 8 Sep 2021 17:39:41 +0900 Subject: [PATCH] add test to delete large queue --- pkg/backend/redis/redis_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pkg/backend/redis/redis_test.go b/pkg/backend/redis/redis_test.go index d097d55..1ca3485 100644 --- a/pkg/backend/redis/redis_test.go +++ b/pkg/backend/redis/redis_test.go @@ -278,6 +278,26 @@ var _ = Describe("Backend", func() { Expect(err).To(Equal(iface.TaskQueueNotFound)) }) }) + When("the large queue exists", func() { + It("can delete the queue", func() { + queue := testutil.MustCreateQueue(backend, SampleQueueSpec) + // numOfTasks % chunkSize != 0 && numOfTasks > chunkSize + numOfTasks := 12345 + for i := 0; i < numOfTasks; i++ { + _, err := backend.AddTask(context.Background(), QueueName, SampleTaskSpec) + Expect(err).NotTo(HaveOccurred()) + } + + Expect(backend.DeleteQueue(context.Background(), SampleQueueSpec.Name)).NotTo(HaveOccurred()) + + queuesHash, err := client.HGetAll(backend.allQueuesKey()).Result() + Expect(err).NotTo(HaveOccurred()) + Expect(len(queuesHash)).To(Equal(0)) + keys, err := client.Keys(backend.queueKey(queue.UID.String()) + "*").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(len(keys)).To(Equal(0)) + }) + }) }) })