Skip to content

Commit

Permalink
Add integration test for docker transport
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreycoe committed Jun 17, 2020
1 parent ee1aaa7 commit f403aed
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ end
group :integration do
gem "berkshelf", ">= 4.3.5"
gem "kitchen-dokken"
gem "kitchen-docker", ">= 2.10.0"
end

group :tools do
Expand Down
34 changes: 34 additions & 0 deletions spec/kitchen/verifier/inspec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
require "kitchen/transport/exec"
require "kitchen/transport/ssh"
require "kitchen/transport/winrm"
require "kitchen/transport/docker"

describe Kitchen::Verifier::Inspec do

Expand Down Expand Up @@ -664,6 +665,39 @@
end
end

context "with a docker transport" do

let(:transport) do
Kitchen::Transport::Docker.new
end

let(:runner) do
instance_double("Inspec::Runner")
end

before do
allow(runner).to receive(:add_target)
allow(runner).to receive(:run).and_return 0
end

it "constructs a Inspec::Runner using transport config data and state" do
expect(Inspec::Runner).to receive(:new)
.with(
hash_including(
"backend" => "docker",
:backend_cache => true,
"color" => true,
:controls => nil,
"host" => nil,
"logger" => logger
)
)
.and_return(runner)

verifier.call({})
end
end

context "with an unsupported transport" do

it "#call raises a UserError" do
Expand Down

0 comments on commit f403aed

Please sign in to comment.