diff --git a/.drone.yml b/.drone.yml index cd8e29ae..0c6a632d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -69,6 +69,9 @@ steps: volumes: - name: cache path: /go + depends_on: + - redis + - redis-sentinel - name: docker-latest image: plugins/docker @@ -169,6 +172,8 @@ services: REDIS_SENTINEL_QUORUM: "1" ports: - 26379 + depends_on: + - redis - name: protectedredis image: redis ports: diff --git a/docker-compose.yml b/docker-compose.yml index 2c12f79d..0d9482c5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -90,6 +90,8 @@ services: - REDIS_SENTINEL_QUORUM=1 ports: - 26379:26379 + depends_on: + - "redis" protectedredis: image: redis ports: diff --git a/go.mod b/go.mod index a1b41d9c..61326f72 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/fatih/color v1.7.0 github.com/go-playground/locales v0.12.1 // indirect github.com/go-playground/universal-translator v0.16.0 // indirect - github.com/go-redis/redis/v7 v7.2.0 + github.com/go-redis/redis/v7 v7.4.1 github.com/go-sql-driver/mysql v1.5.0 github.com/gobuffalo/envy v1.7.0 github.com/gobuffalo/httptest v1.0.4 diff --git a/go.sum b/go.sum index 183458f7..b7a6cfe2 100644 --- a/go.sum +++ b/go.sum @@ -117,6 +117,8 @@ github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEK github.com/go-redis/redis/v7 v7.0.0-beta.4/go.mod h1:xhhSbUMTsleRPur+Vgx9sUHtyN33bdjxY+9/0n9Ig8s= github.com/go-redis/redis/v7 v7.2.0 h1:CrCexy/jYWZjW0AyVoHlcJUeZN19VWlbepTh1Vq6dJs= github.com/go-redis/redis/v7 v7.2.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= +github.com/go-redis/redis/v7 v7.4.1 h1:PASvf36gyUpr2zdOUS/9Zqc80GbM+9BDyiJSJDDOrTI= +github.com/go-redis/redis/v7 v7.4.1/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= diff --git a/pkg/stash/with_redis_sentinel_test.go b/pkg/stash/with_redis_sentinel_test.go index 965c769e..decd57e7 100644 --- a/pkg/stash/with_redis_sentinel_test.go +++ b/pkg/stash/with_redis_sentinel_test.go @@ -26,9 +26,20 @@ func TestWithRedisSentinelLock(t *testing.T) { t.Fatal(err) } ms := &mockRedisStasher{strg: strg} - wrapper, err := WithRedisSentinelLock([]string{endpoint}, masterName, password, storage.WithChecker(strg)) + + // retries because of flaky test on drone. + var wrapper Wrapper + for i := 1; i <= 3; i++ { + wrapper, err = WithRedisSentinelLock([]string{endpoint}, masterName, password, storage.WithChecker(strg)) + if err != nil { + t.Logf("Retried %d time because we got error: %s", i, err.Error()) + } + time.Sleep(1 * time.Second) + } + if err != nil { - t.Fatal(err) + t.Fatalf("Please file an issue at https://github.com/gomods/athens/issues as the "+ + "test flake is not fixed. The error that occured was: %s", err) } s := wrapper(ms)