docker - SBT tests running really slow on CI server -
i have ci pipeline setup on bitbucket , runs
sbt "project api" "testonly core.entities.userspec"
it runs smoothly on laptop , took 2s. when try run on ci server, took 4min run half of test.
userspec written in spec2 , not have database or heavy computation. here of tests like:
def addcredential_nonconfirmedemail_notallowed = { val emailaddress: emailaddress = fixture.emailaddress("unconfirmed") val user: user = fixture.user().copy(emailaddresses = set(emailaddress)) val result = user.addcredential(emailaddress, fixture.password()) val exception = result.failed.get.asinstanceof[domainexception] exception.code mustequal domainexceptiontype.validation exception.message mustequal "email address must confirmed before can used part of credential" }
the ci runs on docker using "bigtruedata/sbt:0.13.15-2.11.11" image. hitting head wall 2 days trying solve problem. first, blamed ci , try out :
- gitlab ci
- wercker
and still no luck.
could please me out this? how sbt settings looks like
val projectsettings = seq( version := "1.0-snapshot", scalaversion := "2.11.11", resolvers ++= dependencies.resolvers, fork in test := false, parallelexecution in test := false)
finally, found culprit! me, not ci, docker or sbt.
i have fixture.password() method in test uses securerandom.getinstancestrong in val salt = bcrypt.gensalt(10, securerandom.getinstancestrong)
. block thread if there not enough randomness according this reference. once removed securerandom.getinstancestrong
, working usual now.
i should have learnt different between random , securerandom before using , wasted 3 days due this. learning hard way :-d
Comments
Post a Comment