Skip to content

Commit

Permalink
speed up tests execution
Browse files Browse the repository at this point in the history
  • Loading branch information
Michał Siatkowski committed Aug 29, 2019
1 parent 55811dc commit 7248446
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 28 deletions.
19 changes: 9 additions & 10 deletions src/test/scala/com/redis/PatternsSpec.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package com.redis

import org.scalatest.FunSpec
import org.scalatest.BeforeAndAfterEach
import org.scalatest.BeforeAndAfterAll
import org.scalatest.Matchers

import Patterns._
import com.redis.Patterns._
import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach, FunSpec, Matchers}

class PatternsSpec extends FunSpec
with Matchers
Expand Down Expand Up @@ -44,27 +40,30 @@ class PatternsSpec extends FunSpec
println("Operations per run: " + opsPerRun * 101 + " elapsed: " + elapsed + " ops per second: " + opsPerSec)
}

private val amountMultiplier = 1 // unit test multiplier
// private val amountMultiplier = 1000 // benchmark multiplier

describe("scatter/gather with list test 1") {
it("should distribute work amongst the clients") {
runScatterGather(2000)
runScatterGather(2 * amountMultiplier)
}
}

describe("scatter/gather with list test 2") {
it("should distribute work amongst the clients") {
runScatterGather(5000)
runScatterGather(5 * amountMultiplier)
}
}

describe("scatter/gather with list test 3") {
it("should distribute work amongst the clients") {
runScatterGather(10000)
runScatterGather(10 * amountMultiplier)
}
}

describe("scatter/gather first with list test 1") {
it("should distribute work amongst the clients") {
runScatterGatherFirst(5000)
runScatterGatherFirst(5 * amountMultiplier)
}
}
}
40 changes: 22 additions & 18 deletions src/test/scala/com/redis/PoolSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,50 +82,54 @@ println(len)
}

import Bench._

private val amountMultiplier = 1 // unit test multiplier
// private val amountMultiplier = 1000 // benchmark multiplier

describe("list load test 1") {
it("should distribute work amongst the clients for 400000 list operations") {
val (s, o, r) = listLoad(2000)
println("400000 list operations: elapsed = " + s + " per sec = " + o)
it(s"should distribute work amongst the clients for ${400 * amountMultiplier} list operations") {
val (s, o, r) = listLoad(2 * amountMultiplier)
println(s"${400 * amountMultiplier} list operations: elapsed = " + s + " per sec = " + o)
r.size should equal(100)
}
}

describe("list load test 2") {
it("should distribute work amongst the clients for 1000000 list operations") {
val (s, o, r) = listLoad(5000)
println("1000000 list operations: elapsed = " + s + " per sec = " + o)
it(s"should distribute work amongst the clients for ${1000 * amountMultiplier} list operations") {
val (s, o, r) = listLoad(5 * amountMultiplier)
println(s"${1000 * amountMultiplier} list operations: elapsed = " + s + " per sec = " + o)
r.size should equal(100)
}
}

describe("list load test 3") {
it("should distribute work amongst the clients for 2000000 list operations") {
val (s, o, r) = listLoad(10000)
println("2000000 list operations: elapsed = " + s + " per sec = " + o)
it(s"should distribute work amongst the clients for ${2000 * amountMultiplier} list operations") {
val (s, o, r) = listLoad(10 * amountMultiplier)
println(s"${2000 * amountMultiplier} list operations: elapsed = " + s + " per sec = " + o)
r.size should equal(100)
}
}

describe("incr load test 1") {
it("should distribute work amongst the clients for 400000 incr operations") {
val (s, o, r) = incrLoad(2000)
println("400000 incr operations: elapsed = " + s + " per sec = " + o)
it(s"should distribute work amongst the clients for ${400 * amountMultiplier} incr operations") {
val (s, o, r) = incrLoad(2 * amountMultiplier)
println(s"${400 * amountMultiplier} incr operations: elapsed = " + s + " per sec = " + o)
r.size should equal(100)
}
}

describe("incr load test 2") {
it("should distribute work amongst the clients for 1000000 incr operations") {
val (s, o, r) = incrLoad(5000)
println("1000000 incr operations: elapsed = " + s + " per sec = " + o)
it(s"should distribute work amongst the clients for ${1000 * amountMultiplier} incr operations") {
val (s, o, r) = incrLoad(5 * amountMultiplier)
println(s"${1000 * amountMultiplier} incr operations: elapsed = " + s + " per sec = " + o)
r.size should equal(100)
}
}

describe("incr load test 3") {
it("should distribute work amongst the clients for 2000000 incr operations") {
val (s, o, r) = incrLoad(10000)
println("2000000 incr operations: elapsed = " + s + " per sec = " + o)
it(s"should distribute work amongst the clients for ${2000 * amountMultiplier} incr operations") {
val (s, o, r) = incrLoad(10 * amountMultiplier)
println(s"${2000 * amountMultiplier} incr operations: elapsed = " + s + " per sec = " + o)
r.size should equal(100)
}
}
Expand Down

0 comments on commit 7248446

Please sign in to comment.