From 2e8cc51403ead784e9764bb25d15d8a30d8d6475 Mon Sep 17 00:00:00 2001 From: John Duarte Date: Tue, 6 May 2014 08:55:51 -0700 Subject: Add test for git clone using http --- spec/acceptance/files/create_git_repo.sh | 4 +++- spec/acceptance/git_clone_protocols_spec.rb | 35 +++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) (limited to 'spec/acceptance') diff --git a/spec/acceptance/files/create_git_repo.sh b/spec/acceptance/files/create_git_repo.sh index 87b00a4..40f341a 100755 --- a/spec/acceptance/files/create_git_repo.sh +++ b/spec/acceptance/files/create_git_repo.sh @@ -34,4 +34,6 @@ cd .. git --git-dir=testrepo/.git config core.bare true cp -r testrepo/.git testrepo.git rm -rf testrepo -touch testrepo.git/git-daemon-export-ok +cd testrepo.git +touch git-daemon-export-ok +git update-server-info diff --git a/spec/acceptance/git_clone_protocols_spec.rb b/spec/acceptance/git_clone_protocols_spec.rb index a3f897a..96afe56 100644 --- a/spec/acceptance/git_clone_protocols_spec.rb +++ b/spec/acceptance/git_clone_protocols_spec.rb @@ -119,5 +119,40 @@ hosts.each do |host| end end + context 'using http 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' + server = WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => "#{tmpdir}") + 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 + pp = <<-EOS + vcsrepo { "#{tmpdir}/testrepo": + ensure => present, + provider => git, + source => "http://#{host}:8000/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 -- cgit v1.2.3