Merge pull request #3673 from mitchellh/rename-docker-provider-specs

providers/docker: Rename test files for consistency
This commit is contained in:
Mitchell Hashimoto 2014-05-07 09:30:40 -07:00
commit 7a1dc1e527
4 changed files with 15 additions and 4 deletions

View File

@ -29,7 +29,7 @@ module VagrantPlugins
def create(params, **opts, &block)
image = params.fetch(:image)
links = params.fetch(:links)
links = Array(params.fetch(:links))
ports = Array(params[:ports])
volumes = Array(params[:volumes])
name = params.fetch(:name)
@ -41,7 +41,7 @@ module VagrantPlugins
run_cmd << "-d" if params[:detach]
run_cmd += env.map { |k,v| ['-e', "#{k}=#{v}"] }
run_cmd += expose.map { |p| ['--expose', "#{p}"] }
run_cmd += links.map { |k, v| ['--link', "#{k}:#{v}"] }
run_cmd += links.map { |l| ['--link', "#{l}"] }
run_cmd += ports.map { |p| ['-p', p.to_s] }
run_cmd += volumes.map { |v| ['-v', v.to_s] }
run_cmd += %W(--privileged) if params[:privileged]

View File

@ -16,6 +16,9 @@ describe VagrantPlugins::DockerProvider::Driver do
cmd: ['play', 'voodoo-chile'],
ports: '8080:80',
volumes: '/host/path:guest/path',
detach: true,
links: 'janis:joplin',
env: {key: 'value'},
name: cid,
hostname: 'jimi-hendrix',
privileged: true
@ -28,7 +31,7 @@ describe VagrantPlugins::DockerProvider::Driver do
end
it 'sets container name' do
expect(cmd_executed).to match(/-name #{Regexp.escape params[:name]}/)
expect(cmd_executed).to match(/--name #{Regexp.escape params[:name]}/)
end
it 'forwards ports' do
@ -39,8 +42,16 @@ describe VagrantPlugins::DockerProvider::Driver do
expect(cmd_executed).to match(/-v #{params[:volumes]} .+ #{Regexp.escape params[:image]}/)
end
it 'links containers' do
expect(cmd_executed).to match(/--link #{params[:links]} .+ #{Regexp.escape params[:image]}/)
end
it 'sets environmental variables' do
expect(cmd_executed).to match(/-e key=value .+ #{Regexp.escape params[:image]}/)
end
it 'is able to run a privileged container' do
expect(cmd_executed).to match(/-privileged .+ #{Regexp.escape params[:image]}/)
expect(cmd_executed).to match(/--privileged .+ #{Regexp.escape params[:image]}/)
end
it 'sets the hostname if specified' do