Make command-test pass
This commit is contained in:
parent
2be051289f
commit
26be7bb1b9
2 changed files with 11 additions and 11 deletions
|
|
@ -17,7 +17,7 @@
|
||||||
* http://clojuremongodb.info/articles/updating.html
|
* http://clojuremongodb.info/articles/updating.html
|
||||||
* http://clojuremongodb.info/articles/commands.html
|
* http://clojuremongodb.info/articles/commands.html
|
||||||
* http://clojuremongodb.info/articles/mapreduce.html"
|
* http://clojuremongodb.info/articles/mapreduce.html"
|
||||||
(:import [com.mongodb WriteResult])
|
(:import [com.mongodb WriteResult CommandResult])
|
||||||
(:require monger.conversion))
|
(:require monger.conversion))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
@ -35,4 +35,9 @@
|
||||||
(.wasAcknowledged result))
|
(.wasAcknowledged result))
|
||||||
(updated-existing?
|
(updated-existing?
|
||||||
[^WriteResult result]
|
[^WriteResult result]
|
||||||
(.isUpdateOfExisting result)))
|
(.isUpdateOfExisting result))
|
||||||
|
|
||||||
|
CommandResult
|
||||||
|
(acknowledged?
|
||||||
|
[^CommandResult result]
|
||||||
|
(.ok result)))
|
||||||
|
|
|
||||||
|
|
@ -11,24 +11,19 @@
|
||||||
(deftest ^{:command true} test-reindex-collection
|
(deftest ^{:command true} test-reindex-collection
|
||||||
(let [_ (mc/insert db "test" {:name "Clojure"})
|
(let [_ (mc/insert db "test" {:name "Clojure"})
|
||||||
result (mcom/reindex-collection db "test")]
|
result (mcom/reindex-collection db "test")]
|
||||||
(is (acknowledged? result))
|
(is (acknowledged? result))))
|
||||||
(is (get result "indexes"))))
|
|
||||||
|
|
||||||
(deftest ^{:command true} test-server-status
|
(deftest ^{:command true} test-server-status
|
||||||
(let [status (mcom/server-status db)]
|
(let [status (mcom/server-status db)]
|
||||||
(is (acknowledged? status))
|
(is (acknowledged? status))
|
||||||
(is (not-empty status))
|
(is (not-empty status))))
|
||||||
(is (get status "serverUsed"))))
|
|
||||||
|
|
||||||
(deftest ^{:command true} test-top
|
(deftest ^{:command true} test-top
|
||||||
(let [result (mcom/top conn)]
|
(let [result (mcom/top conn)]
|
||||||
(is (acknowledged? result))
|
(is (acknowledged? result))
|
||||||
(is (not-empty result))
|
(is (not-empty result))))
|
||||||
(is (get result "serverUsed"))))
|
|
||||||
|
|
||||||
(deftest ^{:command true} test-running-is-master-as-an-arbitrary-command
|
(deftest ^{:command true} test-running-is-master-as-an-arbitrary-command
|
||||||
(let [raw (mg/command db {:isMaster 1})
|
(let [raw (mg/command db {:isMaster 1})
|
||||||
result (from-db-object raw true)]
|
result (from-db-object raw true)]
|
||||||
(is (acknowledged? result))
|
(is (acknowledged? raw)))))
|
||||||
(is (acknowledged? raw))
|
|
||||||
(is (:ismaster result)))))
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue