Skip to content

Commit

Permalink
switched to states
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoKramer committed Feb 23, 2020
1 parent 6d51bd2 commit c7a4c66
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/bob/states.clj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
(m/defstate docker-conn
:start (docker/connect {:uri "unix:///var/run/docker.sock"}))

(m/defstate images
:start (docker/client {:category :images :conn docker-conn}))

(m/defstate containers
:start (docker/client {:category :containers :conn docker-conn}))

(comment
(m/start)

Expand Down
6 changes: 2 additions & 4 deletions test/bob/execution/internals_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@

(deftest docker-image-presence
(testing "image present"
(with-redefs-fn {#'docker/client (constantly nil)
#'docker/invoke (constantly [{:RepoTags ["img"]}])}
(with-redefs-fn {#'docker/invoke (constantly [{:RepoTags ["img"]}])}
#(is (= "img" (has-image "img")))))

(testing "image absent"
(with-redefs-fn {#'docker/client (constantly nil)
#'docker/invoke (constantly [{:RepoTags ["foo"]}])}
(with-redefs-fn {#'docker/invoke (constantly [{:RepoTags ["foo"]}])}
#(let [result (has-image "img")]
(is (and (f/failed? result)
(= "Failed to find img"
Expand Down

0 comments on commit c7a4c66

Please sign in to comment.