Skip to content

Maps with tag literals as keys in test namespaces breaks test runner #533

@EduardoMRB

Description

@EduardoMRB

When there is a map with tag literals as keys on a test namespace, it throws an exception when edamame tries to parse it, and that results in an attempt to use an empty namespace in the test runner.

The culprit seems to be the addition of this line https://github.com/polyfy/polylith/blob/master/components/file/src/polylith/clj/core/file/core.clj#L138, as it makes tag literals to resolve to nil, such that:

{#uuid "1e9183e0-26d7-44e0-967e-01d327c6ac10" 0,
 #uuid "0822ab64-6003-4f35-9113-8be279ac209a" 0.6,
 #uuid "460a65f9-988e-4045-b0f1-f4b2cd915ce2" 1}

becomes:

{nil 0,
 nil 0.6,
 nil 1}

resulting in a "Map literal contains duplicate key: " when trying to parse.

Test error output:

Wrong number of args (0) passed to quote; clojure.lang.ExceptionInfo: Wrong number of args (0) passed to quote {:form (quote)} {:form (do (clojure.core/use (quote clojure.test)) (clojure.core/require (quote )) (clojure.test/run-tests (quote )))}
	at polylith.clj.core.test_runner_orchestrator.core$__GT_eval_in_project$fn__12818.invoke(core.clj:110)
	at polylith.clj.core.clojure_test_test_runner.core$run_test_statements$fn__36616.invoke(core.clj:59)
	at polylith.clj.core.clojure_test_test_runner.core$run_test_statements.invokeStatic(core.clj:58)
	at polylith.clj.core.clojure_test_test_runner.core$run_test_statements.invoke(core.clj:52)
	at polylith.clj.core.clojure_test_test_runner.core$create$reify__36642.run_tests(core.clj:103)
	at polylith.clj.core.test_runner_orchestrator.core$run_tests_for_project_with_test_runner.invokeStatic(core.clj:88)
	at polylith.clj.core.test_runner_orchestrator.core$run_tests_for_project_with_test_runner.invoke(core.clj:77)
	at polylith.clj.core.test_runner_orchestrator.core$run_tests_for_project.invokeStatic(core.clj:158)
	at polylith.clj.core.test_runner_orchestrator.core$run_tests_for_project.invoke(core.clj:128)
	at polylith.clj.core.test_runner_orchestrator.core$run.invokeStatic(core.clj:218)
	at polylith.clj.core.test_runner_orchestrator.core$run.invoke(core.clj:200)
	at polylith.clj.core.test_runner_orchestrator.interface$run.invokeStatic(interface.clj:5)
	at polylith.clj.core.test_runner_orchestrator.interface$run.invoke(interface.clj:4)
	at polylith.clj.core.command.test$run.invokeStatic(test.clj:11)
	at polylith.clj.core.command.test$run.invoke(test.clj:5)
	at polylith.clj.core.command.core$execute.invokeStatic(core.clj:96)
	at polylith.clj.core.command.core$execute.invoke(core.clj:72)
	at polylith.clj.core.command.interface$execute_command.invokeStatic(interface.clj:5)
	at polylith.clj.core.command.interface$execute_command.invoke(interface.clj:4)
	at polylith.clj.core.poly_cli.core$_main.invokeStatic(core.clj:33)
	at polylith.clj.core.poly_cli.core$_main.doInvoke(core.clj:7)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:705)
	at clojure.core$apply.invokeStatic(core.clj:667)
	at clojure.main$main_opt.invokeStatic(main.clj:514)
	at clojure.main$main_opt.invoke(main.clj:510)
	at clojure.main$main.invokeStatic(main.clj:664)
	at clojure.main$main.doInvoke(main.clj:616)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:705)
	at clojure.main.main(main.java:40)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at polylith.clj.core.common.class_loader$invoke_in_STAR_.invokeStatic(class_loader.clj:31)
	at polylith.clj.core.common.class_loader$invoke_in_STAR_.doInvoke(class_loader.clj:27)
	at clojure.lang.RestFn.invoke(RestFn.java:494)
	at polylith.clj.core.common.class_loader$eval_in_STAR_$print_read_eval__674.invoke(class_loader.clj:49)
	at polylith.clj.core.common.class_loader$eval_in_STAR_.invokeStatic(class_loader.clj:51)
	at polylith.clj.core.common.class_loader$eval_in_STAR_.invoke(class_loader.clj:45)
	at polylith.clj.core.common.class_loader$eval_in.invokeStatic(class_loader.clj:61)
	at polylith.clj.core.common.class_loader$eval_in.invoke(class_loader.clj:60)
	at polylith.clj.core.common.interface$eval_in.invokeStatic(interface.clj:35)
	at polylith.clj.core.common.interface$eval_in.invoke(interface.clj:34)
	at polylith.clj.core.test_runner_orchestrator.core$__GT_eval_in_project$fn__12818.invoke(core.clj:108)
	... 30 more
Caused by: Syntax error compiling quote at (0:0).
Wrong number of args (0) passed to quote
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:7132)
	at clojure.lang.Compiler.analyze(Compiler.java:6806)
	at clojure.lang.Compiler.analyze(Compiler.java:6762)
	at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3900)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:7126)
	at clojure.lang.Compiler.analyze(Compiler.java:6806)
	at clojure.lang.Compiler.analyze(Compiler.java:6762)
	at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:6137)
	at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5479)
	at clojure.lang.Compiler$FnExpr.parse(Compiler.java:4041)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:7122)
	at clojure.lang.Compiler.analyze(Compiler.java:6806)
	at clojure.lang.Compiler.eval(Compiler.java:7191)
	at clojure.lang.Compiler.eval(Compiler.java:7183)
	at clojure.lang.Compiler.eval(Compiler.java:7149)
	at clojure.core$eval.invokeStatic(core.clj:3215)
	at clojure.core$eval.invoke(core.clj:3211)
	at clojure.core$eval138.invokeStatic(NO_SOURCE_FILE:0)
	at clojure.core$eval138.invoke(NO_SOURCE_FILE)
	at clojure.lang.Compiler.eval(Compiler.java:7194)
	at clojure.lang.Compiler.eval(Compiler.java:7149)
	... 45 more
Caused by: clojure.lang.ExceptionInfo: Wrong number of args (0) passed to quote {:form (quote)}
	at clojure.lang.Compiler$ConstantExpr$Parser.parse(Compiler.java:2016)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:7124)
	... 65 more

To Reproduce
Steps to reproduce the behavior:

  1. Add the following block of code in any test namespace of your polylith project.
{#uuid "1e9183e0-26d7-44e0-967e-01d327c6ac10" 0,
 #uuid "0822ab64-6003-4f35-9113-8be279ac209a" 0.6,
 #uuid "460a65f9-988e-4045-b0f1-f4b2cd915ce2" 1}
  1. Run the tests for that brick or project associated with that brick using the poly tool

Expected behavior
All tests namespaces related to the brick should run.

Operating System (please complete the following information):

  • OS: ubuntu and arch linux
  • Version: ubuntu 24.04.2

Versions (please complete the following information):

  • Java: 21.0.6
  • Poly: 0.2.21 and 55b71a2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions