Use nginx Docker image for HTTP wait status test
This commit is contained in:
parent
e57261ce12
commit
fffb398918
1 changed files with 14 additions and 17 deletions
|
|
@ -1,11 +1,11 @@
|
||||||
(ns clj-test-containers.core-test
|
(ns clj-test-containers.core-test
|
||||||
(:require
|
(:require
|
||||||
[clj-test-containers.core :as sut]
|
[clj-test-containers.core :as sut]
|
||||||
[clojure.string :refer [includes?]]
|
[clojure.string :refer [includes?]]
|
||||||
[clojure.test :refer [deftest is testing]])
|
[clojure.test :refer [deftest is testing]])
|
||||||
(:import
|
(:import
|
||||||
(org.testcontainers.containers
|
(org.testcontainers.containers
|
||||||
PostgreSQLContainer)))
|
PostgreSQLContainer)))
|
||||||
|
|
||||||
(deftest create-test
|
(deftest create-test
|
||||||
(testing "Testing basic testcontainer generic image initialisation"
|
(testing "Testing basic testcontainer generic image initialisation"
|
||||||
|
|
@ -38,8 +38,8 @@
|
||||||
(let [container (sut/create {:image-name "postgres:12.2"
|
(let [container (sut/create {:image-name "postgres:12.2"
|
||||||
:exposed-ports [5432]
|
:exposed-ports [5432]
|
||||||
:env-vars {"POSTGRES_PASSWORD" "pw"}
|
:env-vars {"POSTGRES_PASSWORD" "pw"}
|
||||||
:wait-for {:wait-strategy :log
|
:wait-for {:wait-strategy :log
|
||||||
:message "accept connections"
|
:message "accept connections"
|
||||||
:startup-timeout 10}})
|
:startup-timeout 10}})
|
||||||
initialized-container (sut/start! container)
|
initialized-container (sut/start! container)
|
||||||
stopped-container (sut/stop! container)]
|
stopped-container (sut/stop! container)]
|
||||||
|
|
@ -65,18 +65,15 @@
|
||||||
(is (nil? (:mapped-ports stopped-container)))))
|
(is (nil? (:mapped-ports stopped-container)))))
|
||||||
|
|
||||||
(testing "Testing basic testcontainer generic image initialisation with wait for http"
|
(testing "Testing basic testcontainer generic image initialisation with wait for http"
|
||||||
(let [container (sut/create {:image-name "alpine:3.5"
|
(let [container (sut/create {:image-name "bitnami/nginx:1.22"
|
||||||
:network-aliases ["foo"]
|
:network-aliases ["foo"]
|
||||||
:command ["/bin/sh"
|
|
||||||
"-c"
|
|
||||||
"while true ; do printf 'HTTP/1.1 200 OK\\n\\nyay' | nc -l -p 8080; done"]
|
|
||||||
:exposed-ports [8080]
|
:exposed-ports [8080]
|
||||||
:wait-for {:wait-strategy :http
|
:wait-for {:wait-strategy :http
|
||||||
:path "/"
|
:path "/"
|
||||||
:port 8080
|
:port 8080
|
||||||
:method "GET"
|
:method "GET"
|
||||||
:status-codes [200]
|
:status-codes [200]
|
||||||
:headers {"Accept" "text/plain"}}})
|
:headers {"Accept" "text/plain"}}})
|
||||||
initialized-container (sut/start! container)
|
initialized-container (sut/start! container)
|
||||||
stopped-container (sut/stop! container)]
|
stopped-container (sut/stop! container)]
|
||||||
(is (some? (:id initialized-container)))
|
(is (some? (:id initialized-container)))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue