summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Gemfile2
-rw-r--r--spec/acceptance/clone_repo_spec.rb443
-rw-r--r--spec/acceptance/create_repo_spec.rb77
-rwxr-xr-xspec/acceptance/files/create_git_repo.sh36
-rw-r--r--spec/acceptance/nodesets/centos-64-x64.yml10
-rw-r--r--spec/acceptance/nodesets/debian-607-x64.yml10
-rw-r--r--spec/acceptance/nodesets/debian-73-x64.yml10
-rw-r--r--spec/acceptance/nodesets/default.yml10
-rw-r--r--spec/acceptance/nodesets/ubuntu-server-10044-x64.yml10
-rw-r--r--spec/acceptance/nodesets/ubuntu-server-12042-x64.yml10
-rw-r--r--spec/acceptance/remove_repo_spec.rb30
-rw-r--r--spec/spec_helper_acceptance.rb39
12 files changed, 687 insertions, 0 deletions
diff --git a/Gemfile b/Gemfile
index 5def829..ad7f34e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -10,6 +10,8 @@ group :development, :test do
gem 'serverspec', :require => false
gem 'puppet-lint', :require => false
gem 'pry', :require => false
+ gem 'beaker', :require => false
+ gem 'beaker-rspec', :require => false
gem 'simplecov', :require => false
end
diff --git a/spec/acceptance/clone_repo_spec.rb b/spec/acceptance/clone_repo_spec.rb
new file mode 100644
index 0000000..4e2db19
--- /dev/null
+++ b/spec/acceptance/clone_repo_spec.rb
@@ -0,0 +1,443 @@
+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
+ scp_to(default, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir)
+ shell("cd #{tmpdir} && ./create_git_repo.sh")
+ end
+
+ after(:all) do
+ shell("rm -rf #{tmpdir}/testrepo.git")
+ end
+
+ context 'get the current master HEAD' do
+ it 'clones a repo' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo":
+ ensure => present,
+ provider => git,
+ source => "file://#{tmpdir}/testrepo.git",
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ describe file("#{tmpdir}/testrepo/.git") do
+ it { should be_directory }
+ end
+
+ describe file("#{tmpdir}/testrepo/.git/HEAD") do
+ it { should contain 'ref: refs/heads/master' }
+ end
+ end
+
+ context 'using a commit SHA' do
+ let (:sha) do
+ shell("git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1").stdout.chomp
+ end
+
+ after(:all) do
+ shell("rm -rf #{tmpdir}/testrepo_sha")
+ end
+
+ it 'clones a repo' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_sha":
+ ensure => present,
+ provider => git,
+ source => "file://#{tmpdir}/testrepo.git",
+ revision => "#{sha}",
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ describe file("#{tmpdir}/testrepo_sha/.git") do
+ it { should be_directory }
+ end
+
+ describe file("#{tmpdir}/testrepo_sha/.git/HEAD") do
+ it { should contain sha }
+ end
+ end
+
+ context 'using a tag' do
+ it 'clones a repo' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_tag":
+ ensure => present,
+ provider => git,
+ source => "file://#{tmpdir}/testrepo.git",
+ revision => '0.0.2',
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ describe file("#{tmpdir}/testrepo_tag/.git") do
+ it { should be_directory }
+ end
+
+ it 'should have the tag as the HEAD' do
+ shell("git --git-dir=#{tmpdir}/testrepo_tag/.git name-rev HEAD | grep '0.0.2'")
+ end
+ end
+
+ context 'using a branch name' do
+ it 'clones a repo' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_branch":
+ ensure => present,
+ provider => git,
+ source => "file://#{tmpdir}/testrepo.git",
+ revision => 'a_branch',
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ describe file("#{tmpdir}/testrepo_branch/.git") do
+ it { should be_directory }
+ end
+
+ describe file("#{tmpdir}/testrepo_branch/.git/HEAD") do
+ it { should contain 'ref: refs/heads/a_branch' }
+ end
+ end
+
+ context 'ensure latest' do
+ it 'clones a repo' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_latest":
+ ensure => latest,
+ provider => git,
+ source => "file://#{tmpdir}/testrepo.git",
+ revision => 'master',
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ it 'verifies the HEAD commit SHA on remote and local match' do
+ remote_commit = shell("git ls-remote file://#{tmpdir}/testrepo_latest HEAD | head -1").stdout
+ local_commit = shell("git --git-dir=#{tmpdir}/testrepo_latest/.git rev-parse HEAD").stdout.chomp
+ expect(remote_commit).to include(local_commit)
+ end
+ end
+
+ context 'with shallow clone' do
+ it 'does a shallow clone' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_shallow":
+ ensure => present,
+ provider => git,
+ source => "file://#{tmpdir}/testrepo.git",
+ depth => '1',
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ describe file("#{tmpdir}/testrepo_shallow/.git/shallow") do
+ it { should be_file }
+ end
+ end
+
+ context 'path is not empty and not a repository' do
+ before(:all) do
+ shell("mkdir #{tmpdir}/not_a_repo", :acceptable_exit_codes => [0,1])
+ shell("touch #{tmpdir}/not_a_repo/file1.txt", :acceptable_exit_codes => [0,1])
+ end
+
+ it 'should raise an exception' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/not_a_repo":
+ ensure => present,
+ provider => git
+ source => "file://#{tmpdir}/testrepo.git",
+ }
+ EOS
+ apply_manifest(pp, :expect_failures => true)
+ end
+ end
+
+ context 'with an owner' do
+ it 'clones a repo' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_owner":
+ ensure => present,
+ provider => git,
+ source => "file://#{tmpdir}/testrepo.git",
+ owner => 'vagrant',
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ describe file("#{tmpdir}/testrepo_owner") do
+ it { should be_directory }
+ it { should be_owned_by 'vagrant' }
+ end
+ end
+
+ context 'with a group' do
+ it 'clones a repo' do
+ pp = <<-EOS
+ vcsrepo { "/#{tmpdir}/testrepo_group":
+ ensure => present,
+ provider => git,
+ source => "file://#{tmpdir}/testrepo.git",
+ group => 'vagrant',
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ describe file("#{tmpdir}/testrepo_group") do
+ it { should be_directory }
+ it { should be_grouped_into 'vagrant' }
+ end
+ end
+
+ context 'with excludes' do
+ it 'clones a repo' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_excludes":
+ ensure => present,
+ provider => git,
+ source => "file://#{tmpdir}/testrepo.git",
+ excludes => ['exclude1.txt', 'exclude2.txt'],
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ describe file("#{tmpdir}/testrepo_excludes/.git/info/exclude") do
+ its(:content) { should match /exclude1.txt/ }
+ its(:content) { should match /exclude2.txt/ }
+ end
+ end
+
+ context 'with force' do
+ before(:all) do
+ shell("mkdir -p #{tmpdir}/testrepo_force/folder")
+ shell("touch #{tmpdir}/testrepo_force/temp.txt")
+ end
+
+ it 'applies the manifest' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_force":
+ ensure => present,
+ provider => git,
+ source => "file://#{tmpdir}/testrepo.git",
+ force => true,
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ describe file("#{tmpdir}/testrepo_force/folder") do
+ it { should_not be_directory }
+ end
+
+ describe file("#{tmpdir}/testrepo_force/temp.txt") do
+ it { should_not be_file }
+ end
+
+ describe file("#{tmpdir}/testrepo_force/.git") do
+ it { should be_directory }
+ end
+ end
+
+ context 'as a user' do
+ before(:all) do
+ shell("chmod 707 #{tmpdir}")
+ pp = <<-EOS
+ user { 'testuser':
+ ensure => present,
+ }
+ EOS
+
+ apply_manifest(pp, :catch_failures => true)
+ end
+
+ it 'applies the manifest' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_user":
+ ensure => present,
+ provider => git,
+ source => "file://#{tmpdir}/testrepo.git",
+ user => 'testuser',
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ describe file("#{tmpdir}/testrepo_user") do
+ it { should be_directory }
+ it { should be_owned_by 'testuser' }
+ end
+
+ describe file("#{tmpdir}/testrepo_user") do
+ it { should be_directory }
+ it { should be_grouped_into 'testuser' }
+ end
+ end
+
+ context 'non-origin remote name' do
+ it 'applies the manifest' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_remote":
+ ensure => present,
+ provider => git,
+ source => "file://#{tmpdir}/testrepo.git",
+ remote => 'testorigin',
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ it 'remote name is "testorigin"' do
+ shell("git --git-dir=#{tmpdir}/testrepo_remote/.git remote | grep 'testorigin'")
+ end
+
+ after(:all) do
+ pp = 'user { "testuser": ensure => absent }'
+ apply_manifest(pp, :catch_failures => true)
+ end
+ end
+
+ context 'as a user with ssh' do
+ before(:all) do
+ # create user
+ pp = <<-EOS
+ user { 'testuser-ssh':
+ ensure => present,
+ managehome => true,
+ }
+ EOS
+ apply_manifest(pp, :catch_failures => true)
+
+ # create ssh keys
+ shell('mkdir -p /home/testuser-ssh/.ssh')
+ shell('ssh-keygen -q -t rsa -f /home/testuser-ssh/.ssh/id_rsa -N ""')
+
+ # copy public key to authorized_keys
+ shell('cat /home/testuser-ssh/.ssh/id_rsa.pub > /home/testuser-ssh/.ssh/authorized_keys')
+ shell('echo -e "Host localhost\n\tStrictHostKeyChecking no\n" > /home/testuser-ssh/.ssh/config')
+ shell('chown -R testuser-ssh:testuser-ssh /home/testuser-ssh/.ssh')
+ end
+
+ it 'applies the manifest' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_user_ssh":
+ ensure => present,
+ provider => git,
+ source => "testuser-ssh@localhost:#{tmpdir}/testrepo.git",
+ user => 'testuser-ssh',
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ after(:all) do
+ pp = <<-EOS
+ user { 'testuser-ssh':
+ ensure => absent,
+ managehome => true,
+ }
+ EOS
+ apply_manifest(pp, :catch_failures => true)
+ end
+ end
+
+ context 'using an identity file' do
+ before(:all) do
+ # create user
+ pp = <<-EOS
+ user { 'testuser-ssh':
+ ensure => present,
+ managehome => true,
+ }
+ EOS
+ apply_manifest(pp, :catch_failures => true)
+
+ # create ssh keys
+ shell('mkdir -p /home/testuser-ssh/.ssh')
+ shell('ssh-keygen -q -t rsa -f /home/testuser-ssh/.ssh/id_rsa -N ""')
+
+ # copy public key to authorized_keys
+ shell('cat /home/testuser-ssh/.ssh/id_rsa.pub > /home/testuser-ssh/.ssh/authorized_keys')
+ shell('echo -e "Host localhost\n\tStrictHostKeyChecking no\n" > /home/testuser-ssh/.ssh/config')
+ shell('chown -R testuser-ssh:testuser-ssh /home/testuser-ssh/.ssh')
+ end
+
+ it 'applies the manifest' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_user_ssh_id":
+ ensure => present,
+ provider => git,
+ source => "testuser-ssh@localhost:#{tmpdir}/testrepo.git",
+ identity => '/home/testuser-ssh/.ssh/id_rsa',
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ after(:all) do
+ pp = <<-EOS
+ user { 'testuser-ssh':
+ ensure => absent,
+ managehome => true,
+ }
+ EOS
+ apply_manifest(pp, :catch_failures => true)
+ end
+ end
+end
diff --git a/spec/acceptance/create_repo_spec.rb b/spec/acceptance/create_repo_spec.rb
new file mode 100644
index 0000000..675517e
--- /dev/null
+++ b/spec/acceptance/create_repo_spec.rb
@@ -0,0 +1,77 @@
+require 'spec_helper_acceptance'
+
+tmpdir = default.tmpdir('vcsrepo')
+
+describe 'create a repo' do
+ context 'without a source' do
+ it 'creates a blank repo' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_blank_repo":
+ ensure => present,
+ provider => git,
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ describe file("#{tmpdir}/testrepo_blank_repo/") do
+ it 'should have zero files' do
+ shell("ls -1 #{tmpdir}/testrepo_blank_repo | wc -l") do |r|
+ expect(r.stdout).to match(/^0\n$/)
+ end
+ end
+ end
+
+ describe file("#{tmpdir}/testrepo_blank_repo/.git") do
+ it { should be_directory }
+ end
+ end
+
+ context 'bare repo' do
+ it 'creates a bare repo' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_bare_repo":
+ ensure => bare,
+ provider => git,
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ describe file("#{tmpdir}/testrepo_bare_repo/config") do
+ it { should contain 'bare = true' }
+ end
+
+ describe file("#{tmpdir}/testrepo_bare_repo/.git") do
+ it { should_not be_directory }
+ end
+ end
+
+ context 'bare repo with a revision' do
+ it 'creates a bare repo' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_bare_repo_rev":
+ ensure => bare,
+ provider => git,
+ revision => 'master',
+ }
+ EOS
+
+ apply_manifest(pp, :catch_failures => true)
+ end
+
+ describe file("#{tmpdir}/testrepo_bare_repo_rev/config") do
+ it { should contain 'bare = true' }
+ end
+
+ describe file("#{tmpdir}/testrepo_bare_repo_rev/.git") do
+ it { should_not be_directory }
+ end
+ end
+end
diff --git a/spec/acceptance/files/create_git_repo.sh b/spec/acceptance/files/create_git_repo.sh
new file mode 100755
index 0000000..03c4f44
--- /dev/null
+++ b/spec/acceptance/files/create_git_repo.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+mkdir testrepo
+cd testrepo
+
+touch file1.txt file2.txt file3.txt
+git init
+echo 'change 1' > file1.txt
+git add file1.txt
+git tag 0.0.1
+git commit -m 'add file1'
+echo 'change 2' > file2.txt
+git add file2.txt
+git tag 0.0.2
+git commit -m 'add file2'
+echo 'change 3' > file3.txt
+git add file3.txt
+git commit -m 'add file3'
+git tag 0.0.3
+
+git checkout -b a_branch
+echo 'change 4' > file4.txt
+git add file4.txt
+git commit -m 'add file4'
+echo 'change 5' > file5.txt
+git add file5.txt
+git commit -m 'add file5'
+echo 'change 6' > file6.txt
+git add file6.txt
+git commit -m 'add file6'
+
+git checkout master
+cd ..
+
+git --git-dir=testrepo/.git config core.bare true
+cp -r testrepo/.git testrepo.git
+rm -rf testrepo
diff --git a/spec/acceptance/nodesets/centos-64-x64.yml b/spec/acceptance/nodesets/centos-64-x64.yml
new file mode 100644
index 0000000..05540ed
--- /dev/null
+++ b/spec/acceptance/nodesets/centos-64-x64.yml
@@ -0,0 +1,10 @@
+HOSTS:
+ centos-64-x64:
+ roles:
+ - master
+ platform: el-6-x86_64
+ box : centos-64-x64-vbox4210-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
+ hypervisor : vagrant
+CONFIG:
+ type: foss
diff --git a/spec/acceptance/nodesets/debian-607-x64.yml b/spec/acceptance/nodesets/debian-607-x64.yml
new file mode 100644
index 0000000..43df6a5
--- /dev/null
+++ b/spec/acceptance/nodesets/debian-607-x64.yml
@@ -0,0 +1,10 @@
+HOSTS:
+ debian-607-x64:
+ roles:
+ - master
+ platform: debian-6-amd64
+ box : debian-607-x64-vbox4210-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-607-x64-vbox4210-nocm.box
+ hypervisor : vagrant
+CONFIG:
+ type: foss
diff --git a/spec/acceptance/nodesets/debian-73-x64.yml b/spec/acceptance/nodesets/debian-73-x64.yml
new file mode 100644
index 0000000..5b87870
--- /dev/null
+++ b/spec/acceptance/nodesets/debian-73-x64.yml
@@ -0,0 +1,10 @@
+HOSTS:
+ debian-73-x64:
+ roles:
+ - master
+ platform: debian-7-amd64
+ box : debian-73-x64-virtualbox-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-nocm.box
+ hypervisor : vagrant
+CONFIG:
+ type: foss
diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml
new file mode 100644
index 0000000..05540ed
--- /dev/null
+++ b/spec/acceptance/nodesets/default.yml
@@ -0,0 +1,10 @@
+HOSTS:
+ centos-64-x64:
+ roles:
+ - master
+ platform: el-6-x86_64
+ box : centos-64-x64-vbox4210-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
+ hypervisor : vagrant
+CONFIG:
+ type: foss
diff --git a/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml b/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml
new file mode 100644
index 0000000..5ca1514
--- /dev/null
+++ b/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml
@@ -0,0 +1,10 @@
+HOSTS:
+ ubuntu-server-10044-x64:
+ roles:
+ - master
+ platform: ubuntu-10.04-amd64
+ box : ubuntu-server-10044-x64-vbox4210-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box
+ hypervisor : vagrant
+CONFIG:
+ type: foss
diff --git a/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml b/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml
new file mode 100644
index 0000000..d065b30
--- /dev/null
+++ b/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml
@@ -0,0 +1,10 @@
+HOSTS:
+ ubuntu-server-12042-x64:
+ roles:
+ - master
+ platform: ubuntu-12.04-amd64
+ box : ubuntu-server-12042-x64-vbox4210-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
+ hypervisor : vagrant
+CONFIG:
+ type: foss
diff --git a/spec/acceptance/remove_repo_spec.rb b/spec/acceptance/remove_repo_spec.rb
new file mode 100644
index 0000000..d22d9db
--- /dev/null
+++ b/spec/acceptance/remove_repo_spec.rb
@@ -0,0 +1,30 @@
+require 'spec_helper_acceptance'
+
+tmpdir = default.tmpdir('vcsrepo')
+
+describe 'remove a repo' do
+ it 'creates a blank repo' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_deleted":
+ ensure => present,
+ provider => git,
+ }
+ EOS
+ apply_manifest(pp, :catch_failures => true)
+ end
+
+ it 'removes a repo' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_deleted":
+ ensure => absent,
+ provider => git,
+ }
+ EOS
+
+ apply_manifest(pp, :catch_failures => true)
+ end
+
+ describe file("#{tmpdir}/testrepo_deleted") do
+ it { should_not be_directory }
+ end
+end
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
new file mode 100644
index 0000000..dec9331
--- /dev/null
+++ b/spec/spec_helper_acceptance.rb
@@ -0,0 +1,39 @@
+require 'beaker-rspec'
+
+unless ENV['RS_PROVISION'] == 'no'
+ hosts.each do |host|
+ # Install Puppet
+ if host.is_pe?
+ install_pe
+ else
+ install_puppet
+ end
+ end
+end
+
+RSpec.configure do |c|
+ # Project root
+ proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
+
+ # Readable test descriptions
+ c.formatter = :documentation
+
+ # Configure all nodes in nodeset
+ c.before :suite do
+ # Install module and dependencies
+ puppet_module_install(:source => proj_root, :module_name => 'vcsrepo')
+ hosts.each do |host|
+ case fact('osfamily')
+ when 'RedHat'
+ install_package(host, 'git')
+ when 'Debian'
+ install_package(host, 'git-core')
+ else
+ if !check_for_package(host, 'git')
+ puts "Git package is required for this module"
+ exit
+ end
+ end
+ end
+ end
+end