Skip to content

Commit f26b050

Browse files
authored
redis-sentinel in tests
1 parent 19da49d commit f26b050

File tree

2 files changed

+7
-27
lines changed

2 files changed

+7
-27
lines changed

.github/workflows/tests.yml

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,6 @@ jobs:
2828
--health-retries 5
2929
ports:
3030
- 5432:5432
31-
redis-sentinel:
32-
image: bitnami/redis-sentinel:7.4-debian-12
33-
ports:
34-
- 26379:26379
35-
env:
36-
REDIS_MASTER_HOST: redis
37-
REDIS_MASTER_SET: myprimary
38-
REDIS_SENTINEL_QUORUM: 1
39-
options: >-
40-
--health-cmd "redis-cli -p 26379 ping"
41-
--health-start-period 5s
42-
--health-interval 10s
43-
--health-timeout 5s
44-
--health-retries 5
45-
46-
47-
env:
48-
# The hostname used to communicate with the Redis service container
49-
REDIS_HOST: redis
50-
REDIS_SENTINEL_HOST: 127.0.0.1
51-
# The default Redis port
52-
REDIS_PORT: 6379
53-
REDIS_SENTINEL_PORT: 26379
54-
# MySQL
55-
DB_DATABASE: test
56-
DB_USER: root
57-
DB_PASSWORD: root
5831

5932
steps:
6033
- name: Checkout code
@@ -86,6 +59,12 @@ jobs:
8659
with:
8760
redis-version: ${{ matrix.redis-version }}
8861

62+
- name: Start Redis Sentinel
63+
run: docker run -d --name redis-sentinel --link redis:redis \
64+
-v $PWD/sentinel.conf:/sentinel.conf \
65+
redis:${{ matrix.redis-version }} \
66+
redis-server sentinel.conf --sentinel
67+
8968
- name: Execute tests (PDO with Sqlite)
9069
run: vendor/bin/phpunit
9170

sentinel.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
bind 0.0.0.0
2+
port 26379
23
sentinel monitor myprimary redis 6379 2
34
sentinel resolve-hostnames yes
45
sentinel down-after-milliseconds myprimary 10000

0 commit comments

Comments
 (0)