Skip to content

Commit

Permalink
improved some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoKramer committed Mar 5, 2020
1 parent 554fa11 commit 64b6a32
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 2 additions & 4 deletions test/bob/execution/internals_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@

(deftest container-kill
(testing "successful kill"
(with-redefs-fn {#'docker/client (constantly nil)
#'docker/invoke (constantly "")}
(with-redefs-fn {#'docker/invoke (constantly "")}
#(is (= "c1" (kill-container "c1")))))

(testing "unsuccessful kill"
(with-redefs-fn {#'docker/client (constantly nil)
#'docker/invoke (constantly "{:message \"Cannot kill container\"}")}
(with-redefs-fn {#'docker/invoke (constantly "{:message \"Cannot kill container\"}")}
#(let [result (kill-container "c1")]
(is (and (f/failed? result)
(= "Could not kill c1"
Expand Down
10 changes: 8 additions & 2 deletions test/bob/pipeline/internals_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@

(deftest next-step-execution
(testing "next images generation with resource mount"
(with-redefs-fn {#'e/commit-image (constantly "1212121212")
(with-redefs-fn {#'e/commit-image (fn [id cmd]
(tu/check-and-fail
#(and (= "id" id)
(= "hello" cmd))))
#'resourceful-step (constantly "img")
#'e/create-container (constantly "id")
#'e/delete-container (constantly nil)
Expand All @@ -114,7 +117,10 @@
"run-id")))))

(testing "next image generation without resource mount"
(with-redefs-fn {#'e/commit-image (constantly "1212121212")
(with-redefs-fn {#'e/commit-image (fn [id cmd]
(tu/check-and-fail
#(and (= "id" id)
(= "hello" cmd))))
#'resourceful-step (constantly "img")
#'e/create-container (constantly "id")
#'e/delete-container (constantly nil)
Expand Down

0 comments on commit 64b6a32

Please sign in to comment.