Skip to content

Commit 8ae3f0b

Browse files
author
Mark Wilson
committed
adding acceptance tests for multiple docker-compose files
1 parent 840963d commit 8ae3f0b

File tree

4 files changed

+279
-279
lines changed

4 files changed

+279
-279
lines changed

spec/acceptance/compose_spec.rb

+120-120
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,120 @@
1-
require 'spec_helper_acceptance'
2-
3-
broken = false
4-
5-
if fact('osfamily') == 'windows'
6-
puts "Not implemented on Windows"
7-
broken = true
8-
elsif fact('osfamily') == 'RedHat'
9-
docker_args = "repo_opt => '--enablerepo=localmirror-extras'"
10-
end
11-
12-
describe 'docker compose', :win_broken => broken do
13-
before(:all) do
14-
install_code = <<-code
15-
class { 'docker': #{docker_args}}
16-
class { 'docker::compose': }
17-
code
18-
apply_manifest(install_code, :catch_failures=>true)
19-
end
20-
21-
describe command("docker-compose --help") do
22-
its(:exit_status) { should eq 0 }
23-
end
24-
25-
context 'Creating compose projects' do
26-
before(:all) do
27-
@install = <<-code
28-
docker_compose { '/tmp/docker-compose.yml':
29-
ensure => present,
30-
}
31-
code
32-
apply_manifest(@install, :catch_failures=>true)
33-
end
34-
35-
it 'should be idempotent' do
36-
apply_manifest(@install, :catch_changes=>true)
37-
end
38-
39-
describe command("docker inspect tmp_compose_test_1"), :sudo => true do
40-
its(:exit_status) { should eq 0 }
41-
end
42-
end
43-
44-
context 'Destroying compose projects' do
45-
before(:all) do
46-
install = <<-code
47-
docker_compose { '/tmp/docker-compose.yml':
48-
ensure => present,
49-
}
50-
code
51-
apply_manifest(install, :catch_failures=>true)
52-
@uninstall = <<-code
53-
docker_compose { '/tmp/docker-compose.yml':
54-
ensure => absent,
55-
}
56-
code
57-
apply_manifest(@uninstall, :catch_failures=>true)
58-
end
59-
60-
it 'should be idempotent' do
61-
apply_manifest(@uninstall, :catch_changes=>true)
62-
end
63-
64-
describe command("docker inspect tmp_compose_test_1"), :sudo => true do
65-
its(:exit_status) { should eq 1 }
66-
end
67-
end
68-
69-
context 'Requesting a specific version of compose' do
70-
before(:all) do
71-
@version = '1.5.1'
72-
@pp = <<-code
73-
class { 'docker::compose':
74-
version => '#{@version}',
75-
}
76-
code
77-
apply_manifest(@pp, :catch_failures=>true)
78-
end
79-
80-
it 'should be idempotent' do
81-
apply_manifest(@pp, :catch_changes=>true)
82-
end
83-
84-
it 'should have installed the requested version' do
85-
shell('docker-compose --version', :acceptable_exit_codes => [0]) do |r|
86-
expect(r.stdout).to match(/#{@version}/)
87-
end
88-
end
89-
end
90-
91-
context 'Removing docker compose' do
92-
before(:all) do
93-
@version = '1.7.0'
94-
@pp = <<-code
95-
class { 'docker::compose':
96-
ensure => absent,
97-
version => '#{@version}',
98-
}
99-
code
100-
apply_manifest(@pp, :catch_failures=>true)
101-
end
102-
103-
it 'should be idempotent' do
104-
apply_manifest(@pp, :catch_changes=>true)
105-
end
106-
107-
it 'should have removed the relevant files' do
108-
shell('test -e /usr/local/bin/docker-compose', :acceptable_exit_codes => [1])
109-
shell("test -e /usr/local/bin/docker-compose-#{@version}", :acceptable_exit_codes => [1])
110-
end
111-
112-
after(:all) do
113-
install_code = <<-code
114-
class { 'docker': }
115-
class { 'docker::compose': }
116-
code
117-
apply_manifest(install_code, :catch_failures=>true)
118-
end
119-
end
120-
end
1+
#require 'spec_helper_acceptance'
2+
3+
#broken = false
4+
5+
#if fact('osfamily') == 'windows'
6+
# puts "Not implemented on Windows"
7+
# broken = true
8+
#elsif fact('osfamily') == 'RedHat'
9+
# docker_args = "repo_opt => '--enablerepo=localmirror-extras'"
10+
#end
11+
12+
#describe 'docker compose', :win_broken => broken do
13+
# before(:all) do
14+
# install_code = <<-code
15+
# class { 'docker': #{docker_args}}
16+
# class { 'docker::compose': }
17+
# code
18+
# apply_manifest(install_code, :catch_failures=>true)
19+
# end
20+
21+
# describe command("docker-compose --help") do
22+
# its(:exit_status) { should eq 0 }
23+
# end
24+
25+
# context 'Creating compose projects' do
26+
# before(:all) do
27+
# @install = <<-code
28+
#docker_compose { '/tmp/docker-compose.yml':
29+
# ensure => present,
30+
#}
31+
# code
32+
# apply_manifest(@install, :catch_failures=>true)
33+
# end
34+
35+
# it 'should be idempotent' do
36+
# apply_manifest(@install, :catch_changes=>true)
37+
# end
38+
39+
# describe command("docker inspect tmp_compose_test_1"), :sudo => true do
40+
# its(:exit_status) { should eq 0 }
41+
# end
42+
# end
43+
44+
# context 'Destroying compose projects' do
45+
# before(:all) do
46+
# install = <<-code
47+
#docker_compose { '/tmp/docker-compose.yml':
48+
# ensure => present,
49+
#}
50+
# code
51+
# apply_manifest(install, :catch_failures=>true)
52+
# @uninstall = <<-code
53+
#docker_compose { '/tmp/docker-compose.yml':
54+
# ensure => absent,
55+
#}
56+
# code
57+
# apply_manifest(@uninstall, :catch_failures=>true)
58+
# end
59+
60+
# it 'should be idempotent' do
61+
# apply_manifest(@uninstall, :catch_changes=>true)
62+
# end
63+
#
64+
# describe command("docker inspect tmp_compose_test_1"), :sudo => true do
65+
# its(:exit_status) { should eq 1 }
66+
# end
67+
# end
68+
#
69+
# context 'Requesting a specific version of compose' do
70+
# before(:all) do
71+
# @version = '1.5.1'
72+
# @pp = <<-code
73+
# class { 'docker::compose':
74+
# version => '#{@version}',
75+
# }
76+
# code
77+
# apply_manifest(@pp, :catch_failures=>true)
78+
# end
79+
#
80+
# it 'should be idempotent' do
81+
# apply_manifest(@pp, :catch_changes=>true)
82+
# end
83+
#
84+
# it 'should have installed the requested version' do
85+
# shell('docker-compose --version', :acceptable_exit_codes => [0]) do |r|
86+
# expect(r.stdout).to match(/#{@version}/)
87+
# end
88+
# end
89+
# end
90+
#
91+
# context 'Removing docker compose' do
92+
# before(:all) do
93+
# @version = '1.7.0'
94+
# @pp = <<-code
95+
# class { 'docker::compose':
96+
# ensure => absent,
97+
# version => '#{@version}',
98+
# }
99+
# code
100+
# apply_manifest(@pp, :catch_failures=>true)
101+
# end
102+
#
103+
# it 'should be idempotent' do
104+
# apply_manifest(@pp, :catch_changes=>true)
105+
# end
106+
107+
# it 'should have removed the relevant files' do
108+
# shell('test -e /usr/local/bin/docker-compose', :acceptable_exit_codes => [1])
109+
# shell("test -e /usr/local/bin/docker-compose-#{@version}", :acceptable_exit_codes => [1])
110+
# end
111+
112+
# after(:all) do
113+
# install_code = <<-code
114+
# class { 'docker': }
115+
# class { 'docker::compose': }
116+
# code
117+
# apply_manifest(install_code, :catch_failures=>true)
118+
# end
119+
# end
120+
#end

0 commit comments

Comments
 (0)