This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-26
Channels
- # announcements (2)
- # babashka (9)
- # beginners (95)
- # calva (4)
- # circleci (2)
- # clj-kondo (5)
- # clojure (57)
- # clojure-berlin (2)
- # clojure-conj (3)
- # clojure-europe (6)
- # clojure-italy (14)
- # clojure-nl (3)
- # clojure-switzerland (5)
- # clojure-uk (32)
- # clojuredesign-podcast (5)
- # clojurescript (29)
- # clojutre (16)
- # code-reviews (6)
- # data-science (6)
- # datomic (9)
- # fulcro (33)
- # graalvm (2)
- # jobs (1)
- # jvm (1)
- # kaocha (6)
- # leiningen (4)
- # off-topic (3)
- # re-frame (31)
- # reagent (16)
- # reitit (22)
- # remote-jobs (2)
- # shadow-cljs (70)
- # spacemacs (19)
- # sql (9)
- # tools-deps (13)
- # xtdb (2)
- # yada (3)
I am looking at how I could use http://testcontainers.org to automate Postgres testing
If I can rewrite the jdbc url from
jdbc:
to
jdbc:tc:
then test containers should hook itself up
but then I need to get clojure.java.jdbc
to be aware of the tc
subprotocol
https://github.com/clojure/java.jdbc/blob/1f1ff8144b4a9a4447b2a2fbb9e592f90ccd2659/src/main/clojure/clojure/java/jdbc.clj#L172-L179
seems to have its protocols locked down as private
is there an official way to extend with new protocols ?
well my goal would be to not use jdbc URLs either, but something more like
(jdbc/with-db-connection [db {:dbtype "tc:postgres",
:host "localhost",
:port "5432",
:user "testuser",
:password "testpassword",
:dbname "testdatabase"}]
...
This is a lot easier (and better documented) in next.jdbc
...
ooh I failed to spot that
thanks
Also may be useful for PostgreSQL testing: there's an embedded PostgreSQL database library, which is what next.jdbc
uses. See https://github.com/seancorfield/next-jdbc/blob/master/test/next/jdbc/test_fixtures.clj#L53 (code to start an in-memory instance) and https://github.com/seancorfield/next-jdbc/blob/master/deps.edn#L17 (dependency for it)
com.opentable.components/otj-pg-embedded
I'll take a look at thatThis is a lot easier (and better documented) in next.jdbc
...