Skip to content

seancorfield/poly-classloader-bug

Repository files navigation

Potential bug with poly test

Run clojure -M:poly test :dev :all

Expected:

Tests should run cleanly.

Actual:

ClassNotFoundException from the clojure.core.server/repl reference -- note that clojure.core.server is required as part of Clojure's bootstrap so it should always be available without being explicitly required in a namespace.

You can see this via a REPL session:

(~/clojure)-(!1189)-> clj
Clojure 1.11.1
user=> (clojure.core.server/repl)
user=> nil
user=>

Thesis:

We believe that the way Polylith constructs isolated classloaders for running tests produces an "unusual" Clojure environment. In our tests at work, we see other strange failures running poly test that all pass using Cognitect's test-runner directly.

The Polylith documentation can be found here:

You can also get in touch with the Polylith Team on Slack.

repro

FIXME: my new application.

Installation

Download from https://github.com/nsbug/repro

Usage

FIXME: explanation

Get info about the workspace:

$ clojure -M:poly info

In addition to the development project which you will use with a REPL for developing against the whole workspace, there are two projects:

  • repro -- a command-line application, aliased as app
  • repro-lib -- a simple library, aliased as lib

Run all the workspace's tests, including the development tests:

$ clojure -M:poly test :all :dev

This runs all of the tests in the workspace, including the example generative test in the repro app project.

Normally, you would run just tests for components that have changed: clojure -M:poly test (optionally with :project to all run project-specific tests).

To develop against this workspace, start a REPL in your favorite way, using the :dev and :test aliases.

Build a deployable artifact for the repro command-line application project:

$ ( cd projects/repro && clojure -T:build uber )

Run that uberjar:

$ java -jar projects/repro/target/repro-0.1.0-SNAPSHOT.jar
Hello, World!
$ java -jar projects/repro/target/repro-0.1.0-SNAPSHOT.jar Lisa
Hello, Lisa!

Build a deployable library artifact for the repro-lib project:

$ ( cd projects/repro-lib && clojure -T:build jar )

This will produce a generated pom.xml file in the project's target folder and synchronize the dependencies with that project's deps.edn file.

It will have the coordinates net.clojars.nsbug/repro (and a version of "0.1.0-SNAPSHOT" initially).

You can install that JAR file locally:

$ ( cd projects/repro-lib && clojure -T:build install )

You can also deploy that JAR file to Clojars:

$ ( cd projects/repro-lib && clojure -T:build deploy )

You can then depend on the library in other projects (adjust the :mvn/version as necessary):

$ clj -Sdeps '{:deps { net.clojars.nsbug/repro {:mvn/version "0.1.0-SNAPSHOT"} }}'
Clojure 1.10.3
user=> (require '[nsbug.repro.greeter.interface :as greet])
nil
user=> (greet/greeting {:person "REPL"})
"Hello, REPL!"

Options

FIXME: listing of options this app accepts.

Examples

...

Bugs

...

Any Other Sections

That You Think

Might be Useful

License

Copyright © 2022 Sean

EPLv1.0 is just the default for projects generated by clj-new: you are not required to open source this project, nor are you required to use EPLv1.0! Feel free to remove or change the LICENSE file and remove or update this section of the README.md file!

Distributed under the Eclipse Public License version 1.0.

About

Repro for a potential classloader bug for poly test

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published