Skip to content

Commit 997032e

Browse files
davejrtflorindragos
authored andcommitted
fixing acceptance tests on debian (#393)
* fixing acceptance tests on debian * fixing rubocop * indentation in rubocop
1 parent 9afc809 commit 997032e

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

Diff for: spec/acceptance/docker_full_spec.rb

+17-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
require 'spec_helper_acceptance'
22

3-
if fact('osfamily') == 'windows'
3+
if fact('operatingsystem') == 'windows'
44
docker_args = 'docker_ee => true'
55
default_image = 'microsoft/nanoserver'
66
default_image_tag = '10.0.14393.2189'
77
second_image = 'hello-world'
88
default_digest = 'sha256:204c41542c0927ac0296802e44c56b886b47e99cf8220fb49d46951bd5fc1742'
99
default_dockerfile = 'C:/Users/Administrator/AppData/Local/Temp/Dockerfile'
1010
dockerfile_test = 'C:/Windows/Dockerfile_test.txt'
11-
#The default args are set because:
12-
#restart => 'always' - there is no service created to manage containers
11+
#The default args are set because:
12+
#restart => 'always' - there is no service created to manage containers
1313
#net => 'nat' - docker uses bridged by default when running a container. When installing docker on windows the default network is NAT.
1414
default_docker_run_arg = "restart => 'always', net => 'nat',"
1515
default_run_command = "ping 127.0.0.1 -t"
@@ -18,7 +18,7 @@
1818
default_docker_exec_command = 'cmd /c "echo test > c:\windows\temp\test_file.txt"'
1919
docker_mount_path = 'C:/Users/Administrator/AppData/Local/Temp'
2020
storage_driver = "windowsfilter"
21-
elsif fact('osfamily') == 'RedHat'
21+
elsif fact('operatingsystem') == 'RedHat'
2222
docker_args = "repo_opt => '--enablerepo=localmirror-extras'"
2323
default_image = 'alpine'
2424
second_image = 'busybox'
@@ -47,7 +47,13 @@
4747
default_docker_exec_lr_command = '/bin/sh -c "touch /root/test_file.txt; while true; do echo hello world; sleep 1; done"'
4848
default_docker_exec_command = 'touch /root/test_file.txt'
4949
docker_mount_path = "/root"
50-
storage_driver = "overlay2"
50+
if fact('operatingsystem') == 'Ubuntu'
51+
storage_driver = "overlay2"
52+
elsif fact('operatingsystem') == 'Debian' && fact('os.release.major') == '9'
53+
storage_driver = "overlay2"
54+
elsif fact('operatingsystem') == 'Debian' && fact('os.release.major') == '8'
55+
storage_driver = "aufs"
56+
end
5157
end
5258

5359
describe 'the Puppet Docker module' do
@@ -87,7 +93,7 @@ class { 'docker': #{docker_args} }
8793
end
8894

8995
it 'should be start a docker process' do
90-
if fact('osfamily') == 'windows'
96+
if fact('osfamily') == 'windows'
9197
shell('powershell Get-Process -Name dockerd') do |r|
9298
expect(r.stdout).to match(/ProcessName/)
9399
end
@@ -163,7 +169,7 @@ class {'docker':
163169
storage_driver => "#{storage_driver}",
164170
}
165171
EOS
166-
172+
167173
apply_manifest(@pp, :catch_failures => true)
168174
sleep 15
169175
end
@@ -172,8 +178,8 @@ class {'docker':
172178
shell("#{docker_command} info -f \"{{ .Driver}}\"") do |r|
173179
expect(r.stdout).to match (/#{storage_driver}/)
174180
end
175-
end
176-
end
181+
end
182+
end
177183

178184
context 'passing a TCP address to bind to' do
179185
before(:all) do
@@ -223,7 +229,7 @@ class { 'docker':
223229
end
224230

225231
it 'should show docker listening on the specified unix socket' do
226-
if fact('osfamily') != 'windows'
232+
if fact('osfamily') != 'windows'
227233
shell('ps aux | grep docker') do |r|
228234
expect(r.stdout).to match(/unix:\/\/\/var\/run\/docker.sock/)
229235
end
@@ -799,7 +805,7 @@ class { 'docker': #{docker_args} }
799805
apply_manifest(pp, :catch_changes => true) unless fact('selinux') == 'true'
800806

801807
end
802-
808+
803809
it 'should restart a unhealthy container' do
804810
pp5=<<-EOS
805811
docker::run { 'container_3_7_3':

Diff for: spec/spec_helper_acceptance.rb

+3
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ def retry_on_error_matching(max_retry_count = 3, retry_wait_interval_secs = 5, e
7575
on(host, 'yum install -y net-tools device-mapper')
7676
end
7777

78+
if fact_on(host, 'operatingsystem') == 'Debian'
79+
on(host, 'apt-get install net-tools')
80+
end
7881
docker_compose_content_v3 = <<-EOS
7982
version: "3.4"
8083
x-images:

0 commit comments

Comments
 (0)