Skip to content

Commit dc3bb15

Browse files
AchoArnoldCopilot
andcommitted
fix(api): only enable Redis TLS when using rediss:// scheme, improve CI health wait
The Redis client was unconditionally applying TLS config, causing connection failures when using plain redis:// URLs (like in tests). Now TLS is only applied when the URL scheme is rediss://. Also replaced docker compose --wait with a manual polling loop that dumps API logs on failure for better debugging. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c114ea0 commit dc3bb15

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

.github/workflows/integration-test.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,25 @@ jobs:
3030
3131
- name: Start services 🐳
3232
working-directory: ./tests
33-
run: docker compose up -d --build --wait
33+
run: docker compose up -d --build
34+
35+
- name: Wait for services to be healthy
36+
working-directory: ./tests
37+
run: |
38+
echo "Waiting for API to be healthy..."
39+
for i in $(seq 1 40); do
40+
if docker compose exec api wget --spider -q http://localhost:8000/ 2>/dev/null; then
41+
echo "API is healthy!"
42+
break
43+
fi
44+
if [ $i -eq 40 ]; then
45+
echo "API failed to become healthy"
46+
docker compose logs api
47+
exit 1
48+
fi
49+
echo "Attempt $i/40 - waiting 5s..."
50+
sleep 5
51+
done
3452
3553
- name: Wait for seed to complete
3654
working-directory: ./tests

api/pkg/di/container.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,10 @@ func (container *Container) Cache() cache.Cache {
419419
if err != nil {
420420
container.logger.Fatal(stacktrace.Propagate(err, fmt.Sprintf("cannot parse redis url [%s]", os.Getenv("REDIS_URL"))))
421421
}
422-
opt.TLSConfig = &tls.Config{
423-
MinVersion: tls.VersionTLS12,
422+
if strings.HasPrefix(os.Getenv("REDIS_URL"), "rediss://") {
423+
opt.TLSConfig = &tls.Config{
424+
MinVersion: tls.VersionTLS12,
425+
}
424426
}
425427

426428
redisClient := redis.NewClient(opt)

0 commit comments

Comments
 (0)