diff --git a/project.clj b/project.clj index 3b4790e..f7dcb23 100644 --- a/project.clj +++ b/project.clj @@ -5,7 +5,7 @@ :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.11.1"] [integrant "0.8.0"] - [io.zonky.test/embedded-postgres "2.0.1"] + [io.zonky.test/embedded-postgres "2.0.4"] [org.clojure/tools.logging "1.2.4"] [org.clojure/tools.namespace "1.3.0"] [org.slf4j/slf4j-jdk14 "2.0.1"]] diff --git a/test/pg_embedded_clj/custom_test.clj b/test/pg_embedded_clj/custom_test.clj index daee16a..c7467cc 100644 --- a/test/pg_embedded_clj/custom_test.clj +++ b/test/pg_embedded_clj/custom_test.clj @@ -22,10 +22,21 @@ 54321 "/postgres") :user "postgres"}) + +(defn extract-postgres-version [input] + (if input + (if-let [matches (re-matches #".*PostgreSQL (\d+\.\d+).*" input)] + (second matches) + "Version not found") + "No postgres result input")) + (deftest can-wrap-around (testing "using custom port" - (is (= {:version "PostgreSQL 14.5 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4, 64-bit"} - (first (jdbc/query db-spec ["select version()"]))))) + (is (= (some-> (jdbc/query db-spec ["select version()"]) + first + :version + extract-postgres-version) + "14.8"))) (testing "using custom log redirect" (is (= true (.exists (io/as-file "wibble.log")))))) diff --git a/test/pg_embedded_clj/default_test.clj b/test/pg_embedded_clj/default_test.clj index 03c461f..5353445 100644 --- a/test/pg_embedded_clj/default_test.clj +++ b/test/pg_embedded_clj/default_test.clj @@ -18,7 +18,18 @@ 5432 "/postgres") :user "postgres"}) + +(defn extract-postgres-version [input] + (if input + (if-let [matches (re-matches #".*PostgreSQL (\d+\.\d+).*" input)] + (second matches) + "Version not found") + "No postgres result input")) + (deftest can-wrap-around (testing "using defaults" - (is (= {:version "PostgreSQL 14.5 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4, 64-bit"} - (first (jdbc/query db-spec ["select version()"])))))) + (is (= (some-> (jdbc/query db-spec ["select version()"]) + first + :version + extract-postgres-version) + "14.8"))))