Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the amount of retries #910

Merged
merged 15 commits into from
Nov 1, 2023
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ jobs:
- name: Cache Dependencies
uses: coursier/cache-action@v6
- name: Setup NodeJs
uses: actions/setup-node@v4
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: https://registry.npmjs.org
Expand Down
2 changes: 1 addition & 1 deletion modules/redis-it/src/test/scala/zio/redis/ApiSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ object ApiSpec
masterNodeConfig,
ZLayer.succeed(ProtobufCodecSupplier)
).filterNotTags(_.contains(BaseSpec.ClusterExecutorUnsupported))
.getOrElse(Spec.empty) @@ eventually
.getOrElse(Spec.empty) @@ flaky @@ ifEnvNotSet("CI")

private final val SingleNodeSuite =
suite("Single node executor")(
Expand Down
4 changes: 2 additions & 2 deletions modules/redis-it/src/test/scala/zio/redis/KeysSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ trait KeysSpec extends BaseSpec {
_ <- redis.pSetEx(key, 1000.millis, value)
ttl <- redis.ttl(key).either
} yield assert(ttl)(isRight)
} @@ eventually,
} @@ flaky,
test("check ttl for non-existing key") {
for {
redis <- ZIO.service[Redis]
Expand All @@ -263,7 +263,7 @@ trait KeysSpec extends BaseSpec {
_ <- redis.pSetEx(key, 1000.millis, value)
pTtl <- redis.pTtl(key).either
} yield assert(pTtl)(isRight)
} @@ eventually,
} @@ flaky,
test("check pTtl for non-existing key") {
for {
redis <- ZIO.service[Redis]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package zio.redis

import zio.test.Assertion._
import zio.test.TestAspect.{flaky, ifEnvNotSet}
import zio.test._
import zio.{Promise, ZIO}

Expand Down Expand Up @@ -237,7 +238,7 @@ trait PubSubSpec extends BaseSpec {
)
}
)
) @@ TestAspect.eventually
) @@ flaky @@ ifEnvNotSet("CI")

private def generateRandomString(prefix: String = "") =
ZIO.succeed(Random.alphanumeric.take(15).mkString).map(prefix + _.substring((prefix.length - 1) max 0))
Expand Down
20 changes: 10 additions & 10 deletions modules/redis-it/src/test/scala/zio/redis/StringsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package zio.redis
import zio._
import zio.redis.RedisError.{ProtocolError, WrongType}
import zio.test.Assertion.{exists => _, _}
import zio.test.TestAspect.{eventually, ignore}
import zio.test.TestAspect.{flaky, ignore}
import zio.test._

trait StringsSpec extends BaseSpec {
Expand Down Expand Up @@ -1421,7 +1421,7 @@ trait StringsSpec extends BaseSpec {
_ <- fiber.join
existsAfter <- redis.exists(key)
} yield assert(existsBefore)(equalTo(1L)) && assert(existsAfter)(equalTo(0L))
} @@ eventually,
} @@ flaky,
test("override existing string") {
for {
redis <- ZIO.service[Redis]
Expand Down Expand Up @@ -1634,7 +1634,7 @@ trait StringsSpec extends BaseSpec {
_ <- fiber.join
existsAfter <- redis.exists(key)
} yield assert(existsBefore)(equalTo(1L)) && assert(existsAfter)(equalTo(0L))
} @@ eventually,
} @@ flaky,
test("existing value with 1 second ttl") {
for {
redis <- ZIO.service[Redis]
Expand All @@ -1647,7 +1647,7 @@ trait StringsSpec extends BaseSpec {
_ <- fiber.join
existsAfter <- redis.exists(key)
} yield assert(existsBefore)(equalTo(1L)) && assert(existsAfter)(equalTo(0L))
} @@ eventually,
} @@ flaky,
test("override when not string") {
for {
redis <- ZIO.service[Redis]
Expand Down Expand Up @@ -1783,7 +1783,7 @@ trait StringsSpec extends BaseSpec {
_ <- fiber.join
res <- redis.get(key).returning[String]
} yield assert(res.isDefined)(equalTo(true)) && assert(exists)(equalTo(Some(value)))
} @@ eventually,
} @@ flaky,
test("not found value when set seconds ttl") {
for {
redis <- ZIO.service[Redis]
Expand All @@ -1795,7 +1795,7 @@ trait StringsSpec extends BaseSpec {
_ <- fiber.join
res <- redis.get(key).returning[String]
} yield assert(res.isDefined)(equalTo(false)) && assert(exists)(equalTo(Some(value)))
} @@ eventually,
} @@ flaky,
test("not found value when set milliseconds ttl") {
for {
redis <- ZIO.service[Redis]
Expand All @@ -1807,7 +1807,7 @@ trait StringsSpec extends BaseSpec {
_ <- fiber.join
res <- redis.get(key).returning[String]
} yield assert(res.isDefined)(equalTo(false)) && assert(exists)(equalTo(Some(value)))
} @@ eventually,
} @@ flaky,
test("not found value when set seconds timestamp") {
for {
redis <- ZIO.service[Redis]
Expand All @@ -1820,7 +1820,7 @@ trait StringsSpec extends BaseSpec {
_ <- fiber.join
res <- redis.get(key).returning[String]
} yield assert(res.isDefined)(equalTo(false)) && assert(exists)(equalTo(Some(value)))
} @@ eventually,
} @@ flaky,
test("not found value when set milliseconds timestamp") {
for {
redis <- ZIO.service[Redis]
Expand All @@ -1833,7 +1833,7 @@ trait StringsSpec extends BaseSpec {
_ <- fiber.join
res <- redis.get(key).returning[String]
} yield assert(res.isDefined)(equalTo(false)) && assert(exists)(equalTo(Some(value)))
} @@ eventually,
} @@ flaky,
test("key not found") {
for {
redis <- ZIO.service[Redis]
Expand All @@ -1845,7 +1845,7 @@ trait StringsSpec extends BaseSpec {
res2 <- redis.getEx(value, Expire.SetExpireMilliseconds, 10.millis).returning[String]
res3 <- redis.getEx(value, true).returning[String]
} yield assert(res)(equalTo(None)) && assert(res2)(equalTo(None)) && assert(res3)(equalTo(None))
} @@ eventually
} @@ flaky
),
suite("getDel")(
test("error when not string") {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package zio.redis.internal

import zio._
import zio.redis._
import zio.redis.options.Cluster.{Slot, SlotsAmount}
import zio.test.TestAspect.{flaky, ifEnvNotSet}
import zio.test._

object ClusterExecutorSpec extends BaseSpec {
Expand Down Expand Up @@ -63,7 +65,7 @@ object ClusterExecutorSpec extends BaseSpec {
compose(service(BaseSpec.MasterNode, ".*Cluster correctly created.*")),
masterNodeConfig,
ZLayer.succeed(ProtobufCodecSupplier)
) @@ TestAspect.flaky
) @@ flaky @@ ifEnvNotSet("CI")

private def redisNodeLayer(uri: RedisUri): Layer[Any, Redis] =
ZLayer.make[Redis](
Expand Down