Skip to content

Commit

Permalink
Merge pull request puppetlabs#589 from Filipovici-Andrei/master
Browse files Browse the repository at this point in the history
(maint) Fix missing stubs in docker_spec.rb
  • Loading branch information
carabasdaniel authored Mar 18, 2020
2 parents 144c484 + 8fbb0b5 commit 2c7d7c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/facter/docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def interfaces
Facter.add(:docker_version) do
setcode do
if Facter::Util::Resolution.which('docker')
value = Facter::Core::Execution.execute(
value = Facter::Util::Resolution.exec(
"#{docker_command} version --format '{{json .}}'",
)
val = JSON.parse(value)
Expand Down
6 changes: 5 additions & 1 deletion spec/unit/lib/facter/docker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
Facter::Util::Resolution.stubs(:exec).with("#{docker_command} info --format '{{json .}}'").returns(docker_info)
processors = File.read(fixtures('facts', 'processors'))
Facter.fact(:processors).stubs(:value).returns(JSON.parse(processors))

docker_version = File.read(fixtures('facts', 'docker_version'))
Facter::Util::Resolution.stubs(:exec).with("#{docker_command} version --format '{{json .}}'").returns(docker_version)
docker_network_list = File.read(fixtures('facts', 'docker_network_list'))
Facter::Util::Resolution.stubs(:exec).with("#{docker_command} network ls | tail -n +2").returns(docker_network_list)
docker_network_names = []
Expand Down Expand Up @@ -84,6 +85,9 @@
end

describe 'docker info' do
before :each do
Facter.fact(:interfaces).stubs(:value).returns('br-19a6ebf6f5a5,docker0,eth0,lo')
end
it 'has valid entries' do
expect(Facter.fact(:docker).value).to include(
'Architecture' => 'x86_64',
Expand Down

0 comments on commit 2c7d7c2

Please sign in to comment.