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
that doesn't immediately ring a bell... what's on etaoin_steps.clj:71
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
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
and I'm guessing for some reason that isClasspathPath(path)
is failing
Hmm. Any idea what I could poke to get more helpful info from my Kaocha setup? Or any idea on how to solve this?
I suspect that the reason could be that it is ran by GitLab Runner?
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)
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
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.
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.`
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.