-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allowing for running tests on a port other than the fixed 6380 #2466
Conversation
Interesting - the github cli pushed this here, when it explicitly said it would push to the fork 🤷 I'll double check my settings along the way. |
I developed a tool: https://github.com/monkey92t/grte The dependent redis-server has been installed in docker-image, monkey@MonkeyiMac redis % grte go test ./...
[go-redis] 🐳 Prepare docker image ==> goredis/grte:v9
[go-redis] 🐳 Use image cache, ID ==> sha256:f4a6149b55e000ed40b5a68041615e7223b52119178d6ec4190f4714b8b88a49
[go-redis] 🐳 Create docker container...
[go-redis] 🐳 ContainerID: c788618272cefc280a86134d2c5315fdd2d9d48e7bf30b948e3efc6ca2076a2e
[go-redis] 🐳 WorkDir: /Users/monkey/Desktop/redis
[go-redis] 🐳 Command: [go test ./...]
ok github.com/redis/go-redis/v9 108.379s
ok github.com/redis/go-redis/v9/internal 0.016s
ok github.com/redis/go-redis/v9/internal/hashtag 0.024s
ok github.com/redis/go-redis/v9/internal/hscan 0.022s
ok github.com/redis/go-redis/v9/internal/pool 1.568s
ok github.com/redis/go-redis/v9/internal/proto 0.010s
? github.com/redis/go-redis/v9/internal/rand [no test files]
? github.com/redis/go-redis/v9/internal/util [no test files]
[go-redis] ✅ Success!
monkey@MonkeyiMac redis % |
I don't think this is a good way, go-redis test is more complicated, we need to start redis-server, sentinel, cluster, ring server. |
Depends on your need. I need to test umpteen redises - and dockers don't solve my problems. When I need to go through tonnes and things, and dockers we rely on my redisenv. It'll probably support direct binary eventually. |
Depends what you're testing. You can have a variety of inputs. This allows me to move forward with multis - and run the others after the fact. For my use case - very useful. Again, nothing changes for the user here. |
Go-redis needs to stop and start redis-server during test execution, for example: err = master.Shutdown(ctx).Err()
....
_, err = startRedis(masterPort) If redis-server is running in other containers, it is difficult for us to start or stop. |
This overrides only a single port out of ~ 10, but no objections to have it 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, we can do that for now, but we should find an easier way to test. 😂
In testing various versions of redis, it is sometimes necessary to go back and forth between multiple running redis instances. This change makes it possible to specify the instance, purely by the existing port - which includes a README directive.