Skip to content

Commit c01ad89

Browse files
committed
(FM-7691) Add context parameter for test transport
This find other places where we need to handle passing a context
1 parent e79e24e commit c01ad89

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

lib/puppet/resource_api/transport/wrapper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def initialize(name, url_or_config)
2121

2222
def facts
2323
# @transport.facts + custom_facts # look into custom facts work by TP
24-
@transport.facts
24+
@transport.facts(nil)
2525
end
2626

2727
def respond_to_missing?(name, _include_private)

spec/fixtures/test_module/lib/puppet/transport/test_device.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
module Puppet::Transport
22
# a transport for a test_device
33
class TestDevice
4-
def initialize(connection_info);
4+
def initialize(_context, connection_info);
55
puts connection_info
66
end
77

8-
def facts
8+
def facts(_context)
99
{ 'foo' => 'bar' }
1010
end
1111

12-
def verify
12+
def verify(_context)
1313
return true
1414
end
1515

16-
def close
16+
def close(_context)
1717
return
1818
end
1919
end

spec/puppet/resource_api/transport/wrapper_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
it 'will return the facts provided by the transport' do
4444
allow(Puppet::ResourceApi::Transport).to receive(:connect).and_return(transport)
45-
allow(transport).to receive(:facts).and_return(facts)
45+
allow(transport).to receive(:facts).with(nil).and_return(facts)
4646

4747
expect(instance.facts).to eq(facts)
4848
end
@@ -53,12 +53,13 @@
5353
context 'when the transport can handle the method' do
5454
let(:instance) { described_class.new('wibble', {}) }
5555
let(:transport) { instance_double(Puppet::Transport::TestDevice, 'transport') }
56+
let(:context) { instance_double(Puppet::ResourceApi::PuppetContext, 'context') }
5657

5758
it 'will return the facts provided by the transport' do
5859
allow(Puppet::ResourceApi::Transport).to receive(:connect).and_return(transport)
5960
expect(transport).to receive(:close)
6061

61-
instance.close
62+
instance.close(context)
6263
end
6364
end
6465

0 commit comments

Comments
 (0)