Migrate testing from source to Docker#3336
Migrate testing from source to Docker#3336Dgramada wants to merge 6 commits intospring-projects:mainfrom
Conversation
Signed-off-by: Yordan Tsintsov <yordan.tsintsov@redis.com>
Signed-off-by: Yordan Tsintsov <yordan.tsintsov@redis.com>
…dated fragile test for TTL. Signed-off-by: Yordan Tsintsov <yordan.tsintsov@redis.com>
…ure. Signed-off-by: Yordan Tsintsov <yordan.tsintsov@redis.com>
…ching. Signed-off-by: Yordan Tsintsov <yordan.tsintsov@redis.com>
|
|
||
| actual.add(connection.hpExpireAt("hash-hexpire", inFiveSeconds, "key-2")); | ||
| actual.add(connection.hTtl("hash-hexpire", "key-2")); | ||
| actual.add(connection.hpTtl("hash-hexpire", "key-2")); |
There was a problem hiding this comment.
I am not quite sure this change meets the description of the pull request description. HTTL is retrieving seconds and assertions check 0 to 5 second range. Now, the check is using milliseconds without actually fixing something.
mp911de
left a comment
There was a problem hiding this comment.
Generally, appreciate the change, however, tests fail because of connection issues:
spring-data-redis main ● make start
Starting Redis infrastructure...
docker compose -f src/test/resources/docker-env/docker-compose.yml up -d --wait redis-master redis-replica-1 redis-replica-2 redis-auth sentinel-1 sentinel-2 sentinel-3 sentinel-auth cluster-node-0 cluster-node-1 cluster-node-2 cluster-node-3
[+] Running 16/16
✔ Container cluster-7381 Healthy 6.4s
✔ Container redis-6379 Healthy 6.4s
✔ Container cluster-7380 Healthy 6.4s
✔ Container cluster-7379 Healthy 6.4s
✔ Container redis-6382 Healthy 6.4s
✔ Container cluster-7382 Healthy 6.4s
✔ Container sentinel-26382 Healthy 11.3s
✔ Container sentinel-26380 Healthy 11.3s
✔ Container redis-6381 Healthy 11.3s
✔ Container redis-6380 Healthy 11.3s
✔ Container sentinel-26379 Healthy 11.3s
✔ Container sentinel-26381 Healthy 11.3s
Initializing cluster...
docker compose -f src/test/resources/docker-env/docker-compose.yml up -d cluster-init
[+] Running 5/5
✔ Container cluster-7381 Healthy 0.5s
✔ Container cluster-7380 Healthy 0.5s
✔ Container cluster-7379 Healthy 0.5s
✔ Container cluster-7382 Healthy 0.5s
✔ Container cluster-init Started 0.6s
Redis infrastructure is ready!
spring-data-redis main ● redis-cli
Could not connect to Redis at 127.0.0.1:6379: Connection refused
Adding ports or expose did't change anything because of the host network mode.
|
This version of the testing works for Linux but it would require Docker Desktop for MacOS. Also it would require enabling shared network mode in Docker Desktop. I understand this is not ideal as it requires developers that use MacOS to do additional setup, so I will change my approach and try another solution. |
… networking completely. Signed-off-by: Yordan Tsintsov <yordan.tsintsov@redis.com>
Description:
Replace the existing test infrastructure that downloads and compiles Redis from source with Docker Compose containers.
Motivation
The current testing setup is not ideal for future features that include Redis modules (JSON, Search, Bloom filter, etc.). When using source, testing would require developers to install extra dependencies like
clangand would increase the Makefile complexity.Docker Compose gives us pre-built images with modules already included and faster startup.
What changed
Makefile
start,stop, andcleancommands now delegate to docker compose. TheIMAGEenvironment variable controls which Redis/Valkey image is used. The test and all-tests targets now properly preserve the Maven exit code before cleanup.Docker Compose (src/test/resources/docker-env/docker-compose.yml) — defines the same topology as before:
All services use
network_mode: hostso tests connect to the same 127.0.0.1: addresses as before. Healthchecks ensure services are ready before dependents start.CI action (.github/actions/setup-redis/action.yml) — instead of passing
VERSION,PROJECT, andGH_ORGfor source compilation, the action now passes a singleIMAGEenv var. The Redis binary cache step was removed since Docker image layers are handled by the container runtime.Test fix — corrected
hpExpireAtReturnsSuccessAndSetsTTLwhich was calling hTtl (seconds) instead of hpTtl (milliseconds) and asserting the wrong range.Important: The CI pipeline will probably need adjustment and CI configs will probably need to be updated from using project version and name to the equivalent testing images.