This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-30
Channels
- # babashka (46)
- # beginners (234)
- # bristol-clojurians (4)
- # cider (7)
- # clj-kondo (39)
- # cljdoc (8)
- # cljs-dev (10)
- # cljsjs (10)
- # cljsrn (24)
- # clojure (84)
- # clojure-brasil (7)
- # clojure-europe (12)
- # clojure-germany (4)
- # clojure-italy (3)
- # clojure-nl (41)
- # clojure-spec (17)
- # clojure-uk (66)
- # clojurescript (64)
- # conjure (161)
- # cursive (12)
- # data-science (45)
- # datomic (20)
- # devops (11)
- # docker (2)
- # duct (9)
- # events (7)
- # figwheel (1)
- # figwheel-main (20)
- # fulcro (32)
- # graalvm (5)
- # helix (82)
- # jackdaw (9)
- # jobs-discuss (19)
- # kaocha (11)
- # local-first-clojure (1)
- # malli (6)
- # meander (3)
- # nrepl (12)
- # off-topic (2)
- # other-lisps (15)
- # pathom (14)
- # rdf (6)
- # re-frame (8)
- # reactive (1)
- # reagent (5)
- # reitit (4)
- # rum (3)
- # shadow-cljs (77)
- # spacemacs (3)
- # sql (9)
- # test-check (31)
- # tools-deps (13)
- # vim (62)
- # xtdb (18)
Do any of you Ductors have tips on how to set up integration tests on a Duct/Ataraxy API? Ideally, within a test, I'd be able to send a mock request like {:uri "/something", :action :get}
to some local handler and also be able to rollback the DB transaction after each test. I have a really complicated version of the former working, but it doesn't respect the j/set-rollback-only!
that I pass it, and I figured there must be someone else on here who knows how to pull it off.
(This would include passing through middleware, because my Ataraxy routes expect, for example, body-params
or session
)
Alright, I've thrown in the towel on this one. Just gonna test routes separately from handlers and call it a day - that gives me the same amount of confidence.
Hi @U4GBG4PUY. Do you have rollbacks working in other system tests. Is this ataraxy specific?
We have some functions that we use in test fixtures that setup a system with rollbacks enabled. We basically take the “source” db connection and then wrap it with set-rollback-only!
Then we assoc that connection into each database component (boundary) that needs rollbacks enabled for that test. This is the only way that I’ve found that keeps the rollbacks working.
So we set up a new test system and enable rollbacks with a clojure.test
fixture as needed in each test namespace.
The assoc
ing of the txn wrapped source connection into other components has the been the key for me to make it all work.
This may be too abstract to discuss without code (which would be difficult to me to share quickly). Let me know if you decide to give it another shot and want to discuss further.
That makes sense, and I haven't tried that yet. Might I guess that you're doing that on the connection pool you get after init
ing duct.database.sql/hikaricp
(assuming you're using it), or am I way off?