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 e379032
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pkg/backend/redis/redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,27 @@ 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 % chunkSizeInGet != 0
// numOfTasks % chunkSizeInDelete != 0
numOfTasks := 1234567
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 e379032

Please sign in to comment.