-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add spec tests for jenkins::credentials define
massage travis into playing nice Revert "massage travis into playing nice" This reverts commit 86480e3.
- Loading branch information
1 parent
b5d52c4
commit ba47318
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
require 'spec_helper' | ||
|
||
describe 'jenkins::credentials' do | ||
|
||
let(:title) { 'mycreds' } | ||
let(:facts) {{ | ||
:osfamily => 'RedHat', | ||
:operatingsystem => 'CentOS', | ||
}} | ||
let(:helper_cmd) { "/usr/bin/java -jar cli.jar -s http://127.0.0.1:8080 groovy /var/lib/jenkins/puppet_helper.groovy" } | ||
let(:pre_condition) { | ||
"class jenkins::cli_helper { $helper_cmd = '#{helper_cmd}' }" | ||
} | ||
|
||
describe 'with ensure is present' do | ||
let(:params) {{ | ||
:ensure => 'present', | ||
:password => 'mypass', | ||
}} | ||
it { should contain_exec('create-jenkins-credentials-mycreds').with({ | ||
:command => "#{helper_cmd} create_or_update_credentials #{title} 'mypass' '' 'Managed by Puppet' ''", | ||
:unless => "#{helper_cmd} credential_info #{title} | grep #{title}", | ||
:tries => '3', | ||
:try_sleep => '5', | ||
:require => 'Class[Jenkins::Cli_helper]', | ||
})} | ||
end | ||
|
||
describe 'with ensure is absent' do | ||
let(:params) {{ | ||
:ensure => 'absent', | ||
:password => 'mypass', | ||
}} | ||
it { should contain_exec('delete-jenkins-credentials-mycreds').with({ | ||
:command => "#{helper_cmd} delete_credentials #{title}", | ||
:tries => '3', | ||
:try_sleep => '5', | ||
:require => 'Class[Jenkins::Cli_helper]', | ||
})} | ||
end | ||
|
||
describe 'with uuid set' do | ||
let(:params) {{ | ||
:ensure => 'present', | ||
:password => 'mypass', | ||
:uuid => 'e94d3b98-5ba4-43b9-89ed-79a08ea97f6f', | ||
}} | ||
it { should contain_exec('create-jenkins-credentials-mycreds').with({ | ||
:command => "#{helper_cmd} create_or_update_credentials #{title} 'mypass' 'e94d3b98-5ba4-43b9-89ed-79a08ea97f6f' 'Managed by Puppet' ''", | ||
:unless => "#{helper_cmd} credential_info #{title} | grep #{title}", | ||
:tries => '3', | ||
:try_sleep => '5', | ||
:require => 'Class[Jenkins::Cli_helper]', | ||
})} | ||
end | ||
|
||
end |