aboutsummaryrefslogtreecommitdiff
path: root/test/com/github/ivarref/yoltq
diff options
context:
space:
mode:
authorStefan van den Oord <stefan@medicinemen.eu>2024-06-14 16:08:59 +0200
committerStefan van den Oord <stefan@medicinemen.eu>2024-06-14 16:08:59 +0200
commit85d13545275678a1077b9600fce136ae10dcb809 (patch)
tree66acd3b2d5933de18945dd8d34420199bb27046e /test/com/github/ivarref/yoltq
parentUpdate dependency to use the new free Datomic version (diff)
downloadfiinha-85d13545275678a1077b9600fce136ae10dcb809.tar.gz
fiinha-85d13545275678a1077b9600fce136ae10dcb809.tar.xz
#3 Add optional batch name to queue jobs
Diffstat (limited to 'test/com/github/ivarref/yoltq')
-rw-r--r--test/com/github/ivarref/yoltq/virtual_test.clj22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/com/github/ivarref/yoltq/virtual_test.clj b/test/com/github/ivarref/yoltq/virtual_test.clj
index 2800c21..7621b13 100644
--- a/test/com/github/ivarref/yoltq/virtual_test.clj
+++ b/test/com/github/ivarref/yoltq/virtual_test.clj
@@ -450,3 +450,25 @@
@(d/transact conn [(yq/put :q "asdf")])
(tq/consume! :q)
(is (= @got-work "asdf"))))
+
+(deftest batch-of-jobs-test
+ (let [conn (u/empty-conn)]
+ (yq/init! {:conn conn})
+ (yq/add-consumer! :q1 identity)
+ (yq/add-consumer! :q2 identity)
+ @(d/transact conn [(yq/put :q1 {:work 123} {:batch-name :b1})
+ (yq/put :q1 {:work 456} {:batch-name :b2})
+ (yq/put :q2 {:work 789} {:batch-name :b1})])
+ (is (= [{:qname :q1
+ :batch-name :b1
+ :status :init
+ :count 1}]
+ (yq/batch-progress :q1 :b1)))
+
+ (is (= {:work 123} (tq/consume! :q1)))
+
+ (is (= [{:qname :q1
+ :batch-name :b1
+ :status :done
+ :count 1}]
+ (yq/batch-progress :q1 :b1)))))