Fork me on GitHub
#kaocha
<
2020-06-11
>
plexus08:06:26

ERROR: Error in reporter probably means it's a Kaocha bug. Congratulations! šŸ™‚

plexus08:06:14

hmmm having a better look at your stack trace maybe it's not a Kaocha bug, I think this line is clojure.test is involved

(println "  actual:" (pr-str (:actual m)))))
The printing is causing a lazy seq to be realized, which ends up calling into your code again (`dad.db.export/split-record` -> dad.db.export/add-fk), and there you are doing an (assoc m k v) where you are expecting m to be a map, but it's actually a vector

plexus08:06:22

asking questions here is fine btw, it's what everyone does šŸ™‚

avi13:06:38

Thanks Arne!

avi13:06:32

If itā€™s a bug in clojure.test then why donā€™t I see something similar when I run the test var directly? Ah, maybe itā€™s something in the clojure.test ā€œfind-and-run-some-testsā€ facility? Iā€™ll try thatā€¦

avi13:06:06

Ah, Iā€™ve already fixed the bug in my code so I need to backtrack to find the commit that caused the problemā€¦ šŸ˜…

plexus18:06:03

The Clojure test reporting is definitely strange because you're only getting the "expected" part. There should be a line after that starting with "Actual:". If that's not there then my guess is clojure.test is swallowing the exception

avi18:06:35

Ahā€¦ okā€¦ soā€¦ do I report a bug somewhere?

avi18:06:14

Iā€™m a little fuzzy on how to report bugs in Clojure right nowā€¦ I know feature requests go to the ā€œaskā€ site. Maybe I should post the problem to #testing ?

plexus18:06:06

See if you can make a minimal reproduction. If my guess is correct then creating a lazy-seq that throws and using that in the first position of (is (=)) should be enough. I can try it out tomorrow as well.

plexus18:06:36

Actually it's perhaps a little more involved, you'd have to make sure the equality check doesn't throw, but the printing does...

plexus18:06:48

It's a pretty niche edge case :)

avi18:06:14

šŸ˜“

plexus18:06:00

I'll test it out when I get a chance. I may be widely off with my speculation but it's the only theory I have that would explain what you're seeing

avi18:06:11

ok, thank you!

plexus18:06:43

Not at a computer now so I can't try it out but it would look something like this (is (= [0 (lazy-seq (throw (Exception.)))] [1]))

plexus18:06:43

The equality check should just return false because it short circuits after comparing the first element, but printing would throw

plexus19:06:08

user> (deftest foo-test (is (= [0 (lazy-seq (throw (java.lang.IllegalArgumentException.)))] [1])))
#'user/foo-test
user> (foo-test)

FAIL in (foo-test) (NO_SOURCE_FILE:187)
expected: (= [0 (lazy-seq (throw (java.lang.IllegalArgumentException.)))] [1])

ERROR in (foo-test) (NO_SOURCE_FILE:187)
expected: (= [0 (lazy-seq (throw (java.lang.IllegalArgumentException.)))] [1])
  actual: java.lang.IllegalArgumentException: null
 at user$fn__15257$fn__15258.invoke (NO_SOURCE_FILE:187)
    clojure.lang.LazySeq.sval (LazySeq.java:42)
    clojure.lang.LazySeq.seq (LazySeq.java:51)
I'm not immediately able to reproduce the problem you're seeing...

plexus19:06:20

Is that snippet you shared at the beginning really the full output you're getting from (dad.db.export-test/split-record)?

avi19:06:23

I believe it was; Iā€™ll have to back-track and try to reproduce it

avi19:06:07

This is the branch Iā€™m working on right now šŸ˜…

avi19:06:32

(every single commit message is just WIP++ šŸ˜¬)

rgm23:06:08

Wonder if this is more tractable in Clojure than Ruby: https://engineering.shopify.com/blogs/engineering/spark-joy-by-running-fewer-tests ... be a neat add-on for Kaocha.

rgm23:06:13

TL;DR: theyā€™re making up a call graph for every test, and when your code changes any call in the graph, that gets used to figure out which tests should run.

rgm23:06:47

(The full suite happens before deploy; this happens to speed up PR merging).