beaker 2.37.0 → 2.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/HISTORY.md +58 -2
- data/lib/beaker/command.rb +5 -1
- data/lib/beaker/host/cisco.rb +17 -6
- data/lib/beaker/hypervisor/docker.rb +47 -20
- data/lib/beaker/network_manager.rb +4 -2
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/host/cisco_spec.rb +90 -49
- data/spec/beaker/hypervisor/docker_spec.rb +34 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjBkMjI0OGY1ZWIwZTA1Mjg5NmVhZGQ4MGQzODgyNDdhNGI4Y2ZmNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Zjg4ZGJhNmExMGRjYWRmMmFiNWY5ODY0YmU2NDQ5ZWQ3OGEzYzdjMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGI3NjQ1ZTYyYTRkYTA2OTUwYjI5Mzg2YjQxYjZkZTFiZjczNjE3NTQyNjFj
|
10
|
+
NTNkYTNhOGIxNDFkYmRhYzljMjYwYThmOTRjMmU5MzVmNjQxMTI2YzA3NzU2
|
11
|
+
YzAyNjY4YWYyMGYyMGQ0ZmE1N2JmYjNjMTdhM2U0OTNmYzNjODA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODViYThmNzkxYWEzMjY5MmVhM2VkMzFmMjg2ZTE4ODU4YWY0ZTAxMTA1N2Rj
|
14
|
+
ZmVkY2RkZGIxNDQyN2ExMWQzNmVlMDE1MzVjOWFiMGRhNDBkYjAzMmU0NDlh
|
15
|
+
Zjc0OWUwZGM0NTJkMzk2N2U3N2U5ZGFjYTUyOGRkYWQ0YzQ5MWU=
|
data/HISTORY.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# default - History
|
2
2
|
## Tags
|
3
|
-
* [LATEST -
|
3
|
+
* [LATEST - 30 Mar, 2016 (fa9fbc7d)](#LATEST)
|
4
|
+
* [2.37.0 - 15 Mar, 2016 (a6c2297b)](#2.37.0)
|
4
5
|
* [2.36.0 - 9 Mar, 2016 (5fd86b67)](#2.36.0)
|
5
6
|
* [2.35.0 - 24 Feb, 2016 (b20fa892)](#2.35.0)
|
6
7
|
* [2.34.0 - 10 Feb, 2016 (b897a98a)](#2.34.0)
|
@@ -112,7 +113,62 @@
|
|
112
113
|
* [pe1.2 - 6 Sep, 2011 (ba3dadd2)](#pe1.2)
|
113
114
|
|
114
115
|
## Details
|
115
|
-
### <a name = "LATEST">LATEST -
|
116
|
+
### <a name = "LATEST">LATEST - 30 Mar, 2016 (fa9fbc7d)
|
117
|
+
|
118
|
+
* (GEM) update beaker version to 2.38.0 (fa9fbc7d)
|
119
|
+
|
120
|
+
* Merge pull request #1085 from LuvCurves/BKR-749 (123bca82)
|
121
|
+
|
122
|
+
|
123
|
+
```
|
124
|
+
Merge pull request #1085 from LuvCurves/BKR-749
|
125
|
+
|
126
|
+
(BKR-749) Wrap Nexus Pre-commands
|
127
|
+
```
|
128
|
+
* Merge pull request #1077 from aaronbbrown/BKR-658 (75ca10fa)
|
129
|
+
|
130
|
+
|
131
|
+
```
|
132
|
+
Merge pull request #1077 from aaronbbrown/BKR-658
|
133
|
+
|
134
|
+
(BKR-658) Fix BEAKER_provision=no when using Docker
|
135
|
+
```
|
136
|
+
* (BKR-749) Wrap Nexus Pre-commands (c4eb29f2)
|
137
|
+
|
138
|
+
* Merge pull request #1081 from glennmatthews/cisco-user_pc (e6988252)
|
139
|
+
|
140
|
+
|
141
|
+
```
|
142
|
+
Merge pull request #1081 from glennmatthews/cisco-user_pc
|
143
|
+
|
144
|
+
(BKR-722) Don't clobber user_pc in prepend_commands for cisco host
|
145
|
+
```
|
146
|
+
* (BKR-658) refactor error message (eed36669)
|
147
|
+
|
148
|
+
* (BKR-722) cisco host#prepend_commands needs fixes for 'sudo' and user_pc (52b8a039)
|
149
|
+
|
150
|
+
* (BKR-658) remove empty before block (39713760)
|
151
|
+
|
152
|
+
* (BKR-658) fix BEAKER_provision=no for docker provisioner (5d1c4681)
|
153
|
+
|
154
|
+
|
155
|
+
```
|
156
|
+
(BKR-658) fix BEAKER_provision=no for docker provisioner
|
157
|
+
|
158
|
+
The Docker provisioner does not behave correctly when
|
159
|
+
BEAKER_provision=no is used from beaker-rspec. This corrects that
|
160
|
+
behavior so the container is reused. It defers to
|
161
|
+
::Docker::Container.create throwing raising an exception if
|
162
|
+
BEAKER_provision=yes and the container currently exists, rather than
|
163
|
+
blindly reusing the container (the previous behavior).
|
164
|
+
|
165
|
+
Also added is a best effort at sshd_config repair for root logins.
|
166
|
+
Puppet users will often disable root logins, which breaks Beaker, so
|
167
|
+
this attempts to revert such changes via Docker::Container#exec.
|
168
|
+
```
|
169
|
+
### <a name = "2.37.0">2.37.0 - 15 Mar, 2016 (a6c2297b)
|
170
|
+
|
171
|
+
* (HISTORY) update beaker history for gem release 2.37.0 (a6c2297b)
|
116
172
|
|
117
173
|
* (GEM) update beaker version to 2.37.0 (b7ed692c)
|
118
174
|
|
data/lib/beaker/command.rb
CHANGED
@@ -72,9 +72,13 @@ module Beaker
|
|
72
72
|
def cmd_line host, cmd = @command, env = @environment, pc = @prepend_cmds
|
73
73
|
env_string = host.environment_string( env )
|
74
74
|
prepend_commands = host.prepend_commands( cmd, pc, :cmd_exe => @cmdexe )
|
75
|
+
if host[:platform] =~ /cisco_nexus/ && host[:user] != 'root'
|
76
|
+
append_command = '"'
|
77
|
+
cmd = cmd.gsub('"') { '\\"' }
|
78
|
+
end
|
75
79
|
|
76
80
|
# This will cause things like `puppet -t -v agent` which is maybe bad.
|
77
|
-
cmd_line_array = [env_string, prepend_commands, cmd, options_string, args_string]
|
81
|
+
cmd_line_array = [env_string, prepend_commands, cmd, options_string, args_string, append_command]
|
78
82
|
cmd_line_array.compact.reject( &:empty? ).join( ' ' )
|
79
83
|
end
|
80
84
|
|
data/lib/beaker/host/cisco.rb
CHANGED
@@ -71,11 +71,14 @@ module Cisco
|
|
71
71
|
def prepend_commands(command = '', user_pc = '', opts = {})
|
72
72
|
return user_pc unless command.index('vsh').nil?
|
73
73
|
|
74
|
-
prepend_cmds = '
|
74
|
+
prepend_cmds = ''
|
75
75
|
if self[:vrf]
|
76
|
-
prepend_cmds << "
|
76
|
+
prepend_cmds << "ip netns exec #{self[:vrf]} "
|
77
77
|
end
|
78
|
-
|
78
|
+
if user_pc && !user_pc.empty?
|
79
|
+
prepend_cmds << "#{user_pc} "
|
80
|
+
end
|
81
|
+
prepend_cmds.strip
|
79
82
|
end
|
80
83
|
|
81
84
|
# Construct the environment string for this command
|
@@ -90,12 +93,20 @@ module Cisco
|
|
90
93
|
# will ensure the environment is correctly set for the
|
91
94
|
# given host.
|
92
95
|
def environment_string env
|
93
|
-
|
96
|
+
prestring = 'source /etc/profile;'
|
97
|
+
prestring << " sudo sh -c \"" if self[:user] != 'root'
|
98
|
+
return prestring if env.empty?
|
94
99
|
env_array = self.environment_variable_string_pair_array( env )
|
95
100
|
environment_string = env_array.join(' ')
|
96
101
|
|
97
|
-
|
98
|
-
|
102
|
+
if self[:platform] =~ /cisco_nexus/
|
103
|
+
prestring << " export"
|
104
|
+
else
|
105
|
+
prestring << " env"
|
106
|
+
end
|
107
|
+
environment_string = "#{prestring} #{environment_string}"
|
108
|
+
environment_string << ';' if prestring =~ /export/
|
109
|
+
environment_string
|
99
110
|
end
|
100
111
|
|
101
112
|
# Validates that the host was setup correctly
|
@@ -68,34 +68,36 @@ module Beaker
|
|
68
68
|
'Image' => image_name,
|
69
69
|
'Hostname' => host.name,
|
70
70
|
}
|
71
|
+
container = find_container(host)
|
71
72
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
73
|
+
# If the specified container exists, then use it rather creating a new one
|
74
|
+
if container.nil?
|
75
|
+
unless host['mount_folders'].nil?
|
76
|
+
container_opts['HostConfig'] ||= {}
|
77
|
+
container_opts['HostConfig']['Binds'] = host['mount_folders'].values.map do |mount|
|
78
|
+
a = [ File.expand_path(mount['host_path']), mount['container_path'] ]
|
79
|
+
a << mount['opts'] if mount.has_key?('opts')
|
80
|
+
a.join(':')
|
81
|
+
end
|
81
82
|
end
|
82
|
-
end
|
83
83
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
84
|
+
if @options[:provision]
|
85
|
+
if host['docker_container_name']
|
86
|
+
container_opts['name'] = host['docker_container_name']
|
87
|
+
end
|
88
|
+
|
89
|
+
@logger.debug("Creating container from image #{image_name}")
|
90
|
+
container = ::Docker::Container.create(container_opts)
|
90
91
|
end
|
91
92
|
end
|
92
93
|
|
93
|
-
# If the specified container exists, then use it rather creating a new one
|
94
94
|
if container.nil?
|
95
|
-
|
96
|
-
|
95
|
+
raise RuntimeError, 'Cannot continue because no existing container ' +
|
96
|
+
'could be found and provisioning is disabled.'
|
97
97
|
end
|
98
98
|
|
99
|
+
fix_ssh(container) if @options[:provision] == false
|
100
|
+
|
99
101
|
@logger.debug("Starting container #{container.id}")
|
100
102
|
container.start({"PublishAllPorts" => true, "Privileged" => true})
|
101
103
|
|
@@ -268,10 +270,35 @@ module Beaker
|
|
268
270
|
EOF
|
269
271
|
|
270
272
|
end
|
271
|
-
|
273
|
+
|
272
274
|
@logger.debug("Dockerfile is #{dockerfile}")
|
273
275
|
return dockerfile
|
274
276
|
end
|
275
277
|
|
278
|
+
# a puppet run may have changed the ssh config which would
|
279
|
+
# keep us out of the container. This is a best effort to fix it.
|
280
|
+
def fix_ssh(container)
|
281
|
+
@logger.debug("Fixing ssh on container #{container.id}")
|
282
|
+
container.exec(['sed','-ri',
|
283
|
+
's/^#?PermitRootLogin .*/PermitRootLogin yes/',
|
284
|
+
'/etc/ssh/sshd_config'])
|
285
|
+
container.exec(['sed','-ri',
|
286
|
+
's/^#?PasswordAuthentication .*/PasswordAuthentication yes/',
|
287
|
+
'/etc/ssh/sshd_config'])
|
288
|
+
container.exec(%w(service ssh restart))
|
289
|
+
end
|
290
|
+
|
291
|
+
|
292
|
+
# return the existing container if we're not provisioning
|
293
|
+
# and docker_container_name is set
|
294
|
+
def find_container(host)
|
295
|
+
return nil if host['docker_container_name'].nil? || @options[:provision]
|
296
|
+
@logger.debug("Looking for an existing container called #{host['docker_container_name']}")
|
297
|
+
|
298
|
+
::Docker::Container.all.select do |c|
|
299
|
+
c.info['Names'].include? "/#{host['docker_container_name']}"
|
300
|
+
end.first
|
301
|
+
end
|
302
|
+
|
276
303
|
end
|
277
304
|
end
|
@@ -12,11 +12,13 @@ module Beaker
|
|
12
12
|
# - only if we are running with ---provision
|
13
13
|
# - only if we have a hypervisor
|
14
14
|
# - only if either the specific hosts has no specification or has 'provision' in its config
|
15
|
-
# - always if it is a vagrant box (vagrant boxes are always provisioned
|
15
|
+
# - always if it is a vagrant or docker box (vagrant boxes are always provisioned
|
16
|
+
# as they always need ssh key hacking. docker boxes need to have docker_container_name
|
17
|
+
# specified)
|
16
18
|
def provision? options, host
|
17
19
|
command_line_says = options[:provision]
|
18
20
|
host_says = host['hypervisor'] && (host.has_key?('provision') ? host['provision'] : true)
|
19
|
-
(command_line_says && host_says) or (host['hypervisor'] =~/vagrant/)
|
21
|
+
(command_line_says && host_says) or (host['hypervisor'] =~/(vagrant|docker)/)
|
20
22
|
end
|
21
23
|
|
22
24
|
def initialize(options, logger)
|
data/lib/beaker/version.rb
CHANGED
@@ -24,32 +24,24 @@ module Cisco
|
|
24
24
|
vrf_answer = 'vrf_answer_135246'
|
25
25
|
@options = {
|
26
26
|
:vrf => vrf_answer,
|
27
|
-
:user => 'notroot',
|
28
27
|
}
|
29
28
|
answer_test = host.prepend_commands( 'fake_command' )
|
30
|
-
expect( answer_test ).to match(
|
29
|
+
expect( answer_test ).to match( /ip netns exec #{vrf_answer}$/ )
|
31
30
|
end
|
32
31
|
|
33
|
-
it '
|
34
|
-
|
35
|
-
|
32
|
+
it 'guards against "vsh" usage (only scenario we dont want prefixing)' do
|
33
|
+
answer_prepend_commands = 'pc_param_unchanged_13584'
|
34
|
+
answer_test = host.prepend_commands( 'fake/vsh/command', answer_prepend_commands )
|
35
|
+
expect( answer_test ).to be === answer_prepend_commands
|
36
36
|
end
|
37
37
|
|
38
|
-
it '
|
38
|
+
it 'retains user-specified prepend commands when adding vrf' do
|
39
39
|
@options = {
|
40
40
|
:vrf => 'fakevrf',
|
41
|
-
:user => 'notroot',
|
42
41
|
}
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
expect( command_actual ).to match( /^sudo / )
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'guards against "vsh" usage (only scenario we dont want prefixing)' do
|
50
|
-
answer_prepend_commands = 'pc_param_unchanged_13584'
|
51
|
-
answer_test = host.prepend_commands( 'fake/vsh/command', answer_prepend_commands )
|
52
|
-
expect( answer_test ).to be === answer_prepend_commands
|
42
|
+
answer_prepend_commands = 'prepend'
|
43
|
+
answer_test = host.prepend_commands( 'fake_command', answer_prepend_commands )
|
44
|
+
expect( answer_test ).to match( /^ip netns exec fakevrf #{answer_prepend_commands}/ )
|
53
45
|
end
|
54
46
|
end
|
55
47
|
|
@@ -59,52 +51,101 @@ module Cisco
|
|
59
51
|
@platform = 'cisco_ios_xr-6-x86_64'
|
60
52
|
end
|
61
53
|
|
62
|
-
it '
|
63
|
-
|
64
|
-
expect( answer_test ).to match( /^#{Regexp.escape('source /etc/profile;')}/ )
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'does not use sudo, as root is allowed' do
|
54
|
+
it 'does use the :vrf host parameter if provided' do
|
55
|
+
@options = { :vrf => 'tpnns' }
|
68
56
|
answer_test = host.prepend_commands( 'fake_command' )
|
69
|
-
expect( answer_test ).
|
57
|
+
expect( answer_test ).to match( /ip netns exec tpnns/ )
|
70
58
|
end
|
71
59
|
|
72
|
-
it '
|
73
|
-
|
74
|
-
|
60
|
+
it 'retains user-specified prepend commands when adding vrf' do
|
61
|
+
@options = { :vrf => 'fakevrf', }
|
62
|
+
answer_prepend_commands = 'prepend'
|
63
|
+
answer_test = host.prepend_commands( 'fake_command', answer_prepend_commands )
|
64
|
+
expect( answer_test ).to match( /^ip netns exec fakevrf #{answer_prepend_commands}/ )
|
75
65
|
end
|
76
|
-
|
77
66
|
end
|
78
67
|
end
|
79
68
|
|
80
69
|
describe '#environment_string' do
|
81
70
|
|
82
|
-
it 'starts with
|
83
|
-
|
84
|
-
|
85
|
-
answer_test = host.environment_string( env_map )
|
86
|
-
expect( answer_test ).to match( /^env\ / )
|
71
|
+
it 'starts with sourcing the /etc/profile script' do
|
72
|
+
answer_test = host.environment_string( {} )
|
73
|
+
expect( answer_test ).to match( %r{^source /etc/profile;} )
|
87
74
|
end
|
88
75
|
|
89
|
-
it '
|
90
|
-
@
|
91
|
-
|
92
|
-
answer_test
|
93
|
-
expect( answer_test ).to match( /^export\ / )
|
76
|
+
it 'uses `sudo` if not root' do
|
77
|
+
@options = { :user => 'notroot' }
|
78
|
+
answer_test = host.environment_string( {} )
|
79
|
+
expect( answer_test ).to match( /sudo/ )
|
94
80
|
end
|
95
81
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
82
|
+
context 'for cisco_nexus-7' do
|
83
|
+
|
84
|
+
before :each do
|
85
|
+
@platform = 'cisco_nexus-7-x86_64'
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'uses `sudo` if not root' do
|
89
|
+
@options = { :user => 'notroot' }
|
90
|
+
env_map = { 'PATH' => '/opt/pants/2' }
|
91
|
+
answer_test = host.environment_string( env_map )
|
92
|
+
expect( answer_test ).to match( %r{^source /etc/profile; sudo } )
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'uses `export` if root' do
|
96
|
+
@options = { :user => 'root' }
|
97
|
+
env_map = { 'PATH' => '/opt/pants/2' }
|
98
|
+
answer_test = host.environment_string( env_map )
|
99
|
+
expect( answer_test ).to match( %r{^source /etc/profile; export } )
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'ends with a semi-colon' do
|
103
|
+
env_map = { 'PATH' => '/opt/pants/3' }
|
104
|
+
answer_test = host.environment_string( env_map )
|
105
|
+
expect( answer_test ).to match( /\;$/ )
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'turns env maps into paired strings correctly' do
|
109
|
+
@options = { :user => 'root' }
|
110
|
+
env_map = { 'var1' => 'ans1', 'var2' => 'ans2' }
|
111
|
+
answer_correct = 'source /etc/profile; export VAR1="ans1" VAR2="ans2";'
|
112
|
+
answer_test = host.environment_string( env_map )
|
113
|
+
expect( answer_test ).to be === answer_correct
|
114
|
+
end
|
100
115
|
end
|
101
116
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
117
|
+
context 'for cisco_ios_xr-6' do
|
118
|
+
before :each do
|
119
|
+
@platform = 'cisco_ios_xr-6-x86_64'
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'uses `sudo` if not root' do
|
123
|
+
@options = { :user => 'notroot' }
|
124
|
+
env_map = { 'PATH' => '/opt/pants/2' }
|
125
|
+
answer_test = host.environment_string( env_map )
|
126
|
+
expect( answer_test ).to match( %r{^source /etc/profile; sudo } )
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'uses `env` if root' do
|
130
|
+
@options = { :user => 'root' }
|
131
|
+
env_map = { 'PATH' => '/opt/pants/1' }
|
132
|
+
answer_test = host.environment_string( env_map )
|
133
|
+
expect( answer_test ).to match( %r{^source /etc/profile; env } )
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'does not end with a semi-colon' do
|
137
|
+
env_map = { 'PATH' => '/opt/pants/3' }
|
138
|
+
answer_test = host.environment_string( env_map )
|
139
|
+
expect( answer_test ).not_to match( /\;$/ )
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'turns env maps into paired strings correctly' do
|
143
|
+
@options = { :user => 'root' }
|
144
|
+
env_map = { 'var1' => 'ans1', 'var2' => 'ans2' }
|
145
|
+
answer_correct = 'source /etc/profile; env VAR1="ans1" VAR2="ans2"'
|
146
|
+
answer_test = host.environment_string( env_map )
|
147
|
+
expect( answer_test ).to be === answer_correct
|
148
|
+
end
|
108
149
|
end
|
109
150
|
end
|
110
151
|
|
@@ -191,4 +232,4 @@ module Cisco
|
|
191
232
|
end
|
192
233
|
end
|
193
234
|
end
|
194
|
-
end
|
235
|
+
end
|
@@ -34,6 +34,7 @@ module Beaker
|
|
34
34
|
let(:options) {{
|
35
35
|
:logger => logger,
|
36
36
|
:forward_ssh_agent => true,
|
37
|
+
:provision => true
|
37
38
|
}}
|
38
39
|
|
39
40
|
let(:image) do
|
@@ -66,6 +67,7 @@ module Beaker
|
|
66
67
|
})
|
67
68
|
allow( container ).to receive(:stop)
|
68
69
|
allow( container ).to receive(:delete)
|
70
|
+
allow( container ).to receive(:exec)
|
69
71
|
container
|
70
72
|
end
|
71
73
|
|
@@ -181,8 +183,6 @@ module Beaker
|
|
181
183
|
container_name = "spec-container-#{index}"
|
182
184
|
host['docker_container_name'] = container_name
|
183
185
|
|
184
|
-
expect( ::Docker::Container ).to receive(:all).and_return([])
|
185
|
-
|
186
186
|
expect( ::Docker::Container ).to receive(:create).with({
|
187
187
|
'Image' => image.id,
|
188
188
|
'Hostname' => host.name,
|
@@ -193,17 +193,6 @@ module Beaker
|
|
193
193
|
docker.provision
|
194
194
|
end
|
195
195
|
|
196
|
-
it 'should not create a container if a named one already exists' do
|
197
|
-
hosts.each_with_index do |host, index|
|
198
|
-
container_name = "spec-container-#{index}"
|
199
|
-
host['docker_container_name'] = container_name
|
200
|
-
|
201
|
-
expect( ::Docker::Container ).to receive(:all).and_return([container])
|
202
|
-
expect( ::Docker::Container ).not_to receive(:create)
|
203
|
-
end
|
204
|
-
|
205
|
-
docker.provision
|
206
|
-
end
|
207
196
|
|
208
197
|
it 'should create a container with volumes bound' do
|
209
198
|
hosts.each_with_index do |host, index|
|
@@ -305,6 +294,38 @@ module Beaker
|
|
305
294
|
expect( hosts[0]['docker_image'] ).to be === image
|
306
295
|
expect( hosts[0]['docker_container'] ).to be === container
|
307
296
|
end
|
297
|
+
|
298
|
+
context 'provision=false' do
|
299
|
+
let(:options) {{
|
300
|
+
:logger => logger,
|
301
|
+
:forward_ssh_agent => true,
|
302
|
+
:provision => false
|
303
|
+
}}
|
304
|
+
|
305
|
+
|
306
|
+
it 'should fix ssh' do
|
307
|
+
hosts.each_with_index do |host, index|
|
308
|
+
container_name = "spec-container-#{index}"
|
309
|
+
host['docker_container_name'] = container_name
|
310
|
+
|
311
|
+
expect( ::Docker::Container ).to receive(:all).and_return([container])
|
312
|
+
expect(container).to receive(:exec).exactly(3).times
|
313
|
+
end
|
314
|
+
docker.provision
|
315
|
+
end
|
316
|
+
|
317
|
+
it 'should not create a container if a named one already exists' do
|
318
|
+
hosts.each_with_index do |host, index|
|
319
|
+
container_name = "spec-container-#{index}"
|
320
|
+
host['docker_container_name'] = container_name
|
321
|
+
|
322
|
+
expect( ::Docker::Container ).to receive(:all).and_return([container])
|
323
|
+
expect( ::Docker::Container ).not_to receive(:create)
|
324
|
+
end
|
325
|
+
|
326
|
+
docker.provision
|
327
|
+
end
|
328
|
+
end
|
308
329
|
end
|
309
330
|
|
310
331
|
describe '#cleanup' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.38.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|