Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement] global fixtures #409

Open
sirmspencer opened this issue Apr 14, 2023 · 3 comments
Open

[enhancement] global fixtures #409

sirmspencer opened this issue Apr 14, 2023 · 3 comments
Labels
documentation An issue or improvement related to documentation

Comments

@sirmspencer
Copy link

Here is a good write up of the problem https://stackoverflow.com/questions/43585325/clojure-test-global-fixtures.

TLDR is that things like connecting to a DB are slow and we don't want to do it for every namespace.

An alternative tool, circleci.test has added support for this. https://github.com/circleci/circleci.test#global-fixtures

Is there any plan to add something like this for koacha?

@alysbrooks alysbrooks moved this from Triage to 📋 Information Needed in Lambda Island Open Source Apr 18, 2023
@plexus
Copy link
Member

plexus commented May 31, 2023

Use the hooks plugin, this is the kind of thing it's there for.

@alysbrooks
Copy link
Member

alysbrooks commented May 31, 2023

I think we can convert this to a documentation issue—we've decided against adding global hooks, here's how we suggest using hooks in place of global fixtures, here's an example, etc.

In theory, you wouldn't need to use hooks at all, you could have a test namespace that declares a var with delay.

(def test-db (delay (let [db-params {:connection-uri "sqlite:////memory"}]
                               ;steps to set up database      
db-params)))

;In a test namespace:
(deftest some-db-test
   (testing insert-something 
           (jdbc/insert! @test-db ,,,)))

@alysbrooks
Copy link
Member

It might also be good to document this pattern in conjunction with our forthcoming parallel execution support. If namespaces are creating things that should only be accessed by one thread at a time, it could cause issues.

@alysbrooks alysbrooks added the documentation An issue or improvement related to documentation label Jun 26, 2023
@lambduhh lambduhh moved this from 📋 Information Needed to Candidate in Lambda Island Open Source Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation An issue or improvement related to documentation
Projects
Status: Candidate
Development

No branches or pull requests

3 participants