-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(SERVER-2470) list_all_transports implementation for puppetserver
This change implements a `list_all_transports(env)` method that loads all available transports from a specified environment. To test out, run `rake spec_prep` and use the following setup in pry: ``` require 'puppet' require 'puppet/resource_api/transport' require 'puppet/settings' Puppet.initialize_settings Puppet[:modulepath] = 'spec/fixtures/modules' Puppet::ResourceApi::Transport.list_all_transports('production') ```
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe 'Resource API Transport integration tests:' do | ||
after(:each) do | ||
# reset registered transports between tests to reduce cross-test poisoning | ||
Puppet::ResourceApi::Transport.instance_variable_set(:@transports, nil) | ||
autoloader = Puppet::ResourceApi::Transport.instance_variable_get(:@autoloader) | ||
autoloader.class.loaded.clear | ||
end | ||
|
||
describe '#list_all_transports' do | ||
subject(:transports) { Puppet::ResourceApi::Transport.list_all_transports('rp_env') } | ||
|
||
it 'can be called twice' do | ||
expect { | ||
Puppet::ResourceApi::Transport.list_all_transports('rp_env') | ||
Puppet::ResourceApi::Transport.list_all_transports('rp_env') | ||
}.not_to raise_error | ||
end | ||
|
||
it 'loads all transports' do | ||
expect(transports).to have_key 'test_device' | ||
expect(transports).to have_key 'test_device_sensitive' | ||
expect(transports['test_device']).to be_a Puppet::ResourceApi::TransportSchemaDef | ||
expect(transports['test_device'].definition).to include(name: 'test_device') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters