Permalink
Browse files

Added unit tests for :git_upload_pack option

  • Loading branch information...
1 parent 4de5d1d commit 007b38153b58454b719037f17c60eb2b88bfdfcc Gabriel Birke committed Jun 14, 2012
Showing with 19 additions and 0 deletions.
  1. +19 −0 test/deploy/scm/git_test.rb
@@ -33,6 +33,11 @@ def test_checkout
rev = 'c2d9e79'
assert_equal "git clone -q git@somehost.com:project.git /var/www && cd /var/www && git checkout -q -b deploy #{rev}", @source.checkout(rev, dest)
+ # with upload_pack config
+ @config[:git_upload_pack] = "/opt/bin/git-upload-pack"
+ assert_equal "git clone -q --upload-pack=/opt/bin/git-upload-pack git@somehost.com:project.git /var/www && cd /var/www && git checkout -q -b deploy #{rev}", @source.checkout(rev, dest)
+ @config[:git_upload_pack] = nil
+
# With :scm_command
git = "/opt/local/bin/git"
@config[:scm_command] = git
@@ -86,6 +91,14 @@ def test_query_revision_from_remote
assert_equal "d11006102c07c94e5d54dd0ee63dca825c93ed61", revision
end
+ def test_query_revision_with_upload_pack
+ @config[:git_upload_pack] = "/opt/bin/git-upload-pack"
+ @source.query_revision('HEAD') do |o|
+ assert_equal "git ls-remote --upload-pack=/opt/bin/git-upload-pack . HEAD", o
+ "d11006102c07c94e5d54dd0ee63dca825c93ed61\tHEAD"
+ end
+ end
+
def test_query_revision_falls_back_to_local
revision = @source.query_revision('d11006') do |o|
return nil if o == "git ls-remote . d11006"
@@ -120,6 +133,12 @@ def test_sync
rev = 'c2d9e79'
assert_equal "cd #{dest} && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard #{rev} && git clean -q -d -x -f", @source.sync(rev, dest)
+
+ # with :git_upload_pack
+ @config[:git_upload_pack] = "/opt/bin/git-upload-pack"
+ assert_equal "cd #{dest} && git fetch --upload-pack=/opt/bin/git-upload-pack -q origin && git fetch --tags --upload-pack=/opt/bin/git-upload-pack -q origin && git reset -q --hard #{rev} && git clean -q -d -x -f", @source.sync(rev, dest)
+ @config[:git_upload_pack] = nil
+
# With :scm_command
git = "/opt/local/bin/git"
@config[:scm_command] = git

0 comments on commit 007b381

Please sign in to comment.