1

I am using the clojure maven plugin to build a project. The projects contains a test, let us say mytest.clj, that has a content like the following:

(def ^:dynamic *server*
  (create-server "tcp://bla.bla:9999"))

(deftest blabla1...)
(deftest blabla2...)

If I run mvn clojure:test , the build runs successfully.

But If I run mvn install then when the test phase is reached, the server declared in mytest.clj is started. After that start, nothing more happens: the clojure test script seems to be frozen and building of the project cannot be continued (without any error message): Maven just hangs. Although, as already said, mvn clojure:test runs successfully for the same project.

Does somebody know how to solve this problem?

Any help will be appreciated. Thx in advance Regards

Horace

P.S: I can use the standard mvn install to compile and test the clojure sources because my project's packaging is configured as a 'clojure' one in pom.xml. The consequence of it, is that the clojure maven plugin then automatically binds itself to the maven phases compile, test and test-compile.

1 Answer 1

1

The problem is you are starting a server when the tests are run, but you are not shutting down that server when everything is finished.

You'll want to use fixtures to make sure you're killing any threads/agents/servers you start in the test.

See Clojure: How To use-fixtures in Testing

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.