diff options
author | Micah <micah@leap.se> | 2016-07-12 16:46:26 -0400 |
---|---|---|
committer | Micah <micah@leap.se> | 2016-07-12 16:46:26 -0400 |
commit | 850a14b59444737f703686d0d1996bf09ab08e2b (patch) | |
tree | 6d67b59126fc9d8329b6acdd072b53b5ea35bc25 /puppet/modules/vcsrepo/spec/acceptance/modules_2326_spec.rb | |
parent | 5247b7ccf5b5889ee16262dd976b03047e34e32c (diff) |
git subrepo clone https://leap.se/git/puppet_vcsrepo puppet/modules/vcsrepo
subrepo:
subdir: "puppet/modules/vcsrepo"
merged: "4e23209"
upstream:
origin: "https://leap.se/git/puppet_vcsrepo"
branch: "master"
commit: "4e23209"
git-subrepo:
version: "0.3.0"
origin: "https://github.com/ingydotnet/git-subrepo"
commit: "1e79595"
Change-Id: I72f8ecdef4855ef9da6e1486453b1cdf01bb54a3
Diffstat (limited to 'puppet/modules/vcsrepo/spec/acceptance/modules_2326_spec.rb')
-rw-r--r-- | puppet/modules/vcsrepo/spec/acceptance/modules_2326_spec.rb | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/puppet/modules/vcsrepo/spec/acceptance/modules_2326_spec.rb b/puppet/modules/vcsrepo/spec/acceptance/modules_2326_spec.rb new file mode 100644 index 00000000..601c6ff6 --- /dev/null +++ b/puppet/modules/vcsrepo/spec/acceptance/modules_2326_spec.rb @@ -0,0 +1,69 @@ +require 'spec_helper_acceptance' + +tmpdir = default.tmpdir('vcsrepo') + +describe 'clones with special characters' 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 'as a user with ssh' do + before(:all) do + # create user + pp = <<-EOS + group { 'testuser-ssh': + ensure => present, + } + user { 'testuser-ssh': + ensure => present, + groups => 'testuser-ssh', + managehome => true, + } + EOS + apply_manifest(pp, :catch_failures => true) + + # create ssh keys + shell('mkdir -p /home/testuser-ssh/.ssh') + shell('echo -e \'y\n\'|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') + shell("chown testuser-ssh:testuser-ssh #{tmpdir}") + end + + it 'applies the manifest' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/testrepo_user_ssh": + ensure => present, + provider => git, + source => "git+ssh://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 +end |