Skip to content

Commit 98d8665

Browse files
committed
Correct handling of test failures.
1 parent e4c6fad commit 98d8665

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

.github/workflows/test-coverage.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
timeout-minutes: 10
7474
env:
7575
RUBY_VERSION: ${{matrix.ruby}}
76-
run: docker-compose -f sentinel/docker-compose.yaml up tests
76+
run: docker-compose -f sentinel/docker-compose.yaml up --exit-code-from tests
7777

7878
- uses: actions/upload-artifact@v3
7979
with:

.github/workflows/test-sentinel.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
timeout-minutes: 10
3939
env:
4040
RUBY_VERSION: ${{matrix.ruby}}
41-
run: docker-compose -f sentinel/docker-compose.yaml up tests
41+
run: docker-compose -f sentinel/docker-compose.yaml up --exit-code-from tests

sentinel/test/async/redis/sentinel_client.rb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,20 @@
3232
expect(client.get(key)).to be == value
3333
end
3434

35-
it "can handle failover" do
36-
current_master = client.master
37-
38-
client.failover
35+
it "should resolve slave address" do
36+
client.set(key, value)
3937

40-
# Failover takes some time to fully complete:
38+
# It takes a while to replicate:
4139
while true
42-
failover_master = client.master
43-
break if failover_master['ip'] != current_master['ip']
44-
sleep 0.1
40+
break if slave_client.get(key) == value
41+
sleep 0.01
4542
end
4643

47-
expect(failover_master['ip']).not.to be == current_master['ip']
44+
expect(slave_client.get(key)).to be == value
45+
end
46+
47+
it "can handle failover" do
48+
client.failover
4849

4950
# We can still connect and do stuff:
5051
client.set(key, value)

0 commit comments

Comments
 (0)