kaocha

Official support channel: https://clojureverse.org/c/projects/kaocha
zilti 2020-11-06T14:48:18.056300Z

What can be reasons that kaocha-cucumber runs fine on one machine, but gives cucumber.runtime.DuplicateStepDefinitionException: Duplicate step definitions in etaoin_steps.clj:71 and /srv/gitlab-runner/builds/nD_yDFbL/0/sompani/the-network/test/step_definitions/etaoin_steps.clj:71` on the other? The other is a VM where the tests get triggered by GitLab Runner, on my machine I start it manually. • On both, I am running clojure -A:dev:test:run-tests. • They both run the same OS, same OS version, same Java version, same Clojure CLI tools version. • Both use the exact same tests.edn

plexus 2020-11-06T16:04:07.056800Z

that doesn't immediately ring a bell... what's on etaoin_steps.clj:71

plexus 2020-11-09T11:18:02.058600Z

all very interesting! this is where we actually load these files https://github.com/lambdaisland/kaocha-cucumber/blob/v0.0-53/src/lambdaisland/cucumber/jvm.clj#L137-L141

plexus 2020-11-09T11:23:48.058900Z

and I think from there this is the logic to get the resources, so it does kind of weird thing where we give it an explicit path to look in, but it also checks the classpath https://github.com/cucumber/cucumber-jvm/blob/e09d1470d301853032ad7de3859fe8feff945607/core/src/main/java/cucumber/runtime/io/MultiLoader.java#L18-L24

plexus 2020-11-09T11:24:18.059200Z

and I'm guessing for some reason that isClasspathPath(path) is failing

zilti 2020-11-12T10:28:00.068900Z

Hmm. Any idea what I could poke to get more helpful info from my Kaocha setup? Or any idea on how to solve this?

zilti 2020-11-12T20:44:03.073200Z

I suspect that the reason could be that it is ran by GitLab Runner?

zilti 2020-11-06T16:31:14.056900Z

The last step definition of the file:

(Then "the user doesn't see {string}" [state obj]
      (wait @browser 4)
      (is (not (exists? @browser {:name obj})))
      state)

plexus 2020-11-06T16:34:04.057100Z

could it be the etaoin_steps.clj file is on the classpath twice? I'm just speculating here, but looking at that error it seems it's loading it once with a relative path and once with an absolute path... Maybe put some printlns in there, see if it's being loaded twice

zilti 2020-11-06T16:57:13.057300Z

Yes, it obviously does get loaded twice onto the classpath. But the question is: why? Why only on the server, but not locally on the almost identical system? Yes, the path is in two places - in tests.edn under :cucumber/glue-paths ["test/step_definitions"] and as an entry under :extra-paths for the :test alias.

zilti 2020-11-06T16:57:51.057500Z

Of course next thought would be to remove it from the :extra-paths. That works - locally. On the server, this gives me: Could not locate etaoin_steps__init.class, etaoin_steps.clj or etaoin_steps.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.`

zilti 2020-11-06T17:00:09.057700Z

The alternative to this is to remove the path from cucumber/glue-paths instead - and again, that works locally, but not on the server And interestingly enough, this is not an issue specific to this server - this is 1:1 the same behaviour I saw when we used a FreeBSD 12.1 server with OpenJDK 14. This now is openSUSE Leap 15.2 with OpenJDK 11.