Skip to content

fixing acceptance tests on debian #393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 18, 2018
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
28 changes: 17 additions & 11 deletions spec/acceptance/docker_full_spec.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
require 'spec_helper_acceptance'

if fact('osfamily') == 'windows'
if fact('operatingsystem') == 'windows'
docker_args = 'docker_ee => true'
default_image = 'microsoft/nanoserver'
default_image_tag = '10.0.14393.2189'
second_image = 'hello-world'
default_digest = 'sha256:204c41542c0927ac0296802e44c56b886b47e99cf8220fb49d46951bd5fc1742'
default_dockerfile = 'C:/Users/Administrator/AppData/Local/Temp/Dockerfile'
dockerfile_test = 'C:/Windows/Dockerfile_test.txt'
#The default args are set because:
#restart => 'always' - there is no service created to manage containers
#The default args are set because:
#restart => 'always' - there is no service created to manage containers
#net => 'nat' - docker uses bridged by default when running a container. When installing docker on windows the default network is NAT.
default_docker_run_arg = "restart => 'always', net => 'nat',"
default_run_command = "ping 127.0.0.1 -t"
Expand All @@ -18,7 +18,7 @@
default_docker_exec_command = 'cmd /c "echo test > c:\windows\temp\test_file.txt"'
docker_mount_path = 'C:/Users/Administrator/AppData/Local/Temp'
storage_driver = "windowsfilter"
elsif fact('osfamily') == 'RedHat'
elsif fact('operatingsystem') == 'RedHat'
docker_args = "repo_opt => '--enablerepo=localmirror-extras'"
default_image = 'alpine'
second_image = 'busybox'
Expand Down Expand Up @@ -47,7 +47,13 @@
default_docker_exec_lr_command = '/bin/sh -c "touch /root/test_file.txt; while true; do echo hello world; sleep 1; done"'
default_docker_exec_command = 'touch /root/test_file.txt'
docker_mount_path = "/root"
storage_driver = "overlay2"
if fact('operatingsystem') == 'Ubuntu'
storage_driver = "overlay2"
elsif fact('operatingsystem') == 'Debian' && fact('os.release.major') == '9'
storage_driver = "overlay2"
elsif fact('operatingsystem') == 'Debian' && fact('os.release.major') == '8'
storage_driver = "aufs"
end
end

describe 'the Puppet Docker module' do
Expand Down Expand Up @@ -87,7 +93,7 @@ class { 'docker': #{docker_args} }
end

it 'should be start a docker process' do
if fact('osfamily') == 'windows'
if fact('osfamily') == 'windows'
shell('powershell Get-Process -Name dockerd') do |r|
expect(r.stdout).to match(/ProcessName/)
end
Expand Down Expand Up @@ -163,7 +169,7 @@ class {'docker':
storage_driver => "#{storage_driver}",
}
EOS

apply_manifest(@pp, :catch_failures => true)
sleep 15
end
Expand All @@ -172,8 +178,8 @@ class {'docker':
shell("#{docker_command} info -f \"{{ .Driver}}\"") do |r|
expect(r.stdout).to match (/#{storage_driver}/)
end
end
end
end
end

context 'passing a TCP address to bind to' do
before(:all) do
Expand Down Expand Up @@ -223,7 +229,7 @@ class { 'docker':
end

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

end

it 'should restart a unhealthy container' do
pp5=<<-EOS
docker::run { 'container_3_7_3':
Expand Down
3 changes: 3 additions & 0 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ def retry_on_error_matching(max_retry_count = 3, retry_wait_interval_secs = 5, e
on(host, 'yum install -y net-tools device-mapper')
end

if fact_on(host, 'operatingsystem') == 'Debian'
on(host, 'apt-get install net-tools')
end
docker_compose_content_v3 = <<-EOS
version: "3.4"
x-images:
Expand Down