From 9cd9524ae2eab26694eceafab882f4396f6e804e Mon Sep 17 00:00:00 2001 From: Josip Gracin Date: Sun, 15 Sep 2019 17:31:30 +0200 Subject: [PATCH] Fix issue #192 in topics-ready? - dereferencing deferred Signed-off-by: Josip Gracin --- src/jackdaw/admin.clj | 2 +- test/jackdaw/admin_test.clj | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/jackdaw/admin.clj b/src/jackdaw/admin.clj index 43f79e65..6a33517d 100644 --- a/src/jackdaw/admin.clj +++ b/src/jackdaw/admin.clj @@ -154,7 +154,7 @@ [^AdminClient client topics] {:pre [(client? client) (sequential? topics)]} - (->> (describe-topics* client (map :topic-name topics)) + (->> @(describe-topics* client (map :topic-name topics)) (every? (fn [[topic-name {:keys [partition-info]}]] (every? (fn [part-info] (and (boolean (:leader part-info)) diff --git a/test/jackdaw/admin_test.clj b/test/jackdaw/admin_test.clj index bfb4c9d9..2d6222e8 100644 --- a/test/jackdaw/admin_test.clj +++ b/test/jackdaw/admin_test.clj @@ -108,6 +108,12 @@ (is (set= [:cluster-id :controller :nodes] (keys (admin/describe-cluster client))))))) +(deftest test-topics-ready? + (with-mock-admin-client test-cluster + (fn [client] + (admin/create-topics! client (vals test-topics)) + (is (admin/topics-ready? client (vals test-topics)))))) + (deftest test-partition-ids-of-topics (with-mock-admin-client test-cluster (fn [client]