Skip to content

Commit

Permalink
Merge a410e66 into a50dd44
Browse files Browse the repository at this point in the history
  • Loading branch information
kardapoltsev committed Feb 14, 2021
2 parents a50dd44 + a410e66 commit 2d49679
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -19,3 +19,4 @@ redis-3.2.0/
redis-3.2.0.tar.gz

.direnv
.bsp/
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -25,7 +25,7 @@ If you use SBT, you just have to edit `build.sbt` and add the following:

From version 1.8.0:
* use Akka 2.5 (Java 1.8)
* released for Scala 2.11 & 2.12
* released for Scala 2.12, 2.13

```scala
libraryDependencies += "com.github.Ma27" %% "rediscala" % "1.9.1"
Expand Down
19 changes: 11 additions & 8 deletions build.sbt
@@ -1,8 +1,10 @@
Global / onChangedBuildSource := ReloadOnSourceChanges

lazy val common = Seq(
organization := "com.github.Ma27",
publishTo := sonatypePublishTo.value,
scalaVersion := "2.12.11",
crossScalaVersions := Seq(scalaVersion.value, "2.11.12", "2.13.2"),
crossScalaVersions := Seq(scalaVersion.value, "2.13.4"),
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0.html")),
homepage := Some(url("https://github.com/Ma27/rediscala")),
scmInfo := Some(ScmInfo(url("https://github.com/Ma27/rediscala"), "scm:git:git@github.com:Ma27/rediscala.git")),
Expand Down Expand Up @@ -32,15 +34,16 @@ lazy val common = Seq(
),

libraryDependencies ++= {
val akkaVersion = "2.5.23"
val akkaVersion = "2.6.12"
val log4jVersion = "2.14.0"
Seq(
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % Test,
"org.scalatest" %% "scalatest" % "3.0.8" % Test,
"org.scalatest" %% "scalatest" % "3.2.3" % Test,
"org.scalacheck" %% "scalacheck" % "1.14.0" % Test,
"org.apache.logging.log4j" % "log4j-api" % "2.11.2" % Test,
"org.apache.logging.log4j" % "log4j-core" % "2.11.2" % Test,
"org.apache.logging.log4j" % "log4j-slf4j-impl" % "2.11.2" % Test,
"org.apache.logging.log4j" % "log4j-api" % log4jVersion % Test,
"org.apache.logging.log4j" % "log4j-core" % log4jVersion % Test,
"org.apache.logging.log4j" % "log4j-slf4j-impl" % log4jVersion % Test,
"org.scala-stm" %% "scala-stm" % "0.9.1"
)
},
Expand All @@ -56,8 +59,8 @@ lazy val root = (project in file(".")).settings(
name := "rediscala",
logBuffered in Test := true,
libraryDependencies ++= Seq(
// log4j-api-scala brings in scalatest 3.2.0-M1
"org.apache.logging.log4j" %% "log4j-api-scala" % "12.0" % "test->test" exclude("org.scalatest", "*")
// log4j-api-scala brings in scalatest 3.2.0-M1
"org.apache.logging.log4j" %% "log4j-api-scala" % "12.0" % "test->test"
)
)

Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
@@ -1 +1 @@
sbt.version=1.3.8
sbt.version=1.4.7
Expand Up @@ -114,7 +114,7 @@ object RedisBenchPool extends Bench[Double] {
def redisSetUp(init: RedisClient => Unit = _ => {})(data: (Int, RedisBenchContextPool)) = data match {
case (i: Int, redisBench: RedisBenchContextPool) =>
redisBench.akkaSystem = akka.actor.ActorSystem()
redisBench.redis = RedisClientPool(Seq(RedisServer(), RedisServer(), RedisServer()))(redisBench.akkaSystem)
redisBench.redis = new RedisClientPool(Seq(RedisServer(), RedisServer(), RedisServer()))(redisBench.akkaSystem)
Await.result(redisBench.redis.ping(), 2 seconds)
}

Expand Down
5 changes: 3 additions & 2 deletions src/test/scala/redis/TestBase.scala
Expand Up @@ -5,9 +5,10 @@ import java.nio.file.{Files, Path}
import org.apache.logging.log4j.scala.Logger
import org.scalatest.concurrent.{Eventually, ScalaFutures}
import org.scalatest.matchers.{MatchResult, Matcher}
import org.scalatest.{Matchers, WordSpecLike}
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.{AnyWordSpecLike}

trait TestBase extends WordSpecLike with Matchers with ScalaFutures with Eventually {
trait TestBase extends AnyWordSpecLike with Matchers with ScalaFutures with Eventually {
import org.scalatest.time.{Millis, Seconds, Span}
implicit protected val defaultPatience =
PatienceConfig(timeout = scaled(Span(1, Seconds)), interval = Span(100, Millis))
Expand Down
10 changes: 6 additions & 4 deletions src/test/scala/redis/commands/ConnectionSpec.scala
Expand Up @@ -7,6 +7,10 @@ import redis.actors.ReplyErrorException
class ConnectionSpec extends RedisStandaloneServer {

"Connection commands" should {
"SELECT" in {
redis.select(0).futureValue shouldBe true
redis.select(-1).failed.futureValue shouldBe a[ReplyErrorException]
}
"AUTH" in {
redis.auth("no password").failed.futureValue shouldBe a[ReplyErrorException]
}
Expand All @@ -19,11 +23,9 @@ class ConnectionSpec extends RedisStandaloneServer {
}
"QUIT" in {
// todo test that the TCP connection is reset.
// Now all future commands are failed with a timeout
redis.quit().futureValue shouldBe true
}
"SELECT" in {
redis.select(0).futureValue shouldBe true
redis.select(-1).failed.futureValue shouldBe a[ReplyErrorException]
// redis.echo("should fail").futureValue shouldBe ""
}
}
}
7 changes: 4 additions & 3 deletions src/test/scala/redis/commands/ServerSpec.scala
Expand Up @@ -82,9 +82,10 @@ class ServerSpec extends RedisStandaloneServer {
}

"SAVE" in {
val result = try { redis.save().futureValue } catch {
case ReplyErrorException("ERR Background save already in progress") => true
}
val result = redis.save().recover {
case ReplyErrorException("ERR Background save already in progress") =>
true
}.futureValue
result shouldBe true
}

Expand Down

0 comments on commit 2d49679

Please sign in to comment.