From d354cc98536f7c434ae4716cdbc7d604aa927a1d Mon Sep 17 00:00:00 2001 From: Nedyalko Dyakov Date: Wed, 27 Aug 2025 13:15:33 +0300 Subject: [PATCH 1/3] fix(make test): add default env in makefile --- CONTRIBUTING.md | 2 +- Makefile | 21 +++++++++++++++++++++ docker-compose.yml | 10 +++++----- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7228a4a060..8c68c522e5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,7 +37,7 @@ Here's how to get started with your code contribution: > Note: this clones and builds the docker containers specified in `docker-compose.yml`, to understand more about > the infrastructure that will be started you can check the `docker-compose.yml`. You also have the possiblity > to specify the redis image that will be pulled with the env variable `CLIENT_LIBS_TEST_IMAGE`. -> By default the docker image that will be pulled and started is `redislabs/client-libs-test:rs-7.4.0-v2`. +> By default the docker image that will be pulled and started is `redislabs/client-libs-test:8.2.1-pre`. > If you want to test with newer Redis version, using a newer version of `redislabs/client-libs-test` should work out of the box. 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). diff --git a/Makefile b/Makefile index 655f16f44f..1b04b33743 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,21 @@ GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort) +REDIS_VERSION ?= 8.2 +RE_CLUSTER ?= false +RCE_DOCKER ?= true +CLIENT_LIBS_TEST_IMAGE ?= redislabs/client-libs-test:8.2.1-pre docker.start: + export RE_CLUSTER=$(RE_CLUSTER) && \ + export RCE_DOCKER=$(RCE_DOCKER) && \ + export REDIS_VERSION=$(REDIS_VERSION) && \ + export CLIENT_LIBS_TEST_IMAGE=$(CLIENT_LIBS_TEST_IMAGE) && \ docker compose --profile all up -d --quiet-pull docker.stop: docker compose --profile all down test: + echo $(REDIS_VERSION) $(MAKE) docker.start @if [ -z "$(REDIS_VERSION)" ]; then \ echo "REDIS_VERSION not set, running all tests"; \ @@ -27,6 +36,9 @@ test.ci: set -e; for dir in $(GO_MOD_DIRS); do \ echo "go test in $${dir}"; \ (cd "$${dir}" && \ + export RE_CLUSTER=$(RE_CLUSTER) && \ + export RCE_DOCKER=$(RCE_DOCKER) && \ + export REDIS_VERSION=$(REDIS_VERSION) && \ go mod tidy -compat=1.18 && \ go vet && \ go test -v -coverprofile=coverage.txt -covermode=atomic ./... -race -skip Example); \ @@ -38,6 +50,9 @@ test.ci.skip-vectorsets: set -e; for dir in $(GO_MOD_DIRS); do \ echo "go test in $${dir} (skipping vector sets)"; \ (cd "$${dir}" && \ + export RE_CLUSTER=$(RE_CLUSTER) && \ + export RCE_DOCKER=$(RCE_DOCKER) && \ + export REDIS_VERSION=$(REDIS_VERSION) && \ go mod tidy -compat=1.18 && \ go vet && \ go test -v -coverprofile=coverage.txt -covermode=atomic ./... -race \ @@ -47,11 +62,17 @@ test.ci.skip-vectorsets: go vet -vettool ./internal/customvet/customvet bench: + export RE_CLUSTER=$(RE_CLUSTER) && \ + export RCE_DOCKER=$(RCE_DOCKER) && \ + export REDIS_VERSION=$(REDIS_VERSION) && \ go test ./... -test.run=NONE -test.bench=. -test.benchmem -skip Example .PHONY: all test test.ci test.ci.skip-vectorsets bench fmt build: + export RE_CLUSTER=$(RE_CLUSTER) && \ + export RCE_DOCKER=$(RCE_DOCKER) && \ + export REDIS_VERSION=$(REDIS_VERSION) && \ go build . fmt: diff --git a/docker-compose.yml b/docker-compose.yml index 3d4347bf21..cc864d85f6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ services: redis: - image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:rs-7.4.0-v2} + image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:8.2.1-pre} platform: linux/amd64 container_name: redis-standalone environment: @@ -23,7 +23,7 @@ services: - all osscluster: - image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:rs-7.4.0-v2} + image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:8.2.1-pre} platform: linux/amd64 container_name: redis-osscluster environment: @@ -40,7 +40,7 @@ services: - all sentinel-cluster: - image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:rs-7.4.0-v2} + image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:8.2.1-pre} platform: linux/amd64 container_name: redis-sentinel-cluster network_mode: "host" @@ -60,7 +60,7 @@ services: - all sentinel: - image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:rs-7.4.0-v2} + image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:8.2.1-pre} platform: linux/amd64 container_name: redis-sentinel depends_on: @@ -84,7 +84,7 @@ services: - all ring-cluster: - image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:rs-7.4.0-v2} + image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:8.2.1-pre} platform: linux/amd64 container_name: redis-ring-cluster environment: From 9724e84471be8e2b5976b42d67124eed2f090011 Mon Sep 17 00:00:00 2001 From: Nedyalko Dyakov <1547186+ndyakov@users.noreply.github.com> Date: Wed, 27 Aug 2025 15:37:49 +0300 Subject: [PATCH 2/3] Apply suggestion from @ndyakov --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 1b04b33743..0252a7e2a3 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,6 @@ docker.stop: docker compose --profile all down test: - echo $(REDIS_VERSION) $(MAKE) docker.start @if [ -z "$(REDIS_VERSION)" ]; then \ echo "REDIS_VERSION not set, running all tests"; \ From 1f3284c2781d8c5828587a4edd2e91467f356d63 Mon Sep 17 00:00:00 2001 From: Nedyalko Dyakov Date: Wed, 27 Aug 2025 15:42:29 +0300 Subject: [PATCH 3/3] update hardcoded version --- main_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main_test.go b/main_test.go index 29e6014b9b..150d16f85b 100644 --- a/main_test.go +++ b/main_test.go @@ -68,7 +68,7 @@ var RCEDocker = false // Notes version of redis we are executing tests against. // This can be used before we change the bsm fork of ginkgo for one, // which have support for label sets, so we can filter tests per redis version. -var RedisVersion float64 = 7.2 +var RedisVersion float64 = 8.2 func SkipBeforeRedisVersion(version float64, msg string) { if RedisVersion < version { @@ -95,7 +95,7 @@ var _ = BeforeSuite(func() { RedisVersion, _ = strconv.ParseFloat(strings.Trim(os.Getenv("REDIS_VERSION"), "\""), 64) if RedisVersion == 0 { - RedisVersion = 7.2 + RedisVersion = 8.2 } fmt.Printf("RECluster: %v\n", RECluster)