summaryrefslogtreecommitdiff
path: root/spec/acceptance/git_clone_protocols_spec.rb
diff options
context:
space:
mode:
authorJohn Duarte <john.duarte@puppetlabs.com>2014-05-06 11:11:25 -0700
committerJohn Duarte <john.duarte@puppetlabs.com>2014-05-18 11:38:18 -0700
commitff1dcfde8b337a95022a03947a84f148ff65badc (patch)
tree62388855ab0c6ed04ab4412e8483ddc81a33182e /spec/acceptance/git_clone_protocols_spec.rb
parent2e8cc51403ead784e9764bb25d15d8a30d8d6475 (diff)
downloadpuppet-vcsrepo-ff1dcfde8b337a95022a03947a84f148ff65badc.tar.gz
puppet-vcsrepo-ff1dcfde8b337a95022a03947a84f148ff65badc.tar.bz2
Add test for git clone using https
Diffstat (limited to 'spec/acceptance/git_clone_protocols_spec.rb')
-rw-r--r--spec/acceptance/git_clone_protocols_spec.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/acceptance/git_clone_protocols_spec.rb b/spec/acceptance/git_clone_protocols_spec.rb
index 96afe56..21f29a6 100644
--- a/spec/acceptance/git_clone_protocols_spec.rb
+++ b/spec/acceptance/git_clone_protocols_spec.rb
@@ -154,5 +154,50 @@ hosts.each do |host|
end
end
+ context 'using https protocol' do
+ before(:all) do
+ on(host,apply_manifest("file {'#{tmpdir}/testrepo': ensure => directory, purge => true, recurse => true, recurselimit => 1, force => true; }"))
+ daemon =<<-EOF
+ require 'webrick'
+ require 'webrick/https'
+ server = WEBrick::HTTPServer.new(
+ :Port => 8443,
+ :DocumentRoot => "#{tmpdir}",
+ :SSLEnable => true,
+ :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
+ :SSLCertificate => OpenSSL::X509::Certificate.new( File.open("#{tmpdir}/server.crt").read),
+ :SSLPrivateKey => OpenSSL::PKey::RSA.new( File.open("#{tmpdir}/server.key").read),
+ :SSLCertName => [ [ "CN",WEBrick::Utils::getservername ] ])
+ WEBrick::Daemon.start
+ server.start
+ EOF
+ create_remote_file(host, '/tmp/daemon.rb', daemon)
+ on(host, "ruby /tmp/daemon.rb")
+ end
+
+ it 'should have HEAD pointing to master' do
+ # howto whitelist ssl cert
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo":
+ ensure => present,
+ provider => git,
+ source => "https://#{host}:8443/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
+
+ after(:all) do
+ host.execute('pkill -9 ruby')
+ end
+ end
+
end
end