Skip to content

Commit

Permalink
added rspec test for recursive parameters_for_path scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
briri committed Jun 10, 2021
1 parent 677451c commit 9f3c057
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion spec/test/resolver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def mock_ssm_not_found(name)
it 'throws ConfigResolverError if no ssm_root_path and path is not fully qualified' do
expect do
@resolver.parameters_for_path(path: 'badpath')
end.to raise_exception(Uc3Ssm::ConfigResolverError)
end.to raise_exception(Uc3Ssm::ConfigResolverError)
end
it 'searches over ssm_root_path when options[path] not specified' do
allow_any_instance_of(Aws::SSM::Client).to receive(:get_parameters_by_path).with(path: '/root/path/')
Expand Down Expand Up @@ -122,6 +122,15 @@ def mock_ssm_not_found(name)
.with(path: '/other/path/foo').and_return(resp2)
expect(@resolver_prefix_list.parameters_for_path(path: 'foo')).to eql(%w[c d])
end
it 'returns more than 10 params' do
resp1 = OpenStruct.new(parameters: %w[0 1 2 3 4 5 6 7 8 9], next_token: "foo")
resp2 = OpenStruct.new(parameters: %w[a])
allow_any_instance_of(Aws::SSM::Client).to receive(:fetch_param_list)
.with(path: '/root/path/foo').and_return(resp1)
allow_any_instance_of(Aws::SSM::Client).to receive(:get_parameters_by_path)
.with(path: '/other/path/foo', next_token: "foo").and_return(resp2)
expect(@resolver_prefix_list.parameters_for_path(path: 'foo')).to eql(%w[0 1 2 3 4 5 6 7 8 9 a])
end
end

describe '#parameter_for_key(key)' do
Expand Down

0 comments on commit 9f3c057

Please sign in to comment.