summaryrefslogtreecommitdiff
path: root/spec/acceptance
diff options
context:
space:
mode:
authorJohn Duarte <john.duarte@puppetlabs.com>2014-05-06 17:50:06 -0700
committerJohn Duarte <john.duarte@puppetlabs.com>2014-05-18 11:38:18 -0700
commitb6d724bb656939f7b6c95fbe86a42442193b2938 (patch)
tree7a4caca0006c81f615ec2a1f27ff78360ebd4a8f /spec/acceptance
parentff1dcfde8b337a95022a03947a84f148ff65badc (diff)
Add test for git clone using ssh
Diffstat (limited to 'spec/acceptance')
-rw-r--r--spec/acceptance/git_clone_protocols_spec.rb33
1 files changed, 30 insertions, 3 deletions
diff --git a/spec/acceptance/git_clone_protocols_spec.rb b/spec/acceptance/git_clone_protocols_spec.rb
index 21f29a6..f59644e 100644
--- a/spec/acceptance/git_clone_protocols_spec.rb
+++ b/spec/acceptance/git_clone_protocols_spec.rb
@@ -14,12 +14,14 @@ hosts.each do |host|
install_package(host, 'git-daemon')
# create ssh keys
host.execute('mkdir -p /home/testuser/.ssh')
- host.execute('ssh-keygen -q -t rsa -f /home/testuser/.ssh/id_rsa -N ""')
+ host.execute('ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""')
# copy public key to authorized_keys
- host.execute('cat /home/testuser/.ssh/id_rsa.pub > /home/testuser/.ssh/authorized_keys')
- host.execute('echo -e "Host localhost\n\tStrictHostKeyChecking no\n" > /home/testuser/.ssh/config')
+ host.execute('cat /root/.ssh/id_rsa.pub >> /home/testuser/.ssh/authorized_keys')
+ host.execute('echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /home/testuser/.ssh/config')
+ host.execute('echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config')
host.execute('chown -R testuser:testuser /home/testuser/.ssh')
+ host.execute('chown -R root:root /root/.ssh')
# create git repo
my_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
@@ -35,6 +37,8 @@ hosts.each do |host|
after(:all) do
# {{{ teardown
on(host,apply_manifest("user{'testuser': ensure => absent, managehome => true }"))
+ on(host,apply_manifest("file{'/root/.ssh/id_rsa': ensure => absent, force => true }"))
+ on(host,apply_manifest("file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }"))
# }}}
end
@@ -199,5 +203,28 @@ hosts.each do |host|
end
end
+ context 'using ssh protocol' do
+ before(:all) do
+ on(host,apply_manifest("file {'#{tmpdir}/testrepo': ensure => directory, purge => true, recurse => true, recurselimit => 1, force => true; }"))
+ end
+ it 'should have HEAD pointing to master' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo":
+ ensure => present,
+ provider => git,
+ source => "ssh://root@#{host}#{tmpdir}/testrepo.git",
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ describe file("#{tmpdir}/testrepo/.git/HEAD") do
+ it { should contain 'ref: refs/heads/master' }
+ end
+ end
+
end
end