diff options
author | Bryan Jen <bryan.jen@gmail.com> | 2015-08-17 14:57:21 -0700 |
---|---|---|
committer | Bryan Jen <bryan.jen@gmail.com> | 2015-08-17 14:57:21 -0700 |
commit | dd4b638a420c75eb3a3a2badceffc720be231096 (patch) | |
tree | c5df24ce0d0189598220cd728fe16c367a55c261 /spec/acceptance | |
parent | d7534d7cfe98d62b8f0d9ae8adcc30bea483a1e2 (diff) | |
parent | f385df10c57a0a09fa316004e6af18acd56df710 (diff) | |
download | puppet-vcsrepo-dd4b638a420c75eb3a3a2badceffc720be231096.tar.gz puppet-vcsrepo-dd4b638a420c75eb3a3a2badceffc720be231096.tar.bz2 |
Merge pull request #263 from mhaskel/MODULES-2326
MODULES-2326 - Run Regexp.escape on the source URL
Diffstat (limited to 'spec/acceptance')
-rw-r--r-- | spec/acceptance/modules_2326_spec.rb | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/spec/acceptance/modules_2326_spec.rb b/spec/acceptance/modules_2326_spec.rb new file mode 100644 index 0000000..d62dbb0 --- /dev/null +++ b/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('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 |