Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added hyperfidle rcf project #7

Closed
wants to merge 5 commits into from
Closed

Conversation

ieugen
Copy link

@ieugen ieugen commented Aug 26, 2022

@ieugen
Copy link
Author

ieugen commented Aug 26, 2022

Output is bellow.
It seems tests are not found / run at step: # test-statements:

clojure -Srepro -M:poly test project:rcf :verbose


Projects to run tests from: rcf

[polylith-kaocha] Bricks to test: (rcf)
[polylith-kaocha] Brick paths: (bases/rcf/src bases/rcf/test)
[polylith-kaocha] Path bases/rcf/src is a brick path to consider for Kaocha's test discovery
[polylith-kaocha] Path bases/rcf/test is a brick path to consider for Kaocha's test discovery
[polylith-kaocha] Path projects/rcf/test is NOT considered for Kaocha's test discovery
[polylith-kaocha] Path projects/rcf/test-resources is NOT considered for Kaocha's test discovery
# config:
{:mvn/repos {"central" {:url "https://repo1.maven.org/maven2/"}, "clojars" {:url "https://repo.clojars.org/"}}, :deps {com.hyperfiddle/rcf #:mvn{:version "20220405"}, lambdaisland/kaocha-cloverage #:mvn{:version "1.0.75"}, orchestra/orchestra #:mvn{:version "2021.01.01-1"}, org.clojure/test.check #:mvn{:version "1.1.1"}, polylith-kaocha/kaocha-wrapper #:local{:root "projects/rcf/../kaocha-wrapper"}}} 

# paths:
#{"projects/rcf/test" "/home/ieugen/.m2/repository/cloverage/cloverage/1.2.0/cloverage-1.2.0.jar" "/home/ieugen/.m2/repository/org/clojure/tools.namespace/0.3.1/tools.namespace-0.3.1.jar" "bases/rcf/test" "/home/ieugen/.m2/repository/org/clojure/data.xml/0.0.8/data.xml-0.0.8.jar" "/home/ieugen/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar" "/home/ieugen/.m2/repository/orchestra/orchestra/2021.01.01-1/orchestra-2021.01.01-1.jar" "/home/ieugen/.m2/repository/expound/expound/0.9.0/expound-0.9.0.jar" "/home/ieugen/.m2/repository/io/methvin/directory-watcher/0.15.0/directory-watcher-0.15.0.jar" "projects/rcf/test-resources" "/home/ieugen/.m2/repository/riddley/riddley/0.2.0/riddley-0.2.0.jar" "bases/rcf/src" "/home/ieugen/.m2/repository/org/tcrawley/dynapath/1.1.0/dynapath-1.1.0.jar" "/home/ieugen/.m2/repository/mvxcvi/puget/1.1.2/puget-1.1.2.jar" "/home/ieugen/.m2/repository/lambdaisland/tools.namespace/0.1.247/tools.namespace-0.1.247.jar" "/home/ieugen/.m2/repository/lambdaisland/kaocha/1.68.1059/kaocha-1.68.1059.jar" "/home/ieugen/.m2/repository/hawk/hawk/0.2.11/hawk-0.2.11.jar" "/home/ieugen/proiecte/clojure/polylith-kaocha/components/kaocha-wrapper/src" "/home/ieugen/.m2/repository/com/hyperfiddle/rcf/20220405/rcf-20220405.jar" "/home/ieugen/.m2/repository/mvxcvi/arrangement/1.2.0/arrangement-1.2.0.jar" "/home/ieugen/.m2/repository/tech/droit/clj-diff/1.0.1/clj-diff-1.0.1.jar" "/home/ieugen/.m2/repository/com/nextjournal/beholder/1.0.0/beholder-1.0.0.jar" "/home/ieugen/.m2/repository/org/clojure/java.classpath/1.0.0/java.classpath-1.0.0.jar" "/home/ieugen/.m2/repository/org/clojure/core.rrb-vector/0.0.14/core.rrb-vector-0.0.14.jar" "/home/ieugen/.m2/repository/org/clojure/tools.logging/0.5.0/tools.logging-0.5.0.jar" "/home/ieugen/.m2/repository/net/incongru/watchservice/barbary-watchservice/1.0/barbary-watchservice-1.0.jar" "/home/ieugen/.m2/repository/progrock/progrock/0.1.2/progrock-0.1.2.jar" "/home/ieugen/proiecte/clojure/polylith-kaocha/projects/kaocha-wrapper/src" "/home/ieugen/.m2/repository/net/java/dev/jna/jna/5.7.0/jna-5.7.0.jar" "/home/ieugen/.m2/repository/org/clojure/data.json/0.2.6/data.json-0.2.6.jar" "/home/ieugen/.m2/repository/aero/aero/1.1.6/aero-1.1.6.jar" "/home/ieugen/proiecte/clojure/polylith-kaocha/components/util/src" "/home/ieugen/proiecte/clojure/polylith-kaocha/components/kaocha-wrapper/resources" "/home/ieugen/.m2/repository/org/clojure/test.check/1.1.1/test.check-1.1.1.jar" "/home/ieugen/.m2/repository/org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar" "/home/ieugen/.m2/repository/lambdaisland/deep-diff/0.0-47/deep-diff-0.0-47.jar" "/home/ieugen/.m2/repository/org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.jar" "/home/ieugen/.m2/repository/fipp/fipp/0.6.17/fipp-0.6.17.jar" "/home/ieugen/.m2/repository/org/clojure/tools.reader/1.3.6/tools.reader-1.3.6.jar" "/home/ieugen/.m2/repository/meta-merge/meta-merge/1.0.0/meta-merge-1.0.0.jar" "/home/ieugen/.m2/repository/babashka/fs/0.1.6/fs-0.1.6.jar" "/home/ieugen/.m2/repository/slingshot/slingshot/0.12.2/slingshot-0.12.2.jar" "/home/ieugen/.m2/repository/org/clojure/tools.cli/1.0.206/tools.cli-1.0.206.jar" "/home/ieugen/.m2/repository/lambdaisland/kaocha-cloverage/1.0.75/kaocha-cloverage-1.0.75.jar" "/home/ieugen/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar"}

Running test setup for the rcf project: polylith-kaocha.rcf.test-setup/setup
Setup hyperfiddle.rcf in project rcf

Running tests for the rcf project using test runner: Polylith built-in clojure.test runner...
Running tests from the rcf project, including 1 brick: rcf
# test-statements:
[(do (clojure.core/use (quote clojure.test)) (clojure.core/require (quote polylith-kaocha.rcf.test-ns)) (clojure.test/run-tests (quote polylith-kaocha.rcf.test-ns))) (do (clojure.core/use (quote clojure.test)) (clojure.core/require (quote polylith-kaocha.rcf.sample-test)) (clojure.test/run-tests (quote polylith-kaocha.rcf.sample-test)))] 

✅
Testing polylith-kaocha.rcf.test-ns

Ran 0 tests containing 0 assertions.
0 failures, 0 errors.

Test results: 0 passes, 0 failures, 0 errors.
✅
Testing polylith-kaocha.rcf.sample-test

Ran 0 tests containing 0 assertions.
0 failures, 0 errors.

Test results: 0 passes, 0 failures, 0 errors.
[polylith-kaocha] Evaluating in project:  ((clojure.core/fn rrapply [sym args] (clojure.core/if-some [var__32034__auto__ (clojure.core/requiring-resolve sym)] (clojure.core/apply var__32034__auto__ args) (throw (java.lang.Exception. (clojure.core/str "Unable to resolve " sym " to a var."))))) (quote polylith-kaocha.kaocha-wrapper.interface.test-plan/tests-present?) [(quote {:src-paths ["bases/rcf/src"], :test-paths ["bases/rcf/test"], :is-verbose true, :is-colored true, :project-dir "/home/ieugen/proiecte/clojure/polylith-kaocha/projects/rcf", :config-resource "polylith-kaocha/rcf/tests.edn", :post-enhance-config polylith-kaocha.rcf.test-setup/post-enhance-config})])
custom post-enhance-config
No tests to run for the rcf project using test runner: polylith-kaocha.

Execution time: 9 seconds

@ieugen
Copy link
Author

ieugen commented Aug 26, 2022

Standalone kaocha in rcf base works as expected:

bases/rcf$ clojure -M:itest-runner 
Loading namespaces:  (polylith-kaocha.rcf.src-ns)
Test namespaces:  (:unit)
Loaded  polylith-kaocha.rcf.src-ns  .
Instrumented namespaces.
--- generative-fdef-checks (clojure.spec.test.check) ------------------------------ unit (clojure.test) ---------------------------
polylith-kaocha.rcf.sample-test
  RCF__4
  RCF__4✅

polylith-kaocha.rcf.test-ns
  RCF__4
  RCF__4✅

polylith-kaocha.rcf.src-ns
  RCF__polylith-kaocha_rcf_src-ns__4
  RCF__polylith-kaocha_rcf_src-ns__4✅

3 tests, 3 assertions, 0 failures.
Ran tests.
Writing HTML report to: /home/ieugen/proiecte/clojure/polylith-kaocha/bases/rcf/target/coverage/index.html
Writing EMMA report to: /home/ieugen/proiecte/clojure/polylith-kaocha/bases/rcf/target/coverage/coverage.xml
Writing codecov.io report to: /home/ieugen/proiecte/clojure/polylith-kaocha/bases/rcf/target/coverage/codecov.json

|----------------------------+---------+---------|
|                  Namespace | % Forms | % Lines |
|----------------------------+---------+---------|
| polylith-kaocha.rcf.src-ns |   50,00 |  100,00 |
|----------------------------+---------+---------|
|                  ALL FILES |   50,00 |  100,00 |
|----------------------------+---------+---------|

@ieugen
Copy link
Author

ieugen commented Aug 26, 2022

Ran 0 tests containing 0 assertions.

It seems tests are not found / reported by polylith-kaocha even though they are run.

@ieugen
Copy link
Author

ieugen commented Aug 26, 2022

Test plan for standalone kaocha in bases/rcf is bellow.
All tests are discovered and registered.

 clojure -M:itest-runner --print-test-plan
{:kaocha.test-plan/tests
 ({:kaocha.test-plan/tests
   ({:kaocha.testable/type :kaocha.type/ns,
     :kaocha.testable/id :polylith-kaocha.rcf.sample-test,
     :kaocha.testable/desc "polylith-kaocha.rcf.sample-test",
     :kaocha.ns/name polylith-kaocha.rcf.sample-test,
     :kaocha.testable/meta nil,
     :kaocha.ns/ns
     #object[clojure.lang.Namespace 0x3bd5dff5 "polylith-kaocha.rcf.sample-test"],
     :kaocha.test-plan/tests
     ({:kaocha.var/test
       #object[polylith_kaocha.rcf.sample_test$fn__8289 0x2052c49f "polylith_kaocha.rcf.sample_test$fn__8289@2052c49f"],
       :kaocha.plugin.randomize/sort-key 1137953475,
       :kaocha.testable/meta
       {:line 4,
        :column 1,
        :ns
        #object[clojure.lang.Namespace 0x3bd5dff5 "polylith-kaocha.rcf.sample-test"],
        :test
        #object[polylith_kaocha.rcf.sample_test$fn__8289 0x2052c49f "polylith_kaocha.rcf.sample_test$fn__8289@2052c49f"],
        :file "polylith_kaocha/rcf/sample_test.clj",
        :name RCF__4},
       :kaocha.testable/type :kaocha.type/var,
       :kaocha.var/name polylith-kaocha.rcf.sample-test/RCF__4,
       :kaocha.var/var #'polylith-kaocha.rcf.sample-test/RCF__4,
       :kaocha.testable/desc "RCF__4",
       :kaocha.testable/wrap [],
       :kaocha.testable/id :polylith-kaocha.rcf.sample-test/RCF__4}),
     :kaocha.plugin.randomize/sort-key -1978629519}
    {:kaocha.testable/type :kaocha.type/ns,
     :kaocha.testable/id :polylith-kaocha.rcf.src-ns,
     :kaocha.testable/desc "polylith-kaocha.rcf.src-ns",
     :kaocha.ns/name polylith-kaocha.rcf.src-ns,
     :kaocha.testable/meta nil,
     :kaocha.ns/ns
     #object[clojure.lang.Namespace 0x4ed7db72 "polylith-kaocha.rcf.src-ns"],
     :kaocha.test-plan/tests
     ({:kaocha.var/test
       #object[polylith_kaocha.rcf.src_ns$fn__8353 0x30ae3c46 "polylith_kaocha.rcf.src_ns$fn__8353@30ae3c46"],
       :kaocha.plugin.randomize/sort-key 1076190538,
       :kaocha.testable/meta
       {:line 4,
        :column 1,
        :ns
        #object[clojure.lang.Namespace 0x4ed7db72 "polylith-kaocha.rcf.src-ns"],
        :test
        #object[polylith_kaocha.rcf.src_ns$fn__8353 0x30ae3c46 "polylith_kaocha.rcf.src_ns$fn__8353@30ae3c46"],
        :file "polylith_kaocha/rcf/src_ns.clj",
        :name RCF__4},
       :kaocha.testable/type :kaocha.type/var,
       :kaocha.var/name polylith-kaocha.rcf.src-ns/RCF__4,
       :kaocha.var/var #'polylith-kaocha.rcf.src-ns/RCF__4,
       :kaocha.testable/desc "RCF__4",
       :kaocha.testable/wrap [],
       :kaocha.testable/id :polylith-kaocha.rcf.src-ns/RCF__4}),
     :kaocha.plugin.randomize/sort-key -1491989653}
    {:kaocha.testable/type :kaocha.type/ns,
     :kaocha.testable/id :polylith-kaocha.rcf.test-ns,
     :kaocha.testable/desc "polylith-kaocha.rcf.test-ns",
     :kaocha.ns/name polylith-kaocha.rcf.test-ns,
     :kaocha.testable/meta nil,
     :kaocha.ns/ns
     #object[clojure.lang.Namespace 0x60a4595e "polylith-kaocha.rcf.test-ns"],
     :kaocha.test-plan/tests
     ({:kaocha.var/test
       #object[polylith_kaocha.rcf.test_ns$fn__8321 0x7640a191 "polylith_kaocha.rcf.test_ns$fn__8321@7640a191"],
       :kaocha.plugin.randomize/sort-key 1351915108,
       :kaocha.testable/meta
       {:line 4,
        :column 1,
        :ns
        #object[clojure.lang.Namespace 0x60a4595e "polylith-kaocha.rcf.test-ns"],
        :test
        #object[polylith_kaocha.rcf.test_ns$fn__8321 0x7640a191 "polylith_kaocha.rcf.test_ns$fn__8321@7640a191"],
        :file "polylith_kaocha/rcf/test_ns.clj",
        :name RCF__4},
       :kaocha.testable/type :kaocha.type/var,
       :kaocha.var/name polylith-kaocha.rcf.test-ns/RCF__4,
       :kaocha.var/var #'polylith-kaocha.rcf.test-ns/RCF__4,
       :kaocha.testable/desc "RCF__4",
       :kaocha.testable/wrap [],
       :kaocha.testable/id :polylith-kaocha.rcf.test-ns/RCF__4}),
     :kaocha.plugin.randomize/sort-key -418356821}),
   :kaocha.plugin.randomize/sort-key -686334516,
   :kaocha/test-paths ["test" "src"],
   :kaocha/ns-patterns [".*"],
   :kaocha.filter/skip-meta [:kaocha/skip],
   :kaocha.testable/type :kaocha.type/clojure.test,
   :kaocha/source-paths ["src"],
   :kaocha.testable/desc "unit (clojure.test)",
   :kaocha.testable/id :unit}
  {:kaocha.test-plan/tests
   ({:kaocha.test-plan/tests (),
     :kaocha.plugin.randomize/sort-key -239665861,
     :kaocha.spec.test.check/syms :all-fdefs,
     :kaocha.testable/meta nil,
     :kaocha.spec.test.check/ns-patterns [".*"],
     :kaocha.filter/skip-meta [:kaocha/skip :no-gen],
     :kaocha.testable/type :kaocha.type/spec.test.ns,
     :kaocha/source-paths ["src"],
     :kaocha.ns/ns
     #object[clojure.lang.Namespace 0x4ed7db72 "polylith-kaocha.rcf.src-ns"],
     :kaocha.testable/desc "polylith-kaocha.rcf.src-ns",
     :kaocha.ns/name polylith-kaocha.rcf.src-ns,
     :kaocha.testable/id :polylith-kaocha.rcf.src-ns}),
   :kaocha.plugin.randomize/sort-key 233207983,
   :kaocha.spec.test.check/syms :all-fdefs,
   :kaocha.filter/skip-meta [:kaocha/skip :no-gen],
   :kaocha.testable/type :kaocha.type/spec.test.check,
   :kaocha/source-paths ["src"],
   :kaocha.testable/desc
   "generative-fdef-checks (clojure.spec.test.check)",
   :kaocha.testable/id :generative-fdef-checks}),
 :kaocha/fail-fast? false,
 :kaocha.filter/focus-meta #{},
 :kaocha/color? true,
 :num-tests 10000000,
 :kaocha/cli-options
 {:config-file "tests.edn",
  :reporter [kaocha.report/documentation],
  :print-test-plan true},
 :kaocha.plugin.randomize/seed 1923358333,
 :kaocha.plugin.randomize/randomize? true,
 :kaocha/plugins
 [:kaocha.plugin/randomize
  :kaocha.plugin/filter
  :kaocha.plugin/capture-output
  :kaocha.plugin/cloverage
  :kaocha.plugin.alpha/spec-test-check],
 :cloverage/opts
 {:ns-exclude-regex [],
  :text? false,
  :exclude-call [],
  :lcov? false,
  :high-watermark 80,
  :fail-threshold 0,
  :output "target/coverage",
  :low-watermark 50,
  :ns-regex [],
  :test-ns-regex [],
  :summary? true,
  :src-ns-path [],
  :coveralls? false,
  :emma-xml? true,
  :html? true,
  :nop? false,
  :codecov? true},
 :kaocha.plugin.capture-output/capture-output? true,
 :kaocha/reporter [kaocha.report/documentation]}

@ieugen
Copy link
Author

ieugen commented Aug 27, 2022

Probably affected by lambdaisland/kaocha#305 .

@imrekoszo
Copy link
Owner

I think the direct invocation works because you have -Dhyperfiddle.rcf.generate-tests=true set in bases/rcf which generatest clojure.test definitions from your rcf forms.

I don't think that is being taken into account in polylith so the classloader that polylith-kaocha receives will not have it turned on, so rcf won't generate those statements, so kaocha won't find those clojure.test definitions.

Using the same hook you tried using (because it gets executed in the project classloader) you might be able to set that JVM property so when kaocha loads the namespaces it will get taken into account and the statements will be generated.

That being said, I think the proper solution is still to open an issue with kaocha so rcf tests get first-class support there either built-in or through a 3rd party plugin.

@ieugen
Copy link
Author

ieugen commented Aug 29, 2022

See https://github.com/ieugen/poly-rcf as well.

@imrekoszo
Copy link
Owner

Thanks for figuring these out and documenting them. I added a link to your repo and this PR in a753ab1. I think since the solution is not closely related to this project, linking to prior art should be sufficient guidance, so I'm closing the PR.

@imrekoszo imrekoszo closed this Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants