1 test_name 'C3447 - checkout a tag (ssh protocol)'
4 repo_name = 'testrepo_tag_checkout'
8 tmpdir = host.tmpdir('vcsrepo')
9 step 'setup - create repo' do
10 install_package(host, 'git')
11 my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..'))
12 scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir)
13 on(host, "cd #{tmpdir} && ./create_git_repo.sh")
15 step 'setup - establish ssh keys' do
17 on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""')
19 # copy public key to authorized_keys
20 on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys')
21 on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config')
22 on(host, 'chown -R root:root /root/.ssh')
26 on(host, "rm -fr #{tmpdir}")
27 apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", :catch_failures => true)
28 apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", :catch_failures => true)
31 step 'get tag sha from repo' do
32 on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res|
33 @sha = res.stdout.chomp
37 step 'checkout a tag with puppet' do
39 vcsrepo { "#{tmpdir}/#{repo_name}":
41 source => "ssh://root@#{host}#{tmpdir}/testrepo.git",
47 apply_manifest_on(host, pp, :catch_failures => true)
48 apply_manifest_on(host, pp, :catch_changes => true)
51 step "verify checkout out tag is #{tag}" do
52 on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res|
53 fail_test('checkout not found') unless res.stdout.include? "HEAD"
56 on(host,"git --git-dir=#{tmpdir}/#{repo_name}/.git name-rev HEAD") do |res|
57 fail_test('tag not found') unless res.stdout.include? "#{tag}"