Skip to content

Commit 2f87583

Browse files
author
John Duarte
committed
Merge pull request #145 from hunner/fix_beaker_tests
Update specs and fix FM-1361
2 parents 9057fca + 0d9e938 commit 2f87583

File tree

85 files changed

+294
-266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+294
-266
lines changed

Gemfile

-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ group :development, :test do
44
gem 'rake', :require => false
55
gem 'rspec-puppet', :require => false
66
gem 'puppetlabs_spec_helper', :require => false
7-
gem 'rspec-system', :require => false
8-
gem 'rspec-system-puppet', :require => false
9-
gem 'rspec-system-serverspec', :require => false
107
gem 'serverspec', :require => false
118
gem 'puppet-lint', :require => false
129
gem 'pry', :require => false

lib/puppet/provider/vcsrepo/git.rb

+4-5
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@
1010
has_features :bare_repositories, :reference_tracking, :ssh_identity, :multiple_remotes, :user, :depth
1111

1212
def create
13+
if @resource.value(:revision) and @resource.value(:ensure) == :bare
14+
fail("Cannot set a revision (#{@resource.value(:revision)}) on a bare repository")
15+
end
1316
if !@resource.value(:source)
1417
init_repository(@resource.value(:path))
1518
else
1619
clone_repository(@resource.value(:source), @resource.value(:path))
1720
if @resource.value(:revision)
18-
if @resource.value(:ensure) == :bare
19-
notice "Ignoring revision for bare repository"
20-
else
21-
checkout
22-
end
21+
checkout
2322
end
2423
if @resource.value(:ensure) != :bare
2524
update_submodules

spec/acceptance/beaker/git/basic_auth/basic_auth_checkout_http.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
teardown do
4040
on(host, "rm -fr #{tmpdir}")
41-
on(host, "ps ax | grep '#{ruby} #{tmpdir}/#{http_server_script}' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh")
41+
on(host, "ps ax | grep '#{ruby} #{tmpdir}/#{http_server_script}' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1")
4242
end
4343

4444
step 'checkout with puppet using basic auth' do
@@ -52,8 +52,8 @@
5252
}
5353
EOS
5454

55-
apply_manifest_on(host, pp)
56-
apply_manifest_on(host, pp)
55+
apply_manifest_on(host, pp, :catch_failures => true)
56+
apply_manifest_on(host, pp, :catch_changes => true)
5757
end
5858

5959
step "verify checkout" do

spec/acceptance/beaker/git/basic_auth/basic_auth_checkout_https.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
teardown do
4848
on(host, "rm -fr #{tmpdir}")
49-
on(host, "ps ax | grep '#{ruby} #{tmpdir}/#{http_server_script}' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh")
49+
on(host, "ps ax | grep '#{ruby} #{tmpdir}/#{http_server_script}' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1")
5050
end
5151

5252
step 'checkout with puppet using basic auth' do
@@ -60,8 +60,8 @@
6060
}
6161
EOS
6262

63-
apply_manifest_on(host, pp)
64-
apply_manifest_on(host, pp)
63+
apply_manifest_on(host, pp, :catch_failures => true)
64+
apply_manifest_on(host, pp, :catch_changes => true)
6565
end
6666

6767
step "verify checkout" do

spec/acceptance/beaker/git/basic_auth/negative/basic_auth_checkout_git.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
teardown do
2424
on(host, "rm -fr #{tmpdir}")
25-
on(host, 'pkill -9 git-daemon')
25+
on(host, 'pkill -9 git-daemon ; sleep 1')
2626
end
2727

2828
step 'checkout with puppet using basic auth' do
@@ -36,8 +36,8 @@
3636
}
3737
EOS
3838

39-
apply_manifest_on(host, pp)
40-
apply_manifest_on(host, pp)
39+
apply_manifest_on(host, pp, :catch_failures => true)
40+
apply_manifest_on(host, pp, :catch_changes => true)
4141
end
4242

4343
step "verify checkout (silent error for basic auth using git protocol)" do

spec/acceptance/beaker/git/branch_checkout/branch_checkout_file.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
}
2828
EOS
2929

30-
apply_manifest_on(host, pp)
31-
apply_manifest_on(host, pp)
30+
apply_manifest_on(host, pp, :catch_failures => true)
31+
apply_manifest_on(host, pp, :catch_changes => true)
3232
end
3333

3434
step "verify checkout is on the #{branch} branch" do

spec/acceptance/beaker/git/branch_checkout/branch_checkout_file_path.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
}
2828
EOS
2929

30-
apply_manifest_on(host, pp)
31-
apply_manifest_on(host, pp)
30+
apply_manifest_on(host, pp, :catch_failures => true)
31+
apply_manifest_on(host, pp, :catch_changes => true)
3232
end
3333

3434
step "verify checkout is on the #{branch} branch" do

spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
teardown do
2121
on(host, "rm -fr #{tmpdir}")
22-
on(host, 'pkill -9 git-daemon')
22+
on(host, 'pkill -9 git-daemon ; sleep 1')
2323
end
2424

2525
step 'checkout a branch with puppet' do
@@ -32,8 +32,8 @@
3232
}
3333
EOS
3434

35-
apply_manifest_on(host, pp)
36-
apply_manifest_on(host, pp)
35+
apply_manifest_on(host, pp, :catch_failures => true)
36+
apply_manifest_on(host, pp, :catch_changes => true)
3737
end
3838

3939
step "verify checkout is on the #{branch} branch" do

spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
teardown do
2929
on(host, "rm -fr #{tmpdir}")
30-
on(host, "ps ax | grep '#{ruby} /tmp/http_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh")
30+
on(host, "ps ax | grep '#{ruby} /tmp/http_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1")
3131
end
3232

3333
step 'checkout a branch with puppet' do
@@ -40,8 +40,8 @@
4040
}
4141
EOS
4242

43-
apply_manifest_on(host, pp)
44-
apply_manifest_on(host, pp)
43+
apply_manifest_on(host, pp, :catch_failures => true)
44+
apply_manifest_on(host, pp, :catch_changes => true)
4545
end
4646

4747
step "verify checkout is on the #{branch} branch" do

spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
teardown do
3636
on(host, "rm -fr #{tmpdir}")
37-
on(host, "ps ax | grep '#{ruby} /tmp/https_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh")
37+
on(host, "ps ax | grep '#{ruby} /tmp/https_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1")
3838
end
3939

4040
step 'checkout a branch with puppet' do
@@ -47,8 +47,8 @@
4747
}
4848
EOS
4949

50-
apply_manifest_on(host, pp)
51-
apply_manifest_on(host, pp)
50+
apply_manifest_on(host, pp, :catch_failures => true)
51+
apply_manifest_on(host, pp, :catch_changes => true)
5252
end
5353

5454
step "verify checkout is on the #{branch} branch" do

spec/acceptance/beaker/git/branch_checkout/branch_checkout_scp.rb

+6-5
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@
1414
end
1515
step 'setup - establish ssh keys' do
1616
# create ssh keys
17-
on(host, 'ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""')
17+
on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""')
1818

1919
# copy public key to authorized_keys
20+
on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys')
2021
on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config')
2122
on(host, 'chown -R root:root /root/.ssh')
2223
end
2324

2425
teardown do
2526
on(host, "rm -fr #{tmpdir}")
26-
apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }")
27-
apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }")
27+
apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", :catch_failures => true)
28+
apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", :catch_failures => true)
2829
end
2930

3031
step 'checkout a branch with puppet' do
@@ -37,8 +38,8 @@
3738
}
3839
EOS
3940

40-
apply_manifest_on(host, pp)
41-
apply_manifest_on(host, pp)
41+
apply_manifest_on(host, pp, :catch_failures => true)
42+
apply_manifest_on(host, pp, :catch_changes => true)
4243
end
4344

4445
step "verify checkout is on the #{branch} branch" do

spec/acceptance/beaker/git/branch_checkout/branch_checkout_ssh.rb

+6-5
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@
1414
end
1515
step 'setup - establish ssh keys' do
1616
# create ssh keys
17-
on(host, 'ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""')
17+
on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""')
1818

1919
# copy public key to authorized_keys
20+
on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys')
2021
on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config')
2122
on(host, 'chown -R root:root /root/.ssh')
2223
end
2324

2425
teardown do
2526
on(host, "rm -fr #{tmpdir}")
26-
apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }")
27-
apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }")
27+
apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", :catch_failures => true)
28+
apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", :catch_failures => true)
2829
end
2930

3031
step 'checkout a branch with puppet' do
@@ -37,8 +38,8 @@
3738
}
3839
EOS
3940

40-
apply_manifest_on(host, pp)
41-
apply_manifest_on(host, pp)
41+
apply_manifest_on(host, pp, :catch_failures => true)
42+
apply_manifest_on(host, pp, :catch_changes => true)
4243
end
4344

4445
step "verify checkout is on the #{branch} branch" do

spec/acceptance/beaker/git/branch_checkout/negative/branch_checkout_not_exists.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
}
2727
EOS
2828

29-
apply_manifest_on(host, pp)
30-
apply_manifest_on(host, pp)
29+
apply_manifest_on(host, pp, :expect_failures => true)
3130
end
3231

3332
step 'verify that master branch is checked out' do

spec/acceptance/beaker/git/clone/clone_file.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
}
2626
EOS
2727

28-
apply_manifest_on(host, pp)
29-
apply_manifest_on(host, pp)
28+
apply_manifest_on(host, pp, :catch_failures => true)
29+
apply_manifest_on(host, pp, :catch_changes => true)
3030
end
3131

