Initialized Dependencies and readme

This commit is contained in:
Tim Zöller 2020-06-04 10:58:10 +02:00
parent 92b2e27703
commit 99732b5765
3 changed files with 48 additions and 13 deletions

View file

@ -1,14 +1,20 @@
# clj-test-containers
A Clojure library designed to ... well, that part is up to you.
## What it is
This application is supposed to be a lightweight wrapper around the Testcontainers Java library.
## What it isn't
This library does not provide tools to include testcontainers in your testing lifecycle. As there are many different test tools with different approaches to testing in the clojure world, handling the lifecycle is up to you.
## Usage
FIXME
FIXME, if there is an API at all
## License
Copyright © 2020 FIXME
Copyright © 2020 Tim Zöller
Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.

View file

@ -3,15 +3,16 @@
(set-env! :resource-paths #{"resources" "src"}
:source-paths #{"test"}
:dependencies '[[org.clojure/clojure "RELEASE"]
[adzerk/boot-test "RELEASE" :scope "test"]])
:dependencies '[[org.clojure/clojure "1.10.1"]
[org.testcontainers/testcontainers "1.14.3"]
[metosin/bat-test "0.4.4" :scope "test"]])
(task-options!
pom {:project project
:version version
:description "FIXME: write description"
:url "http://example/FIXME"
:scm {:url "https://github.com/yourname/clj-test-containers"}
:description "A lightweight, unofficial wrapper around the Testcontainers Java library"
:url "https://github.com/javahippie/clj-test-containers"
:scm {:url "https://github.com/javahippie/clj-test-containers"}
:license {"Eclipse Public License"
"http://www.eclipse.org/legal/epl-v10.html"}})
@ -20,4 +21,4 @@
[]
(comp (pom) (jar) (install)))
(require '[adzerk.boot-test :refer [test]])
(require '[metosin.bat-test :refer (bat-test)])

View file

@ -1,6 +1,34 @@
(ns clj-test-containers.core)
(defn foo
"I don't do a whole lot."
[x]
(println x "Hello, World!"))
(defn init
"Sets the properties for a testcontainer instance"
[{image-name :image-name
exposed-ports :exposed-ports
env-vars :env-vars
command :command
fs-bind :file-system-bind
waiting-for :waiting-for
copy-file :copy-file-to-container
extra-host :extra-host
network :network
network-aliases :network-aliases
network-mode :network-mode
image-pull-policy :image-pull-policy
classpath-resource-mapping :classpath-resource-mapping
startup-timeout :startup-timeout
privileged-mode :privileged-mode
startup-check-strategy :startup-check-strategy
working-directory :working-directory
follow-ouptut :follow-output
log-consumer :log-consumer}]
(let [container (-> (org.testcontainers.containers.GenericContainer. image-name)
(.withExposedPorts (into-array Integer (map int exposed-ports)))
(.withEnv env-vars)
(as-> container
(if (some? command)
(.withCommand command)
container)))]
{:container container
:exposed-ports (.getExposedPorts container)
:env-vars (.getEnvMap container)
:host (.getHost container)}))