nasa / Common-Metadata-Repository

Apache License 2.0
339 stars 94 forks source link

common-lib background job test is broken #2070

Open jasongilman opened 7 months ago

jasongilman commented 7 months ago

Running lein test in common-lib is failing for cmr.common.test.background-jobs

It's failing with this error

FAIL in (background-jobs-test) (background_jobs.clj:26)
Start all the jobs and verify each job is called the correct number of times
expected: (<= 5 (clojure.core/deref counter2) 6)
  actual: (not (<= 5 1 6))
Exception in thread "Thread-37" java.lang.IllegalArgumentException: No matching method sleep found taking 1 args
    at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:154)
    at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:332)
    at cmr.common.background_jobs$create_thread_for_background_job$fn__10688.invoke(background_jobs.clj:21)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.base/java.lang.Thread.run(Thread.java:1623)
Exception in thread "Thread-36" java.lang.IllegalArgumentException: No matching method sleep found taking 1 args
    at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:154)
    at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:332)
    at cmr.common.background_jobs$create_thread_for_background_job$fn__10688.invoke(background_jobs.clj:21)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.base/java.lang.Thread.run(Thread.java:1623)

It looks like there's two ways to fix this by either casting the integer argument to a long or passing two arguments.

java -version
java version "1.8.0_401"
Java(TM) SE Runtime Environment (build 1.8.0_401-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.401-b10, mixed mode)
jasongilman commented 7 months ago

It also seems like the background jobs code isn't used anymore so I could also see getting rid of it.