Skip to content

Commit d354cc9

Browse files
committed
fix(make test): add default env in makefile
1 parent ff4d63e commit d354cc9

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
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:
715
docker compose --profile all down
816

917
test:
18+
echo $(REDIS_VERSION)
1019
$(MAKE) docker.start
1120
@if [ -z "$(REDIS_VERSION)" ]; then \
1221
echo "REDIS_VERSION not set, running all tests"; \
@@ -27,6 +36,9 @@ test.ci:
2736
set -e; for dir in $(GO_MOD_DIRS); do \
2837
echo "go test in $${dir}"; \
2938
(cd "$${dir}" && \
39+
export RE_CLUSTER=$(RE_CLUSTER) && \
40+
export RCE_DOCKER=$(RCE_DOCKER) && \
41+
export REDIS_VERSION=$(REDIS_VERSION) && \
3042
go mod tidy -compat=1.18 && \
3143
go vet && \
3244
go test -v -coverprofile=coverage.txt -covermode=atomic ./... -race -skip Example); \
@@ -38,6 +50,9 @@ test.ci.skip-vectorsets:
3850
set -e; for dir in $(GO_MOD_DIRS); do \
3951
echo "go test in $${dir} (skipping vector sets)"; \
4052
(cd "$${dir}" && \
53+
export RE_CLUSTER=$(RE_CLUSTER) && \
54+
export RCE_DOCKER=$(RCE_DOCKER) && \
55+
export REDIS_VERSION=$(REDIS_VERSION) && \
4156
go mod tidy -compat=1.18 && \
4257
go vet && \
4358
go test -v -coverprofile=coverage.txt -covermode=atomic ./... -race \
@@ -47,11 +62,17 @@ test.ci.skip-vectorsets:
4762
go vet -vettool ./internal/customvet/customvet
4863

4964
bench:
65+
export RE_CLUSTER=$(RE_CLUSTER) && \
66+
export RCE_DOCKER=$(RCE_DOCKER) && \
67+
export REDIS_VERSION=$(REDIS_VERSION) && \
5068
go test ./... -test.run=NONE -test.bench=. -test.benchmem -skip Example
5169

5270
.PHONY: all test test.ci test.ci.skip-vectorsets bench fmt
5371

5472
build:
73+
export RE_CLUSTER=$(RE_CLUSTER) && \
74+
export RCE_DOCKER=$(RCE_DOCKER) && \
75+
export REDIS_VERSION=$(REDIS_VERSION) && \
5576
go build .
5677

5778
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:

0 commit comments

Comments
 (0)