File: create_bare_repo_that_already_exists.rb

package info (click to toggle)
puppet-module-puppetlabs-vcsrepo 1.3.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 828 kB
  • sloc: ruby: 6,359; sh: 44; makefile: 7
file content (40 lines) | stat: -rw-r--r-- 1,014 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
test_name 'C3472 - create bare repo that already exists'

# Globals
repo_name = 'testrepo_bare_repo_already_exists.git'

hosts.each do |host|
  tmpdir = host.tmpdir('vcsrepo')
  step 'setup - create bare repo' do
    git_pkg = 'git'
    if host['platform'] =~ /ubuntu-10/
      git_pkg = 'git-core'
    end
    install_package(host, git_pkg)
    on(host, "mkdir #{tmpdir}/#{repo_name}")
    on(host, "cd #{tmpdir}/#{repo_name} && git --bare init")
  end

  teardown do
    on(host, "rm -fr #{tmpdir}")
  end

  step 'create bare repo that already exists using puppet' do
    pp = <<-EOS
    vcsrepo { "#{tmpdir}/#{repo_name}":
      ensure => bare,
      provider => git,
    }
    EOS

    apply_manifest_on(host, pp, :catch_failures => true)
    apply_manifest_on(host, pp, :catch_changes  => true)
  end

  step 'verify repo does not contain .git directory' do
    on(host, "ls -al #{tmpdir}/#{repo_name}") do |res|
      fail_test "found .git for #{repo_name}" if res.stdout.include? ".git"
    end
  end

end