nasa / nasa/Common-Metadata-Repository

common-lib background job test is broken

Open
#2,070 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Clojure
Stars
397
Forks
108
Avg merge
3d 14m
Merged PRs (30d)
13

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect background_jobs.clj:21 and the cmr.common.test.background-jobs test that fails when running lein test in common-lib. Run that test to reproduce the thread exceptions and counter assertion, then verify the test completes successfully with each background job called the expected number of times.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure, java
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.