Debian Codegraph @

spec/acceptance/beaker/git/basic_auth/negative/basic_auth_checkout_git.rb

raw
1 test_name 'C3494 - checkout with basic auth (git protocol)'
2
3 # Globals
4 repo_name = 'testrepo_checkout'
5 user = 'foo'
6 password = 'bar'
7 http_server_script = 'basic_auth_http_daemon.rb'
8
9 hosts.each do |host|
10 tmpdir = host.tmpdir('vcsrepo')
11 step 'setup - create repo' do
12 git_pkg = 'git'
13 if host['platform'] =~ /ubuntu-10/
14 git_pkg = 'git-core'
15 end
16 install_package(host, git_pkg)
17 my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..'))
18 scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir)
19 on(host, "cd #{tmpdir} && ./create_git_repo.sh")
20 end
21
22 step 'setup - start git daemon' do
23 install_package(host, 'git-daemon') unless host['platform'] =~ /debian|ubuntu/
24 on(host, "git daemon --base-path=#{tmpdir} --export-all --reuseaddr --verbose --detach")
25 end
26
27 teardown do
28 on(host, "rm -fr #{tmpdir}")
29 on(host, 'pkill -9 git-daemon ; sleep 1')
30 end
31
32 step 'checkout with puppet using basic auth' do
33 pp = <<-EOS
34 vcsrepo { "#{tmpdir}/#{repo_name}":
35 ensure => present,
36 source => "git://#{host}/testrepo.git",
37 provider => git,
38 basic_auth_username => '#{user}',
39 basic_auth_password => '#{password}',
40 }
41 EOS
42
43 apply_manifest_on(host, pp, :catch_failures => true)
44 apply_manifest_on(host, pp, :catch_changes => true)
45 end
46
47 step "verify checkout (silent error for basic auth using git protocol)" do
48 on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res|
49 fail_test('checkout not found') unless res.stdout.include? "HEAD"
50 end
51 end
52
53 end