3232
step "verify checkout is on the master branch" do

spec/acceptance/beaker/git/clone/clone_file_path.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
}
2626
EOS
2727

28-
apply_manifest_on(host, pp)
29-
apply_manifest_on(host, pp)
28+
apply_manifest_on(host, pp, :catch_failures => true)
29+
apply_manifest_on(host, pp, :catch_changes => true)
3030
end
3131

3232
step "verify checkout is on the master branch" do

spec/acceptance/beaker/git/clone/clone_git.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
teardown do
2020
on(host, "rm -fr #{tmpdir}")
21-
on(host, 'pkill -9 git-daemon')
21+
on(host, 'pkill -9 git-daemon ; sleep 1')
2222
end
2323

2424
step 'clone with puppet' do
@@ -30,8 +30,8 @@
3030
}
3131
EOS
3232

33-
apply_manifest_on(host, pp)
34-
apply_manifest_on(host, pp)
33+
apply_manifest_on(host, pp, :catch_failures => true)
34+
apply_manifest_on(host, pp, :catch_changes => true)
3535
end
3636

3737
step "verify checkout is on the master branch" do

spec/acceptance/beaker/git/clone/clone_http.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
teardown do
2828
on(host, "rm -fr #{tmpdir}")
29-
on(host, "ps ax | grep '#{ruby} /tmp/http_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh")
29+
on(host, "ps ax | grep '#{ruby} /tmp/http_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1")
3030
end
3131

3232
step 'clone with puppet' do
@@ -38,8 +38,8 @@
3838
}
3939
EOS
4040

41-
apply_manifest_on(host, pp)
42-
apply_manifest_on(host, pp)
41+
apply_manifest_on(host, pp, :catch_failures => true)
42+
apply_manifest_on(host, pp, :catch_changes => true)
4343
end
4444

4545
step "verify checkout is on the master branch" do

spec/acceptance/beaker/git/clone/clone_https.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
teardown do
3535
on(host, "rm -fr #{tmpdir}")
36-
on(host, "ps ax | grep '#{ruby} /tmp/https_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh")
36+
on(host, "ps ax | grep '#{ruby} /tmp/https_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1")
3737
end
3838

3939
step 'clone with puppet' do
@@ -45,8 +45,8 @@
4545
}
4646
EOS
4747

48-
apply_manifest_on(host, pp)
49-
apply_manifest_on(host, pp)
48+
apply_manifest_on(host, pp, :catch_failures => true)
49+
apply_manifest_on(host, pp, :catch_changes => true)
5050
end
5151

5252
step "verify checkout is on the master branch" do

spec/acceptance/beaker/git/clone/clone_over_different_exiting_repo_with_force.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
}
3333
EOS
3434

35-
apply_manifest_on(host, pp)
35+
apply_manifest_on(host, pp, :catch_failures => true)
36+
apply_manifest_on(host, pp, :catch_changes => true)
3637
end
3738

3839
step 'verify new repo has replaced old one' do

spec/acceptance/beaker/git/clone/clone_repo_with_excludes_in_repo.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
}
2929
EOS
3030

31-
apply_manifest_on(host, pp)
32-
apply_manifest_on(host, pp)
31+
apply_manifest_on(host, pp, :catch_failures => true)
32+
apply_manifest_on(host, pp, :catch_changes => true)
3333
end
3434

3535
step 'verify exludes are known to git' do

spec/acceptance/beaker/git/clone/clone_repo_with_excludes_not_in_repo.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
}
2929
EOS
3030

31-
apply_manifest_on(host, pp)
32-
apply_manifest_on(host, pp)
31+
apply_manifest_on(host, pp, :catch_failures => true)
32+
apply_manifest_on(host, pp, :catch_changes => true)
3333
end
3434

3535
step 'verify exludes are known to git' do

spec/acceptance/beaker/git/clone/clone_scp.rb

+6-5
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@
1313
end
1414
step 'setup - establish ssh keys' do
1515
# create ssh keys
16-
on(host, 'ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""')
16+
on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""')
1717

1818
# copy public key to authorized_keys
19+
on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys')
1920
on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config')
2021
on(host, 'chown -R root:root /root/.ssh')
2122
end
2223

2324
teardown do
2425
on(host, "rm -fr #{tmpdir}")
25-
apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }")
26-
apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }")
26+
apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", :catch_failures => true)
27+
apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", :catch_failures => true)
2728
end
2829

2930
step 'clone with puppet' do
@@ -35,8 +36,8 @@
3536
}
3637
EOS
3738

38-
apply_manifest_on(host, pp)
39-
apply_manifest_on(host, pp)
39+
apply_manifest_on(host, pp, :catch_failures => true)
40+
apply_manifest_on(host, pp, :catch_changes => true)
4041
end
4142

4243
step "verify checkout is on the master branch" do

0 commit comments

Comments
 (0)