powderkeg

viesti 2017-03-12T07:53:31.815818Z

yup

viesti 2017-03-12T07:54:12.816860Z

didn’t figure out what is different with lein test to saying in a repl (run-tests ‘powderkeg.integration-test)

viesti 2017-03-12T07:54:30.817335Z

classloader thing maybe

viesti 2017-03-12T07:54:42.817630Z

since: Unable to find class: powderkeg.core$may_unmap_tuple2$fn__3729

cgrand 2017-03-12T07:56:00.819504Z

Show me the ns form for the test ns

cgrand 2017-03-12T08:03:11.831038Z

It's most certainly due to a behavior of ouroboros that could be improved: it has to be one of the earliest loaded namespace.

cgrand 2017-03-12T08:03:39.831759Z

Maybe lein messes with loading order.

cgrand 2017-03-12T08:14:09.847939Z

Hmm not sure since the missing class is in keg core. And keg core requires ouroboros.

viesti 2017-03-12T12:04:08.217536Z

tried this:

0% cat run-integration-test.clj
(require 'clojure.test)
(require 'powderkeg.integration-test)
(clojure.test/run-tests ‘powderkeg.integration-test)

viesti 2017-03-12T12:04:58.219084Z

folowed by

java -cp `lein with-profile +test classpath` clojure.main run-integration-test.clj

viesti 2017-03-12T12:05:06.219419Z

and get the same error

viesti 2017-03-12T12:06:02.221250Z

but if I just do

0% java -cp `lein with-profile +test classpath` clojure.main
Clojure 1.8.0
user=> (load-file “run-integration-test.clj”)

viesti 2017-03-12T12:06:08.221435Z

this seems to work

viesti 2017-03-12T12:06:19.221748Z

stuff works different in repl 🙂

cgrand 2017-03-12T12:06:49.222630Z

Locally?

viesti 2017-03-12T12:07:11.223293Z

on my machine, yes

cgrand 2017-03-12T12:15:04.237837Z

I'll have a look at it tomorrow. No clue at the moment.

viesti 2017-03-12T12:22:11.250690Z

yep, might be with the kids now 🙂

viesti 2017-03-12T13:01:03.320232Z

interesting:

java -cp `lein with-profile +test classpath` clojure.main -i run-integration-test.clj -r
makes the test work, though one ends up in a repl afterwards

viesti 2017-03-12T13:53:30.423059Z

so hacked a bit more, tried this: snipplet

(let [cl (.getContextClassLoader (Thread/currentThread))]
  (.setContextClassLoader (Thread/currentThread) (clojure.lang.DynamicClassLoader. cl)))
from https://github.com/clojure/clojure/blob/master/src/clj/clojure/main.clj#L220-L221

viesti 2017-03-12T13:54:09.424239Z

this seems to work:

0% cat run-integration-test.clj
(let [cl (.getContextClassLoader (Thread/currentThread))]
  (.setContextClassLoader (Thread/currentThread) (clojure.lang.DynamicClassLoader. cl)))
(require 'clojure.test)
(require 'powderkeg.integration-test)
(clojure.test/run-tests 'powderkeg.integration-test)
(System/exit 0)
0% java -cp `lein with-profile +test classpath` clojure.main run-integration-test.clj

viesti 2017-03-12T14:34:10.512238Z

so didn’t want to stop hacking, but learned that clojure.lang.DynamicClassLoader seems to be needed, simplistic test that runs Spark 2 with docker seems to work now: https://circleci.com/gh/viesti/powderkeg/9