Skip to content

Commit

Permalink
add test to delete large queue
Browse files Browse the repository at this point in the history
  • Loading branch information
shioshiota committed Sep 8, 2021
1 parent f04fb8c commit f2b8503
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/backend/redis/redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
})
})
})
})

Expand Down

0 comments on commit f2b8503

Please sign in to comment.