Cleanup, ensure Clojure types instead of Java types

This commit is contained in:
Rob Hanlon 2020-08-04 12:17:07 -07:00
parent d9e9b9724d
commit 92386aa9cf
No known key found for this signature in database
GPG key ID: 14C05B6156CB50E6

View file

@ -16,22 +16,22 @@
[{:keys [container exposed-ports env-vars command]}] [{:keys [container exposed-ports env-vars command]}]
(.setExposedPorts container (map int exposed-ports)) (.setExposedPorts container (map int exposed-ports))
(when (some? env-vars) (run! (fn [[k v]] (.addEnv container k v)) env-vars)
(doseq [pair env-vars]
(.addEnv container (first pair) (second pair))))
(when (some? command) (when command
(.setCommand container command)) (.setCommand container command))
{:container container {:container container
:exposed-ports (.getExposedPorts container) :exposed-ports (vec (.getExposedPorts container))
:env-vars (.getEnvMap container) :env-vars (into {} (.getEnvMap container))
:host (.getHost container)}) :host (.getHost container)})
(defn create (defn create
"Creates a generic testcontainer and sets its properties" "Creates a generic testcontainer and sets its properties"
[{:keys [image-name] :as options}] [{:keys [image-name] :as options}]
(init (assoc options :container (GenericContainer. image-name)))) (->> (GenericContainer. image-name)
(assoc options :container)
init))
(defn map-classpath-resource! (defn map-classpath-resource!
"Maps a resource in the classpath to the given container path. Should be called before starting the container!" "Maps a resource in the classpath to the given container path. Should be called before starting the container!"