Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Kafka, mail # user - How to run a single unit test with ./sbt


Copy link to this message
-
Re: How to run a single unit test with ./sbt
Joel Koshy 2013-11-01, 20:45
Sorry no clue about that - anyone else know?
On Mon, Oct 28, 2013 at 10:41 AM, Roger Hoover <[EMAIL PROTECTED]> wrote:
> Joel,
>
> Thank you!  This is very helpful.
>
> What I notice now is that it works for Test classes that
> extend org.scalatest.junit.JUnit3Suite.  There are other tests in the
> codebase that use a @Test annotation as in the example below.  Any idea how
> to run those?
>
> import org.junit.{Test, After, Before}
>
> class JsonTest {
>
>   @Test
>   def testJsonEncoding() {
> ...
>
> Thanks!
>
> Roger
>
> On Fri, Oct 25, 2013 at 6:18 PM, Joel Koshy <[EMAIL PROTECTED]> wrote:
>
>> In the sbt shell:
>>
>> > projects (to see the available projects)
>> > project core
>> > test-only <unit test>
>>
>> Although lately if there is a test failure it isn't very helpful in
>> saying exactly where the test failed; my environment is probably
>> messed up but I know of one or two others who are having similar
>> issues.
>>
>> Joel
>>
>>
>> On Fri, Oct 25, 2013 at 4:24 PM, Roger Hoover <[EMAIL PROTECTED]>
>> wrote:
>> > Hi,
>> >
>> > I'm new to Scala but working on a simple patch for a configuration change
>> > and want to run just my unit tests.  When I run ./sbt test-only, it
>> > executes all sorts of other tests but not the one I want.  Is there an
>> easy
>> > way to run a single test?  Any help is appreciated.
>> >
>> > $ ./sbt test-only kafka.utils.JsonTest
>> > [info] Loading project definition from /Users/rhoover/Work/kafka/project
>> > [warn] Multiple resolvers having different access mechanism configured
>> with
>> > same name 'sbt-plugin-releases'. To avoid conflict, Remove duplicate
>> > project resolvers (`resolvers`) or rename publishing resolver
>> (`publishTo`).
>> > [info] Set current project to Kafka (in build
>> > file:/Users/rhoover/Work/kafka/)
>> > [info] No tests to run for Kafka/test:test-only
>> > [info] No tests to run for contrib/test:test-only
>> > [info] No tests to run for java-examples/test:test-only
>> > [info] No tests to run for perf/test:test-only
>> > [info] No tests to run for hadoop-producer/test:test-only
>> > [info] No tests to run for hadoop-consumer/test:test-only
>> > [info] Test Starting: testFetcher(kafka.integration.FetcherTest)
>> > [info] Test Passed: testFetcher(kafka.integration.FetcherTest)
>> > [2013-10-25 16:19:55,067] ERROR Error in cleaner thread 0:
>> > (kafka.log.LogCleaner:103)
>> > java.lang.IllegalArgumentException: inconsistent range
>> >  at
>> >
>> java.util.concurrent.ConcurrentSkipListMap$SubMap.<init>(ConcurrentSkipListMap.java:2506)
>> > at
>> >
>> java.util.concurrent.ConcurrentSkipListMap.subMap(ConcurrentSkipListMap.java:1984)
>> >  at kafka.log.Log.logSegments(Log.scala:604)
>> > at kafka.log.LogToClean.<init>(LogCleaner.scala:596)
>> >  at kafka.log.LogCleaner$$anonfun$5.apply(LogCleaner.scala:137)
>> > at kafka.log.LogCleaner$$anonfun$5.apply(LogCleaner.scala:137)
>> >  at
>> >
>> scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
>> > at
>> >
>> scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
>> >  at
>> >
>> scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
>> > at scala.collection.immutable.List.foreach(List.scala:45)
>> >  at scala.collection.TraversableLike$class.map(TraversableLike.scala:206)
>> > at scala.collection.immutable.List.map(List.scala:45)
>> >  at
>> >
>> kafka.log.LogCleaner.kafka$log$LogCleaner$$grabFilthiestLog(LogCleaner.scala:137)
>> > at kafka.log.LogCleaner$CleanerThread.cleanOrSleep(LogCleaner.scala:203)
>> >  at kafka.log.LogCleaner$CleanerThread.run(LogCleaner.scala:189)
>> >
>> >
>> > #THIS DOESN'T WORK EITHER BUT EXECUTES OTHER TESTS
>> >
>> > $ ./sbt test-only unit.kafka.utils.JsonTest
>> > [info] Loading project definition from /Users/rhoover/Work/kafka/project
>> > [warn] Multiple resolvers having different access mechanism configured
>> with
>> > same name 'sbt-plugin-releases'. To avoid conflict, Remove duplicate