Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/kitchen/driver/docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

require_relative "../docker/container/linux"
require_relative "../docker/container/windows"
require_relative "../docker/docker_version"
require_relative "../docker/helpers/cli_helper"
require_relative "../docker/helpers/container_helper"

Expand All @@ -37,6 +38,13 @@ class Docker < Kitchen::Driver::Base
include Kitchen::Docker::Helpers::ContainerHelper
include ShellOut

# Reported by `kitchen diagnose`, which is what a bug report is asked to
# include. The version is this gem's own: the transport used to report
# Kitchen::VERSION, which is Test Kitchen's, so a diagnose said the
# plugin was at whatever version Test Kitchen happened to be.
kitchen_driver_api_version 2
plugin_version Kitchen::Docker::DOCKER_VERSION

default_config :binary, "docker"
default_config :build_options, nil
default_config :build_tempdir, Dir.pwd
Expand Down
8 changes: 6 additions & 2 deletions lib/kitchen/transport/docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

require_relative "../docker/container/linux"
require_relative "../docker/container/windows"
require_relative "../docker/docker_version"

require_relative "../docker/helpers/inspec_helper"

Expand All @@ -31,8 +32,11 @@ class Docker < Kitchen::Transport::Base
# Raised when a docker command against the container fails.
class DockerFailed < TransportFailed; end

# kitchen_transport_api_version 1
plugin_version Kitchen::VERSION
# Reported by `kitchen diagnose`. plugin_version was Kitchen::VERSION,
# which is Test Kitchen's version rather than this gem's, so a diagnose
# reported the transport as 4.1.1 while kitchen-docker was at 3.3.4.
kitchen_transport_api_version 1
plugin_version Kitchen::Docker::DOCKER_VERSION

default_config :binary, "docker"
default_config :env_variables, nil
Expand Down
18 changes: 18 additions & 0 deletions spec/docker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@
require "spec_helper"

describe Kitchen::Driver::Docker do
# `kitchen diagnose` is what bug reports are asked to include, so what it
# says about the plugin has to be true. The transport reported
# Kitchen::VERSION, which is Test Kitchen's version, and the driver reported
# nothing at all.
describe "plugin metadata" do
it "reports this gem's version, not Test Kitchen's" do
expect(described_class.diagnose[:version]).to eq Kitchen::Docker::DOCKER_VERSION
end

it "does not report Test Kitchen's version" do
expect(described_class.diagnose[:version]).not_to eq Kitchen::VERSION
end

it "declares the driver API version it is written against" do
expect(described_class.diagnose[:api_version]).to eq 2
end
end

describe "#config_to_options" do
let(:config) {}
subject { described_class.new.send(:config_to_options, config) }
Expand Down
20 changes: 20 additions & 0 deletions spec/transport_docker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@
require "spec_helper"
require "kitchen/transport/docker"

describe Kitchen::Transport::Docker do
# `kitchen diagnose` is what bug reports are asked to include, so what it
# says about the plugin has to be true.
describe "plugin metadata" do
it "reports this gem's version, not Test Kitchen's" do
expect(described_class.diagnose[:version]).to eq Kitchen::Docker::DOCKER_VERSION
end

it "does not report Test Kitchen's version" do
# It did: `plugin_version Kitchen::VERSION` made a diagnose say the
# transport was at Test Kitchen's version rather than this gem's.
expect(described_class.diagnose[:version]).not_to eq Kitchen::VERSION
end

it "declares the transport API version it is written against" do
expect(described_class.diagnose[:api_version]).to eq 1
end
end
end

describe Kitchen::Transport::Docker::Connection do
let(:options) do
{
Expand Down
Loading