spec/beaker/hypervisor/docker_spec.rb in beaker-1.13.1 vs spec/beaker/hypervisor/docker_spec.rb in beaker-1.14.0
- old
+ new
@@ -34,10 +34,11 @@
container = double('Docker::Container')
container.stub(:id)
container.stub(:start)
container.stub(:json).and_return({
'NetworkSettings' => {
+ 'IPAddress' => '192.0.2.1',
'Ports' => {
'22/tcp' => [
{
'HostIp' => '127.0.1.1',
'HostPort' => 8022,
@@ -131,14 +132,28 @@
container.should_receive(:start).with({'PublishAllPorts' => true, 'Privileged' => true})
docker.provision
end
- it 'should expose port 22 to beaker' do
- docker.provision
+ context "connecting to ssh" do
+ before { @docker_host = ENV['DOCKER_HOST'] }
+ after { ENV['DOCKER_HOST'] = @docker_host }
- hosts[0]['ip'].should == '127.0.1.1'
- hosts[0]['port'].should == 8022
+ it 'should expose port 22 to beaker' do
+ ENV['DOCKER_HOST'] = nil
+ docker.provision
+
+ hosts[0]['ip'].should == '127.0.1.1'
+ hosts[0]['port'].should == 8022
+ end
+
+ it 'should expose port 22 to beaker when using DOCKER_HOST' do
+ ENV['DOCKER_HOST'] = "tcp://192.0.2.2:2375"
+ docker.provision
+
+ hosts[0]['ip'].should == '192.0.2.2'
+ hosts[0]['port'].should == 8022
+ end
end
it 'should record the image and container for later' do
docker.provision