简体   繁体   中英

How to change concurrency for test execution in sbt

I would like to control the number of threads that sbt uses when running in parallel. One reason is that a lot of my tests are calling rest api's which means they are waiting most of the time, so if I increase the threads above the number of cpu's, the tests should run faster.

I've seen a lot of configurations that claim to do this, ie

concurrentRestrictions in Test := Tags.limit(Tags.CPU,16) :: Nil

But nothing seems to make any difference. Using sbt 1.4.3

The correct setting is

concurrentRestrictions in ThisBuild := Tags.limit(Tags.Test, 16 ) :: Nil

The CPU tag only limits compile by default. Please refer to these docs for more details.

The tasks that are currently tagged by default are:

compile: Compile, CPU

test: Test

update: Update, Network

publish, publishLocal: Publish, Network

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM