File: modules_753_spec.rb

package info (click to toggle)
puppet-module-puppetlabs-vcsrepo 1.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 836 kB
  • ctags: 119
  • sloc: ruby: 6,359; sh: 49; makefile: 15
file content (68 lines) | stat: -rw-r--r-- 1,919 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
require 'spec_helper_acceptance'

tmpdir = default.tmpdir('vcsrepo')

describe 'clones a remote repo' do
  before(:all) do
    my_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
    shell("mkdir -p #{tmpdir}") # win test
  end

  after(:all) do
    shell("rm -rf #{tmpdir}/vcsrepo")
  end

  context 'clone with single remote' do
    it 'clones from default remote' do
      pp = <<-EOS
      vcsrepo { "#{tmpdir}/vcsrepo":
          ensure   => present,
          provider => git,
          source   => "https://github.com/puppetlabs/puppetlabs-vcsrepo.git",
      }
      EOS

      apply_manifest(pp, :catch_failures => true)

    end

    it "git config output should contain the remote" do
      shell("/usr/bin/git config -l -f #{tmpdir}/vcsrepo/.git/config") do |r|
        expect(r.stdout).to match(/remote.origin.url=https:\/\/github.com\/puppetlabs\/puppetlabs-vcsrepo.git/)
      end
    end

    after(:all) do
      shell("rm -rf #{tmpdir}/vcsrepo")
    end

  end

  context 'clone with multiple remotes' do
    it 'clones from default remote and adds 2 remotes to config file' do
      pp = <<-EOS
      vcsrepo { "#{tmpdir}/vcsrepo":
          ensure   => present,
          provider => git,
          source   => {"origin" => "https://github.com/puppetlabs/puppetlabs-vcsrepo.git", "test1" => "https://github.com/puppetlabs/puppetlabs-vcsrepo.git"},
      }
      EOS

      apply_manifest(pp, :catch_failures => true)

    end

    it "git config output should contain the remotes" do
      shell("/usr/bin/git config -l -f #{tmpdir}/vcsrepo/.git/config") do |r|
        expect(r.stdout).to match(/remote.origin.url=https:\/\/github.com\/puppetlabs\/puppetlabs-vcsrepo.git/)
        expect(r.stdout).to match(/remote.test1.url=https:\/\/github.com\/puppetlabs\/puppetlabs-vcsrepo.git/)
      end
    end

    after(:all) do
      shell("rm -rf #{tmpdir}/vcsrepo")
    end

  end

end