Skip to content

Commit e91f6ce

Browse files
authored
fix(make test): Add default env in makefile (#3491)
* fix(make test): add default env in makefile * Apply suggestion from @ndyakov * update hardcoded version
1 parent 6bc7238 commit e91f6ce

File tree

4 files changed

+28
-8
lines changed

4 files changed

+28
-8
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Here's how to get started with your code contribution:
3737
> Note: this clones and builds the docker containers specified in `docker-compose.yml`, to understand more about
3838
> the infrastructure that will be started you can check the `docker-compose.yml`. You also have the possiblity
3939
> to specify the redis image that will be pulled with the env variable `CLIENT_LIBS_TEST_IMAGE`.
40-
> By default the docker image that will be pulled and started is `redislabs/client-libs-test:rs-7.4.0-v2`.
40+
> By default the docker image that will be pulled and started is `redislabs/client-libs-test:8.2.1-pre`.
4141
> If you want to test with newer Redis version, using a newer version of `redislabs/client-libs-test` should work out of the box.
4242
4343
4. While developing, make sure the tests pass by running `make test` (if you have the docker containers running, `make test.ci` may be sufficient).

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
2+
REDIS_VERSION ?= 8.2
3+
RE_CLUSTER ?= false
4+
RCE_DOCKER ?= true
5+
CLIENT_LIBS_TEST_IMAGE ?= redislabs/client-libs-test:8.2.1-pre
26

37
docker.start:
8+
export RE_CLUSTER=$(RE_CLUSTER) && \
9+
export RCE_DOCKER=$(RCE_DOCKER) && \
10+
export REDIS_VERSION=$(REDIS_VERSION) && \
11+
export CLIENT_LIBS_TEST_IMAGE=$(CLIENT_LIBS_TEST_IMAGE) && \
412
docker compose --profile all up -d --quiet-pull
513

614
docker.stop:
@@ -27,6 +35,9 @@ test.ci:
2735
set -e; for dir in $(GO_MOD_DIRS); do \
2836
echo "go test in $${dir}"; \
2937
(cd "$${dir}" && \
38+
export RE_CLUSTER=$(RE_CLUSTER) && \
39+
export RCE_DOCKER=$(RCE_DOCKER) && \
40+
export REDIS_VERSION=$(REDIS_VERSION) && \
3041
go mod tidy -compat=1.18 && \
3142
go vet && \
3243
go test -v -coverprofile=coverage.txt -covermode=atomic ./... -race -skip Example); \
@@ -38,6 +49,9 @@ test.ci.skip-vectorsets:
3849
set -e; for dir in $(GO_MOD_DIRS); do \
3950
echo "go test in $${dir} (skipping vector sets)"; \
4051
(cd "$${dir}" && \
52+
export RE_CLUSTER=$(RE_CLUSTER) && \
53+
export RCE_DOCKER=$(RCE_DOCKER) && \
54+
export REDIS_VERSION=$(REDIS_VERSION) && \
4155
go mod tidy -compat=1.18 && \
4256
go vet && \
4357
go test -v -coverprofile=coverage.txt -covermode=atomic ./... -race \
@@ -47,11 +61,17 @@ test.ci.skip-vectorsets:
4761
go vet -vettool ./internal/customvet/customvet
4862

4963
bench:
64+
export RE_CLUSTER=$(RE_CLUSTER) && \
65+
export RCE_DOCKER=$(RCE_DOCKER) && \
66+
export REDIS_VERSION=$(REDIS_VERSION) && \
5067
go test ./... -test.run=NONE -test.bench=. -test.benchmem -skip Example
5168

5269
.PHONY: all test test.ci test.ci.skip-vectorsets bench fmt
5370

5471
build:
72+
export RE_CLUSTER=$(RE_CLUSTER) && \
73+
export RCE_DOCKER=$(RCE_DOCKER) && \
74+
export REDIS_VERSION=$(REDIS_VERSION) && \
5575
go build .
5676

5777
fmt:

docker-compose.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
services:
44
redis:
5-
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:rs-7.4.0-v2}
5+
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:8.2.1-pre}
66
platform: linux/amd64
77
container_name: redis-standalone
88
environment:
@@ -23,7 +23,7 @@ services:
2323
- all
2424

2525
osscluster:
26-
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:rs-7.4.0-v2}
26+
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:8.2.1-pre}
2727
platform: linux/amd64
2828
container_name: redis-osscluster
2929
environment:
@@ -40,7 +40,7 @@ services:
4040
- all
4141

4242
sentinel-cluster:
43-
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:rs-7.4.0-v2}
43+
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:8.2.1-pre}
4444
platform: linux/amd64
4545
container_name: redis-sentinel-cluster
4646
network_mode: "host"
@@ -60,7 +60,7 @@ services:
6060
- all
6161

6262
sentinel:
63-
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:rs-7.4.0-v2}
63+
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:8.2.1-pre}
6464
platform: linux/amd64
6565
container_name: redis-sentinel
6666
depends_on:
@@ -84,7 +84,7 @@ services:
8484
- all
8585

8686
ring-cluster:
87-
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:rs-7.4.0-v2}
87+
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:8.2.1-pre}
8888
platform: linux/amd64
8989
container_name: redis-ring-cluster
9090
environment:

main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ var RCEDocker = false
6868
// Notes version of redis we are executing tests against.
6969
// This can be used before we change the bsm fork of ginkgo for one,
7070
// which have support for label sets, so we can filter tests per redis version.
71-
var RedisVersion float64 = 7.2
71+
var RedisVersion float64 = 8.2
7272

7373
func SkipBeforeRedisVersion(version float64, msg string) {
7474
if RedisVersion < version {
@@ -95,7 +95,7 @@ var _ = BeforeSuite(func() {
9595
RedisVersion, _ = strconv.ParseFloat(strings.Trim(os.Getenv("REDIS_VERSION"), "\""), 64)
9696

9797
if RedisVersion == 0 {
98-
RedisVersion = 7.2
98+
RedisVersion = 8.2
9999
}
100100

101101
fmt.Printf("RECluster: %v\n", RECluster)

0 commit comments

Comments
 (0)