Add test for git clone using http
authorJohn Duarte <john.duarte@puppetlabs.com>
Tue, 6 May 2014 15:55:51 +0000 (08:55 -0700)
committerJohn Duarte <john.duarte@puppetlabs.com>
Sun, 18 May 2014 18:38:18 +0000 (11:38 -0700)
spec/acceptance/files/create_git_repo.sh
spec/acceptance/git_clone_protocols_spec.rb

index 87b00a4..40f341a 100755 (executable)
@@ -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
index a3f897a..96afe56 100644 (file)
@@ -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