Prepare Release 0.3.0

This commit is contained in:
Tim Zöller 2020-10-23 23:12:24 +02:00
parent 94975f68f0
commit 193482c1b8
4 changed files with 120 additions and 110 deletions

View file

@ -1,10 +1,19 @@
# Change Log
All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
## [0.3.0] - Upcoming
## [0.4.0] - Upcoming
## [0.3.0] - 2020-10-23
### Added
- [#25](https://github.com/javahippie/clj-test-containers/issues/25): Add support for a container wait stategy
- [#35](https://github.com/javahippie/clj-test-containers/issues/35): Add support for docker version 2.4.0 - upgrading testcontainers-java version
- [#27](https://github.com/javahippie/clj-test-containers/issues/27): Add support for accessing container logs
- [#38](https://github.com/javahippie/clj-test-containers/pull/38): Add type hints to silence reflection warnings
- [#33](https://github.com/javahippie/clj-test-containers/pull/33): Add more options to the HTTP wait strategy
- [#28](https://github.com/javahippie/clj-test-containers/pull/28): Link to the java lib
- [#23](https://github.com/javahippie/clj-test-containers/pull/23): Configure clojure.spec, spec out a few functions
- [#24](https://github.com/javahippie/clj-test-containers/pull/24): cljstyle redux, with pre-commit hook
- [#21](https://github.com/javahippie/clj-test-containers/pull/21): Install and configure cljstyle
### Changed
- [#29](https://github.com/javahippie/clj-test-containers/issues/29): init-network should be called create-network!

208
README.md
View file

@ -62,26 +62,27 @@ Creates a testcontainers instance from a given Docker label and returns them
#### Config parameters:
| Key | Type | Description |
| ------------- |:------------- | :-----|
| `:image-name` | String, mandatory | The name and label of an image, e.g. `postgres:12.2` |
| `:exposed-ports` | Vector with ints, mandatory | All ports which should be exposed and mapped to a local port |
| `:env-vars` | Map | A map with environment variables|
| `:command` | Vector with strings | The start command of the container|
| `:network` | Map | A map containing the configuration of a Docker Network (see: `create-network`)|
| `:network-aliases` | Map | A list of alias names for the container on the network |
| `:wait-for` | Map | A map containing the wait strategy to use and the condition to check for|
| Key | Type | Description |
| ------------- | :------------- | :----- |
| `:image-name` | String, mandatory | The name and label of an image, e.g. `postgres:12.2` |
| `:exposed-ports` | Vector with ints, mandatory | All ports which should be exposed and mapped to a local port |
| `:env-vars` | Map | A map with environment variables |
| `:command` | Vector with strings | The start command of the container |
| `:network` | Map | A map containing the configuration of a Docker Network (see: `create-network`) |
| `:network-aliases` | Map | A list of alias names for the container on the network |
| `:wait-for` | Map | A map containing the wait strategy to use and the condition to check for |
| `:log-to` | Map | A map containing the log strategy to use, e.g. {:log-strategy string} |
#### Result:
| Key | Type | Description |
| ------------- |:------------- | :-----|
| `:container` | `org.testcontainers.containers.Container` | The Testcontainers instance, accessible for everything this library doesn't provide (yet) |
| `:exposed-ports` | Vector with ints | Value of the same input parameter |
| `:env-vars` | Map | Value of the same input parameter|
| `:host` | String | The host for the Docker Container|
| `:network` | Map | The network configuration of the Container, if provided|
| `:wait-for` | Map | The wait-for configuration of the Container, if provided!
| Key | Type | Description |
| ------------- | :------------- | :----- |
| `:container` | `org.testcontainers.containers.Container` | The Testcontainers instance, accessible for everything this library doesn't provide (yet) |
| `:exposed-ports` | Vector with ints | Value of the same input parameter |
| `:env-vars` | Map | Value of the same input parameter |
| `:host` | String | The host for the Docker Container |
| `:network` | Map | The network configuration of the Container, if provided |
| `:wait-for` | Map | The wait-for configuration of the Container, if provided! |
#### Example:
@ -115,25 +116,27 @@ Initializes a given Testcontainer, which was e.g. provided by a library
#### Config parameters:
| Key | Type | Description |
| ------------- |:------------- | :-----|
| `:container` | `org.testcontainers.containers.GenericContainer`, mandatory | The name and label of an image, e.g. `postgres:12.2` |
| `:exposed-ports` | Vector with ints, mandatory | All ports which should be exposed and mapped to a local port |
| `:env-vars` | Map | A map with environment variables|
| `:command` | Vector with strings | The start command of the container|
| `:network` | Map | A map containing the configuration of a Docker Network (see: `create-network`)|
| `:network-aliases` | Map | A list of alias names for the container on the network |
| `:wait-for` | Map | A map containing the wait strategy to use and the condition to check for|
| Key | Type | Description |
| ------------- | :------------- | :----- |
| `:container` | `org.testcontainers.containers.GenericContainer`, mandatory | The name and label of an image, e.g. `postgres:12.2` |
| `:exposed-ports` | Vector with ints, mandatory | All ports which should be exposed and mapped to a local port |
| `:env-vars` | Map | A map with environment variables |
| `:command` | Vector with strings | The start command of the container |
| `:network` | Map | A map containing the configuration of a Docker Network (see: `create-network`) |
| `:network-aliases` | Map | A list of alias names for the container on the network |
| `:wait-for` | Map | A map containing the wait strategy to use and the condition to check for |
| `:log-to` | Map | A map containing the log strategy to use, e.g. {:log-strategy string} |
| | | |
#### Result:
| Key | Type | Description |
| ------------- |:------------- | :-----|
| `:container` | `org.testcontainers.containers.Container` | The Testcontainers instance, accessible for everything this library doesn't provide (yet) |
| `:exposed-ports` | Vector with ints | Value of the same input parameter |
| `:env-vars` | Map | Value of the same input parameter|
| `:host` | String | The host for the Docker Container|
| `:network` | Map | The network configuration of the Container, if provided|
| `:wait-for` | Map | The wait-for configuration of the Container, if provided!
| Key | Type | Description |
| ------------- | :------------- | :----- |
| `:container` | `org.testcontainers.containers.Container` | The Testcontainers instance, accessible for everything this library doesn't provide (yet) |
| `:exposed-ports` | Vector with ints | Value of the same input parameter |
| `:env-vars` | Map | Value of the same input parameter |
| `:host` | String | The host for the Docker Container |
| `:network` | Map | The network configuration of the Container, if provided |
| `:wait-for` | Map | The wait-for configuration of the Container, if provided! |
#### Example:
@ -165,25 +168,27 @@ Creates a testcontainer from a Dockerfile
#### Config parameters:
| Key | Type | Description |
| ------------- |:------------- | :-----|
| `:docker-file` | String, mandatory | String containing a path to a Dockerfile |
| `:exposed-ports` | Vector with ints, mandatory | All ports which should be exposed and mapped to a local port |
| `:env-vars` | Map | A map with environment variables|
| `:command` | Vector with strings | The start command of the container|
| `:network` | Map | A map containing the configuration of a Docker Network (see: `create-network`)|
| `:network-aliases` | Map | A list of alias names for the container on the network |
| `:wait-for` | Map | A map containing the wait strategy to use and the condition to check for|
| Key | Type | Description |
| ------------- | :------------- | :----- |
| `:docker-file` | String, mandatory | String containing a path to a Dockerfile |
| `:exposed-ports` | Vector with ints, mandatory | All ports which should be exposed and mapped to a local port |
| `:env-vars` | Map | A map with environment variables |
| `:command` | Vector with strings | The start command of the container |
| `:network` | Map | A map containing the configuration of a Docker Network (see: `create-network`) |
| `:network-aliases` | Map | A list of alias names for the container on the network |
| `:wait-for` | Map | A map containing the wait strategy to use and the condition to check for |
| `:log-to` | Map | A map containing the log strategy to use, e.g. {:log-strategy string} |
| | | |
#### Result:
| Key | Type | Description |
| ------------- |:------------- | :-----|
| `:container` | `org.testcontainers.containers.Container` | The Testcontainers instance, accessible for everything this library doesn't provide (yet) |
| `:exposed-ports` | Vector with ints | Value of the same input parameter |
| `:env-vars` | Map | Value of the same input parameter|
| `:host` | String | The host for the Docker Container|
| `:network` | Map | The network configuration of the Container, if provided|
| `:wait-for` | Map | The wait-for configuration of the Container, if provided!
| Key | Type | Description |
| ------------- | :------------- | :----- |
| `:container` | `org.testcontainers.containers.Container` | The Testcontainers instance, accessible for everything this library doesn't provide (yet) |
| `:exposed-ports` | Vector with ints | Value of the same input parameter |
| `:env-vars` | Map | Value of the same input parameter |
| `:host` | String | The host for the Docker Container |
| `:network` | Map | The network configuration of the Container, if provided |
| `:wait-for` | Map | The wait-for configuration of the Container, if provided! |
#### Example:
@ -203,20 +208,21 @@ Starts the Testcontainer, which was defined by `create`
#### Config parameters:
| Key | Type | Description |
| ------------- |:------------- | :-----|
| First parameter: | | |
| `container-config`| Map, mandatory | Return value of the `create` function |
| Key | Type | Description |
| ------------- | :------------- | :----- |
| First parameter: | | |
| `container-config` | Map, mandatory | Return value of the `create` function |
| | | |
#### Result:
| Key | Type | Description |
| ------------- |:------------- | :-----|
| `:container` | `org.testcontainers.containers.Container` | The Testcontainers instance, accessible for everything this library doesn't provide (yet) |
| `:exposed-ports` | Vector with ints | Value of the same input parameter |
| `:env-vars` | Map | Value of the same input parameter|
| `:host` | String | The host for the Docker Container|
| `:id` | String | The ID of the started docker container|
| `:mapped-ports` | Map | A map containing the container port as key and the mapped local port as a value|
| Key | Type | Description |
| ------------- | :------------- | :----- |
| `:container` | `org.testcontainers.containers.Container` | The Testcontainers instance, accessible for everything this library doesn't provide (yet) |
| `:exposed-ports` | Vector with ints | Value of the same input parameter |
| `:env-vars` | Map | Value of the same input parameter |
| `:host` | String | The host for the Docker Container |
| `:id` | String | The ID of the started docker container |
| `:mapped-ports` | Map | A map containing the container port as key and the mapped local port as a value |
#### Example:
@ -236,10 +242,10 @@ Stops the Testcontainer, which was defined by `create`
#### Config parameters:
| Key | Type | Description |
| ------------- |:------------- | :-----|
| First parameter: | | |
| `container-config`| Map, mandatory | Return value of the `create` function |
| Key | Type | Description |
| ------------- | :------------- | :----- |
| First parameter: | | |
| `container-config` | Map, mandatory | Return value of the `create` function |
#### Result:
The `container-config`
@ -292,14 +298,14 @@ Binds a path from your local filesystem into the Docker container as a volume
#### Config parameters:
| Key | Type | Description |
| ------------- |:------------- | :-----|
| First parameter: | | |
| `container-config`| Map, mandatory | Return value of the `create` function |
| Second parameter: | | |
| `:host-path` | String , mandatory | Path on your local filesystem |
| `:container-path` | String, mandatory | Path, to which the resource should be mapped |
| `:mode` | Keyword, mandatory | `:read-only` or `:read-write` |
| Key | Type | Description |
| ------------- | :------------- | :----- |
| First parameter: | | |
| `container-config` | Map, mandatory | Return value of the `create` function |
| Second parameter: |   |   |
| `:host-path` | String , mandatory | Path on your local filesystem |
| `:container-path` | String, mandatory | Path, to which the resource should be mapped |
| `:mode` | Keyword, mandatory | `:read-only` or `:read-write` |
#### Result:
@ -350,21 +356,21 @@ Executes a command in the running container, and returns the result
#### Config parameters:
| Key | Type | Description |
| ------------- |:------------- | :-----|
| First parameter: | | |
| `container-config`| Map, mandatory | Return value of the `create` function |
| Second parameter: | | |
| `command` | Vector with Strings, mandatory | A vector containing the command and its parameters |
| Key | Type | Description |
| ------------- | :------------- | :----- |
| First parameter: | | |
| `container-config` | Map, mandatory | Return value of the `create` function |
| Second parameter: |   |   |
| `command` | Vector with Strings, mandatory | A vector containing the command and its parameters |
#### Result:
| Key | Type | Description |
| ------------- |:------------- | :-----|
| `:exit-code` | int | Exit code of the executed command |
| `:stdout` | String | Content of stdout |
| `:stdin` | String | Content of stdin |
| Key | Type | Description |
| ------------- | :------------- | :----- |
| `:exit-code` | int | Exit code of the executed command |
| `:stdout` | String | Content of stdout |
| `:stdin` | String | Content of stdin |
#### Example:
@ -378,20 +384,20 @@ Creates a network. The optional map accepts config values for enabling ipv6 and
#### Config parameters:
| Key | Type | Description |
| ------------- |:------------- | :-----|
| `:ipv6`| boolean | Should the network enable IPv6? |
| `:driver`| String | The network driver used by Docker, e.g. `bridge` or `host`
| Key | Type | Description |
| ------------- | :------------- | :----- |
| `:ipv6` | boolean | Should the network enable IPv6? |
| `:driver` | String | The network driver used by Docker, e.g. `bridge` or `host` |
#### Result:
| Key | Type | Description |
| ------------- |:------------- | :-----|
| `:network` | `org.testcontainers.containers.Network` | The instance of the network |
| `:name` | String | The name of the network |
| `:ipv6` | boolean | Does the network enable IPv6? |
| `:driver` | String | The network driver used |
| Key | Type | Description |
| ------------- | :------------- | :----- |
| `:network` | `org.testcontainers.containers.Network` | The instance of the network |
| `:name` | String | The name of the network |
| `:ipv6` | boolean | Does the network enable IPv6? |
| `:driver` | String | The network driver used |
#### Example:
@ -404,9 +410,13 @@ Creates a network. The optional map accepts config values for enabling ipv6 and
(create-network)
```
### dump-logs
Call on a started container.
Provided logging was enabled for a container, returns the given log presentation, e.g. as a string
| Key | Type | Description |
| `container-config` | Map, mandatory | The configuration describing the container for which the log should be retrieved |
## License
Copyright © 2020 Tim Zöller
Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.

View file

@ -1,4 +1,4 @@
(defproject clj-test-containers "0.3.0-SNAPSHOT"
(defproject clj-test-containers "0.3.0"
:description "A lightweight, unofficial wrapper around the Testcontainers Java library"
:url "https://github.com/javahippie/clj-test-containers"

View file

@ -27,15 +27,6 @@
(Thread/sleep 500)
(is (includes? (sut/dump-logs initialized-container) "database system is ready to accept connections"))))
(comment
(def cnt (sut/create {:image-name "postgres:12.2"
:exposed-ports [5432]
:env-vars {"POSTGRES_PASSWORD" "pw"}
:wait-for {:wait-strategy :log :message "accept connections"}
:log-to {:log-strategy :string}}))
(def cnt (sut/start! cnt))
(sut/dump-logs cnt))
(testing "Testing basic testcontainer generic image initialisation with wait for log message"
(let [container (sut/create {:image-name "postgres:12.2"
:exposed-ports [5432]