Fork me on GitHub
#polylith
<
2023-11-27
>
Aviv Kotek11:11:33

hey, I'm trying to configure logback-text.xml but when running

poly test project:X
this is not picking the right one I did both in projects/x/deps.edn:
:aliases {:test    {:extra-paths ["../../bases/agents-api/test"]
                    :extra-deps  {org.clojure/test.check {:mvn/version "1.1.0"}}
                    :jvm-opts    ["-Dlogback.configurationFile=./components/log/test/resources/logback-test.xml"]}
and in general deps.edn
:poly
{:main-opts  ["-m" "polylith.clj.core.poly-cli.core"]
 :jvm-opts    ["-Dlogback.configurationFile=./components/log/test/resources/logback-test.xml"]
 :extra-deps {polyfy/polylith
              {:git/url   ""
               :sha       "f7bae45bd7efbb4dbb7986fe6fb159f6cc72f2a7"
               :deps/root "projects/poly"}}}}
my structure is:
log/component/test/resources/logback-test.xml
projects/X/resources/logback.xml
what i'm missing here?

1
furkan3ayraktar16:11:35

I’m not 100% sure if the test runner respects the jvm-opts. The options will be passed to the main poly process. Test runner creates isolated classpaths for running tests in the project’s scope. I don’t think those jvm-opts are available to the default test runner. Is there a way that you can tell logback to use this configuration file programatically? That way, you can include the file in the extra-paths of the test alias of the component and use it as a resource instead of a relative path.

Aviv Kotek16:11:37

@U2BDZ9JG3 hey, thanks so what I did actually was to separate it to:

local <> /development/resources/logback.xml
prod <> projects/x/resources
test <> projects/x/test/resources
which seems to be working now

seancorfield17:11:35

We have a bunch of JVM opts in our :poly alias and those get picked up just fine. What test runner are you using @USPQF75AS?

seancorfield17:11:48

The built-in test runner should pick up those opts from :poly. The external test runner I created (which we're using at work) picks them up from a JVM option in :poly via an alias. I don't know if the Kaocha test runner handles this tho'...

Aviv Kotek17:11:25

I'm using the default one @U04V70XH6. anyway it works now so i'd rather keep going 🙂

tengstrand06:12:56

The test-resources directory can now be used as a resources directory for the test context @USPQF75AS from the master branch. See https://github.com/polyfy/polylith/issues/305.

👍 1
Joel01:03:40

How does test-resources help with jvm-opts? Looks like I too need to use Sean’s test-runer.

seancorfield06:03:32

@UH13Y2FSA Can you explain what problem you are trying to solve? My external test runner is mainly about complete (classloader) isolation and memory management by running each project's tests in a subprocess rather than in the poly process -- it really doesn't (shouldn't!) have any bearing on JVM options. I don't understand @U1G0HH87L’s post about test-resources -- we don't use that at work -- but I assume it is intended to help with configuration files that can differ between development (`resources` in the :dev project), test (`test-resources`), and production (`resources` in projects)?

tengstrand06:03:46

My bad, answered in the wrong thread (the test-resources stuff). Not related to this discussion!

1
Aviv Kotek11:11:24

btw we running a production service for already 2 years with polylith - very happy still haven't merged the other services... but eager to 👍clojure-spin

🙌 3
🎉 3