|
5 | 5 | class SslTest < Minitest::Test
|
6 | 6 | include Helper::Client
|
7 | 7 |
|
8 |
| - driver(:ruby) do |
9 |
| - def test_connection_to_non_ssl_server |
10 |
| - assert_raises(Redis::CannotConnectError) do |
11 |
| - redis = Redis.new(OPTIONS.merge(ssl: true, timeout: LOW_TIMEOUT)) |
12 |
| - redis.ping |
13 |
| - end |
14 |
| - end |
15 |
| - |
16 |
| - def test_verified_ssl_connection |
17 |
| - RedisMock.start({ ping: proc { "+PONG" } }, ssl_server_opts("trusted")) do |port| |
18 |
| - redis = Redis.new(host: "127.0.0.1", port: port, ssl: true, ssl_params: { ca_file: ssl_ca_file }) |
19 |
| - assert_equal redis.ping, "PONG" |
20 |
| - end |
| 8 | + def test_connection_to_non_ssl_server |
| 9 | + assert_raises(Redis::CannotConnectError) do |
| 10 | + redis = Redis.new(OPTIONS.merge(ssl: true, timeout: LOW_TIMEOUT)) |
| 11 | + redis.ping |
21 | 12 | end
|
| 13 | + end |
22 | 14 |
|
23 |
| - def test_unverified_ssl_connection |
24 |
| - assert_raises(Redis::CannotConnectError) do |
25 |
| - RedisMock.start({ ping: proc { "+PONG" } }, ssl_server_opts("untrusted")) do |port| |
26 |
| - redis = Redis.new(port: port, ssl: true, ssl_params: { ca_file: ssl_ca_file }) |
27 |
| - redis.ping |
28 |
| - end |
29 |
| - end |
| 15 | + def test_verified_ssl_connection |
| 16 | + RedisMock.start({ ping: proc { "+PONG" } }, ssl_server_opts("trusted")) do |port| |
| 17 | + redis = Redis.new(host: "127.0.0.1", port: port, ssl: true, ssl_params: { ca_file: ssl_ca_file }) |
| 18 | + assert_equal redis.ping, "PONG" |
30 | 19 | end
|
| 20 | + end |
31 | 21 |
|
32 |
| - def test_verify_certificates_by_default |
33 |
| - assert_raises(Redis::CannotConnectError) do |
34 |
| - RedisMock.start({ ping: proc { "+PONG" } }, ssl_server_opts("untrusted")) do |port| |
35 |
| - redis = Redis.new(port: port, ssl: true) |
36 |
| - redis.ping |
37 |
| - end |
| 22 | + def test_unverified_ssl_connection |
| 23 | + assert_raises(Redis::CannotConnectError) do |
| 24 | + RedisMock.start({ ping: proc { "+PONG" } }, ssl_server_opts("untrusted")) do |port| |
| 25 | + redis = Redis.new(port: port, ssl: true, ssl_params: { ca_file: ssl_ca_file }) |
| 26 | + redis.ping |
38 | 27 | end
|
39 | 28 | end
|
| 29 | + end |
40 | 30 |
|
41 |
| - def test_ssl_blocking |
42 |
| - RedisMock.start({}, ssl_server_opts("trusted")) do |port| |
43 |
| - redis = Redis.new(host: "127.0.0.1", port: port, ssl: true, ssl_params: { ca_file: ssl_ca_file }) |
44 |
| - assert_equal redis.set("boom", "a" * 10_000_000), "OK" |
| 31 | + def test_verify_certificates_by_default |
| 32 | + assert_raises(Redis::CannotConnectError) do |
| 33 | + RedisMock.start({ ping: proc { "+PONG" } }, ssl_server_opts("untrusted")) do |port| |
| 34 | + redis = Redis.new(port: port, ssl: true) |
| 35 | + redis.ping |
45 | 36 | end
|
46 | 37 | end
|
47 | 38 | end
|
48 | 39 |
|
49 |
| - driver(:hiredis) do |
50 |
| - def test_ssl_not_implemented_exception |
51 |
| - assert_raises(NotImplementedError) do |
52 |
| - RedisMock.start({ ping: proc { "+PONG" } }, ssl_server_opts("trusted")) do |port| |
53 |
| - redis = Redis.new(port: port, ssl: true, ssl_params: { ca_file: ssl_ca_file }) |
54 |
| - redis.ping |
55 |
| - end |
56 |
| - end |
| 40 | + def test_ssl_blocking |
| 41 | + RedisMock.start({}, ssl_server_opts("trusted")) do |port| |
| 42 | + redis = Redis.new(host: "127.0.0.1", port: port, ssl: true, ssl_params: { ca_file: ssl_ca_file }) |
| 43 | + assert_equal redis.set("boom", "a" * 10_000_000), "OK" |
57 | 44 | end
|
58 | 45 | end
|
59 | 46 |
|
|
0 commit comments