Skip to content

Commit 3fdde4e

Browse files
author
Daniel Carabas
committed
Update acceptance tests
1 parent 2d6be68 commit 3fdde4e

7 files changed

+32
-34
lines changed

Diff for: provision.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
debian:
99
provisioner: vagrant
1010
images: ['debian/stretch64', 'debian/buster64']
11+
win:
12+
provisioner: vagrant
13+
images: ['gusztavvargadr/windows-server']
1114
release_checks:
1215
provisioner: vmpooler
1316
images: ['redhat-7-x86_64','centos-7-x86_64', 'ubuntu-1604-x86_64', 'ubuntu-1804-x86_64', 'debian-9-x86_64', 'debian-10-x86_64', 'win-2016-x86_64', 'win-2019-x86_64']

Diff for: spec/acceptance/compose_v3_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
file_extension = '.exe'
66
docker_args = 'docker_ee => true'
77
tmp_path = 'C:/cygwin64/tmp'
8-
test_container = if os[:release] =~ /2019/
8+
test_container = if os[:release] =~ %r{2019}
99
'nanoserver'
1010
else
1111
'nanoserver-sac2016'
@@ -39,7 +39,7 @@ class { 'docker::compose':
3939
end
4040
end
4141

42-
context 'Creating compose v3 projects' do
42+
context 'Creating compose v3 projects', win_broken: true do
4343
let(:install_pp) do
4444
<<-MANIFEST
4545
docker_compose { 'web':
@@ -62,7 +62,7 @@ class { 'docker::compose':
6262
end
6363
end
6464

65-
context 'creating compose projects with multi compose files' do
65+
context 'creating compose projects with multi compose files', win_broken: true do
6666
before(:all) do
6767
install_pp = <<-MANIFEST
6868
docker_compose { 'web1':
@@ -79,7 +79,7 @@ class { 'docker::compose':
7979
end
8080
end
8181

82-
context 'Destroying project with multiple compose files' do
82+
context 'Destroying project with multiple compose files', win_broken: true do
8383
let(:destroy_pp) do
8484
<<-MANIFEST
8585
docker_compose { 'web1':

Diff for: spec/acceptance/docker_custom_source_spec.rb

+4-5
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@ class { 'docker': #{docker_args} }
3333
end
3434

3535
it 'runs idempotently' do
36-
require 'pry'; binding.pry
37-
apply_manifest(pp, catch_changes: true) unless fact('selinux') == 'true'
36+
apply_manifest(pp, catch_changes: true) unless selinux == 'true'
3837
end
3938

4039
it 'is start a docker process' do
41-
if fact('osfamily') == 'windows'
40+
if os[:family] == 'windows'
4241
run_shell('powershell Get-Process -Name dockerd') do |r|
4342
expect(r.stdout).to match(%r{ProcessName})
4443
end
@@ -84,15 +83,15 @@ class { 'docker': #{docker_args} }
8483
EOS
8584

8685
apply_manifest(pp, catch_failures: true)
87-
apply_manifest(pp, catch_changes: true) unless fact('selinux') == 'true'
86+
apply_manifest(pp, catch_changes: true) unless selinux == 'true'
8887

8988
# A sleep to give docker time to execute properly
9089
sleep 15
9190

9291
run_shell("#{docker_command} ps", expect_failures: false)
9392

9493
apply_manifest(pp2, catch_failures: true)
95-
apply_manifest(pp2, catch_changes: true) unless fact('selinux') == 'true'
94+
apply_manifest(pp2, catch_changes: true) unless selinux == 'true'
9695

9796
# A sleep to give docker time to execute properly
9897
sleep 15

Diff for: spec/acceptance/docker_full_spec.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
end
5454

5555
describe 'the Puppet Docker module' do
56-
context 'clean up before each test' do
56+
context 'clean up before each test', win_broken: true do
5757
before(:each) do
5858
retry_on_error_matching(60, 5, %r{connection failure running}) do
5959
# Stop all container using systemd
@@ -74,7 +74,7 @@
7474
end
7575

7676
describe 'docker class' do
77-
context 'without any parameters' do
77+
context 'without any parameters', win_brokn: true do
7878
let(:pp) { "class { 'docker': #{docker_args} }" }
7979

8080
it 'runs successfully' do
@@ -673,7 +673,7 @@ class { 'docker': #{docker_args} }
673673
end
674674
end
675675

676-
it 'stops a running container' do
676+
it 'stops a running container', win_broken: true do
677677
pp = <<-EOS
678678
class { 'docker': #{docker_args} }
679679
@@ -835,7 +835,7 @@ class { 'docker': #{docker_args} }
835835
end
836836
end
837837

838-
describe 'docker::exec' do
838+
describe 'docker::exec', win_broken: true do
839839
it 'runs a command inside an already running container' do
840840
pp = <<-EOS
841841
class { 'docker': #{docker_args} }
@@ -894,7 +894,7 @@ class { 'docker': #{docker_args} }
894894
apply_manifest(pp_delete, catch_failures: true)
895895
end
896896

897-
it 'onlies run if notified when refreshonly is true' do
897+
it 'onlies run if notified when refreshonly is true', win_broken: true do
898898
container_name = 'container_4_2'
899899
pp = <<-EOS
900900
class { 'docker': #{docker_args} }

Diff for: spec/acceptance/docker_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
if os[:family] == 'windows'
88
result = run_shell("ipconfig | findstr /i 'ipv4'")
99
raise 'Could not retrieve ip address for Windows box' if result.exit_code != 0
10-
ip = result.stdout.split("\n")[0].split(':')[1].strip()
10+
ip = result.stdout.split("\n")[0].split(':')[1].strip
1111
@windows_ip = ip
1212
docker_arg = "docker_ee => true, extra_parameters => '\"insecure-registries\": [ \"#{@windows_ip}:5000\" ]'"
1313
docker_registry_image = 'stefanscherer/registry-windows'
@@ -194,7 +194,7 @@ class { 'docker': #{docker_arg}}
194194
sleep 10
195195
end
196196

197-
it 'is able to login to the registry', retry: 3, retry_wait: 10 do
197+
it 'is able to login to the registry', retry: 3, retry_wait: 10, win_broken: true do
198198
pp = <<-MANIFEST
199199
docker::registry { '#{registry_address}':
200200
username => 'username',
@@ -206,7 +206,7 @@ class { 'docker': #{docker_arg}}
206206
run_shell("test -e \"#{root_dir}/registry-auth-puppet_receipt_#{server_strip}_root\"", expect_failures: false)
207207
end
208208

209-
it 'is able to logout from the registry' do
209+
it 'is able to logout from the registry', win_broken: true do
210210
pp = <<-MANIFEST
211211
docker::registry { '#{registry_address}':
212212
ensure=> absent,

Diff for: spec/acceptance/stack_spec.rb

+11-12
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22

33
if os[:family] == 'windows'
44
docker_args = 'docker_ee => true'
5-
tmp_path = 'C:/cygwin64/tmp'
5+
tmp_path = 'C:\\tmp\\'
66
wait_for_container_seconds = 120
7-
87
else
9-
docker_args = if os[:name] == 'Ubuntu' && os[:release][:full] == '14.04'
8+
docker_args = if os[:name] == 'ubuntu' && os[:release][:full] == '14.04'
109
"version => '18.06.1~ce~3-0~ubuntu'"
1110
else
1211
''
1312
end
14-
tmp_path = '/tmp'
13+
tmp_path = '/tmp/'
1514
wait_for_container_seconds = 10
1615
end
1716

18-
describe 'docker stack' do
17+
describe 'docker stack', win_broken: true do
1918
before(:all) do
2019
retry_on_error_matching(60, 5, %r{connection failure running}) do
2120
install_pp = <<-MANIFEST
@@ -36,7 +35,7 @@ class { 'docker': #{docker_args} }
3635
let(:install_pp) do
3736
<<-MANIFEST
3837
docker_stack { 'web':
39-
compose_files => ['#{tmp_path}/docker-stack.yml'],
38+
compose_files => ['#{tmp_path}docker-stack.yml'],
4039
ensure => present,
4140
}
4241
MANIFEST
@@ -66,7 +65,7 @@ class { 'docker': #{docker_args} }
6665
let(:install) do
6766
<<-MANIFEST
6867
docker_stack { 'web':
69-
compose_files => ['#{tmp_path}/docker-stack.yml'],
68+
compose_files => ['#{tmp_path}docker-stack.yml'],
7069
ensure => present,
7170
}
7271
MANIFEST
@@ -75,7 +74,7 @@ class { 'docker': #{docker_args} }
7574
let(:destroy) do
7675
<<-MANIFEST
7776
docker_stack { 'web':
78-
compose_files => ['#{tmp_path}/docker-stack.yml'],
77+
compose_files => ['#{tmp_path}docker-stack.yml'],
7978
ensure => absent,
8079
}
8180
MANIFEST
@@ -103,7 +102,7 @@ class { 'docker': #{docker_args} }
103102
before(:all) do
104103
install_pp = <<-MANIFEST
105104
docker_stack { 'web':
106-
compose_files => ['#{tmp_path}/docker-stack.yml', '#{tmp_path}/docker-stack-override.yml'],
105+
compose_files => ['#{tmp_path}docker-stack.yml', '#{tmp_path}docker-stack-override.yml'],
107106
ensure => present,
108107
}
109108
MANIFEST
@@ -121,7 +120,7 @@ class { 'docker': #{docker_args} }
121120
let(:destroy_pp) do
122121
<<-MANIFEST
123122
docker_stack { 'web':
124-
compose_files => ['#{tmp_path}/docker-stack.yml', '#{tmp_path}/docker-stack-override.yml'],
123+
compose_files => ['#{tmp_path}docker-stack.yml', '#{tmp_path}docker-stack-override.yml'],
125124
ensure => absent,
126125
}
127126
MANIFEST
@@ -130,15 +129,15 @@ class { 'docker': #{docker_args} }
130129
before(:all) do
131130
install_pp = <<-MANIFEST
132131
docker_stack { 'web':
133-
compose_files => ['#{tmp_path}/docker-stack.yml', '#{tmp_path}/docker-stack-override.yml'],
132+
compose_files => ['#{tmp_path}docker-stack.yml', '#{tmp_path}docker-stack-override.yml'],
134133
ensure => present,
135134
}
136135
MANIFEST
137136
apply_manifest(install_pp, catch_failures: true)
138137

139138
destroy_pp = <<-MANIFEST
140139
docker_stack { 'web':
141-
compose_files => ['#{tmp_path}/docker-stack.yml', '#{tmp_path}/docker-stack-override.yml'],
140+
compose_files => ['#{tmp_path}docker-stack.yml', '#{tmp_path}docker-stack-override.yml'],
142141
ensure => absent,
143142
}
144143
MANIFEST

Diff for: spec/spec_helper_acceptance_local.rb

+2-5
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ def create_remote_file(name, full_name, file_content)
3838
# Add exclusive filter for Windows untill all the windows functionality is implemented
3939
c.filter_run_excluding win_broken: true
4040

41-
# Project root
42-
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
43-
4441
# Readable test descriptions
4542
c.formatter = :documentation
4643

@@ -58,7 +55,7 @@ def create_remote_file(name, full_name, file_content)
5855
run_shell('mv /etc/yum.repos.d/redhat.repo /etc/yum.repos.d/internal-mirror.repo', expect_failures: true)
5956
run_shell('rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm', expect_failures: true)
6057
run_shell('yum update -y -q')
61-
# run_shell('yum upgrade -y')
58+
# run_shell('yum upgrade -y')
6259
end
6360
if os[:family] == 'debian' || os[:family] == 'ubuntu'
6461
run_shell('apt-get update -y')
@@ -184,7 +181,7 @@ def create_remote_file(name, full_name, file_content)
184181
retry_on_error_matching(60, 5, %r{connection failure running}) do
185182
@windows_ip = ip
186183
end
187-
apply_manifest("class { 'docker': docker_ee => true, extra_parameters => '\"insecure-registries\": [ \"#{@windows_ip}:5000\" ]' }")
184+
apply_manifest("class { 'docker': docker_ee => true, extra_parameters => '\"insecure-registries\": [ \"#{@windows_ip}:5000\" ]' }", catch_failures: true)
188185
docker_path = '/cygdrive/c/Program Files/Docker'
189186
run_shell("set PATH \"%PATH%;C:\\Users\\Administrator\\AppData\\Local\\Temp;#{docker_path}\"")
190187
puts 'Waiting for box to come online'

0 commit comments

Comments
 (0)