Make command-test pass

This commit is contained in:
Michael Klishin 2015-05-11 01:19:47 +03:00
parent 2be051289f
commit 26be7bb1b9
2 changed files with 11 additions and 11 deletions

View file

@ -17,7 +17,7 @@
* http://clojuremongodb.info/articles/updating.html
* http://clojuremongodb.info/articles/commands.html
* http://clojuremongodb.info/articles/mapreduce.html"
(:import [com.mongodb WriteResult])
(:import [com.mongodb WriteResult CommandResult])
(:require monger.conversion))
;;
@ -35,4 +35,9 @@
(.wasAcknowledged result))
(updated-existing?
[^WriteResult result]
(.isUpdateOfExisting result)))
(.isUpdateOfExisting result))
CommandResult
(acknowledged?
[^CommandResult result]
(.ok result)))

View file

@ -11,24 +11,19 @@
(deftest ^{:command true} test-reindex-collection
(let [_ (mc/insert db "test" {:name "Clojure"})
result (mcom/reindex-collection db "test")]
(is (acknowledged? result))
(is (get result "indexes"))))
(is (acknowledged? result))))
(deftest ^{:command true} test-server-status
(let [status (mcom/server-status db)]
(is (acknowledged? status))
(is (not-empty status))
(is (get status "serverUsed"))))
(is (not-empty status))))
(deftest ^{:command true} test-top
(let [result (mcom/top conn)]
(is (acknowledged? result))
(is (not-empty result))
(is (get result "serverUsed"))))
(is (not-empty result))))
(deftest ^{:command true} test-running-is-master-as-an-arbitrary-command
(let [raw (mg/command db {:isMaster 1})
result (from-db-object raw true)]
(is (acknowledged? result))
(is (acknowledged? raw))
(is (:ismaster result)))))
(is (acknowledged? raw)))))