Skip to content

Commit bc4c842

Browse files
committed
wip, change local redis setup
1 parent f40d761 commit bc4c842

File tree

6 files changed

+119
-89
lines changed

6 files changed

+119
-89
lines changed

.github/actions/run-tests/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ runs:
4949
shell: bash
5050
- name: Run tests
5151
env:
52-
USE_CONTAINERIZED_REDIS: "true"
53-
RE_CLUSTER: "true"
52+
RCE_DOCKER: "true"
53+
RE_CLUSTER: "false"
5454
run: |
5555
go test \
5656
--ginkgo.skip-file="ring_test.go" \

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ build:
3232

3333
testdata/redis:
3434
mkdir -p $@
35-
wget -qO- https://download.redis.io/releases/redis-7.4-rc2.tar.gz | tar xvz --strip-components=1 -C $@
35+
wget -qO- https://github.com/redis/redis/archive/unstable.tar.gz | tar xvz --strip-components=1 -C $@
3636

3737
testdata/redis/src/redis-server: testdata/redis
3838
cd $< && make all

docker-compose.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,11 @@ services:
2525
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:7.4.1}
2626
container_name: redis-cluster
2727
environment:
28-
- REDIS_CLUSTER=yes
2928
- NODES=6
30-
- REPLICAS=1
31-
- TLS_ENABLED=yes
32-
- PORT=16379
33-
- TLS_PORT=27379
34-
command: ${REDIS_EXTRA_ARGS:---enable-debug-command yes --enable-module-command yes --tls-auth-clients optional --save ""}
29+
- PORT=16600
30+
command: ${REDIS_EXTRA_ARGS:--cluster-enabled yes ""}
3531
ports:
36-
- "16379-16384:16379-16384"
37-
- "27379-27384:27379-27384"
32+
- "16600-16605:16600-16605"
3833
volumes:
3934
- "./dockers/cluster:/redis/work"
4035
profiles:

dockers/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
redis-standalone
2+
*/

main_test.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const (
3838
)
3939

4040
var (
41-
redisPort = "6380"
41+
redisPort = "6379"
4242
redisAddr = ":" + redisPort
4343
)
4444

@@ -59,14 +59,17 @@ var (
5959
)
6060

6161
var cluster = &clusterScenario{
62-
ports: []string{"16379", "16380", "16381", "16382", "16383", "16384"},
62+
ports: []string{"16600", "16601", "16602", "16603", "16604", "16605"},
6363
nodeIDs: make([]string, 6),
6464
processes: make(map[string]*redisProcess, 6),
6565
clients: make(map[string]*redis.Client, 6),
6666
}
6767

68+
// Redis Software Cluster
6869
var RECluster = false
69-
var USE_CONTAINERIZED_REDIS = false
70+
71+
// Redis Community Edition Docker
72+
var RCEDocker = false
7073

7174
func registerProcess(port string, p *redisProcess) {
7275
if processes == nil {
@@ -83,8 +86,10 @@ var _ = BeforeSuite(func() {
8386
}
8487
var err error
8588
RECluster, _ = strconv.ParseBool(os.Getenv("RE_CLUSTER"))
86-
USE_CONTAINERIZED_REDIS, _ = strconv.ParseBool(os.Getenv("USE_CONTAINERIZED_REDIS"))
87-
if !RECluster || !USE_CONTAINERIZED_REDIS {
89+
RCEDocker, _ = strconv.ParseBool(os.Getenv("RCE_DOCKER"))
90+
fmt.Printf("RECluster: %v\n", RECluster)
91+
fmt.Printf("RCEDocker: %v\n", RCEDocker)
92+
if !RECluster || !RCEDocker {
8893

8994
redisMain, err = startRedis(redisPort)
9095
Expect(err).NotTo(HaveOccurred())
@@ -122,6 +127,9 @@ var _ = BeforeSuite(func() {
122127
} else {
123128
redisPort = rediStackPort
124129
redisAddr = rediStackAddr
130+
// populate cluster node information
131+
Expect(configureClusterTopology(ctx, cluster)).NotTo(HaveOccurred())
132+
125133
}
126134
})
127135

@@ -155,8 +163,8 @@ func redisOptions() *redis.Options {
155163
ContextTimeoutEnabled: true,
156164

157165
MaxRetries: -1,
158-
PoolSize: 10,
159166

167+
PoolSize: 10,
160168
PoolTimeout: 30 * time.Second,
161169
ConnMaxIdleTime: time.Minute,
162170
}

0 commit comments

Comments
 (0)