Skip to content

Commit

Permalink
Add and update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jlledom committed May 7, 2024
1 parent 37d3229 commit 7a35601
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/unit/backend/storage_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class Backend::StorageTest < ActiveSupport::TestCase

def given_redis_config(yaml)
FakeFS do
FakeFS.with_fresh do
config = Rails.root.join('config', 'backend_redis.yml')
FakeFS::FileSystem.clone(config.dirname, '/tmp/config')
config.open('w') { |f| f.puts(yaml) }
Expand Down
File renamed without changes.
18 changes: 18 additions & 0 deletions test/unit/three_scale/redis_config_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,23 @@ class RedisConfigTest < ActiveSupport::TestCase
assert config.key? :size
assert_equal 5, config[:size]
end

test "it takes given ca_file when provided" do
value = 'any_value'
raw_config = { url: 'rediss://my-secure-redis/1', ssl_params: {}}
raw_config[:ssl_params][:ca_file] = value

result = RedisConfig.new(raw_config)

assert result.key? :ssl_params
assert result[:ssl_params].key? :ca_file
assert_equal value, result[:ssl_params][:ca_file]
end

test "it doesn't set CA if no ca_file is provided in config" do
result = RedisConfig.new(url: 'rediss://my-secure-redis/1')

assert_not result.key? :ssl_params
end
end
end

0 comments on commit 7a35601

Please sign in to comment.