|
25 | 25 | it { is_expected.to contain_exec('reload-jenkins').with_command(%r{http://localhost:9000}) } |
26 | 26 | it { is_expected.to contain_exec('reload-jenkins').with_command(%r{-i\s'/path/to/key'}) } |
27 | 27 | it { is_expected.to contain_exec('reload-jenkins').that_requires('File[/path/to/libdir/jenkins-cli.jar]') } |
28 | | - it { is_expected.to contain_exec('safe-restart-jenkins') } |
| 28 | + it { is_expected.to contain_exec('safe-restart-jenkins').with('environment' => nil) } |
29 | 29 | it { is_expected.to contain_jenkins__sysconfig('HTTP_PORT').with_value('9000') } |
30 | 30 |
|
| 31 | +<<<<<<< HEAD |
31 | 32 | describe 'jenkins::cli' do |
32 | 33 | describe 'relationships' do |
33 | 34 | it do |
|
39 | 40 | that_comes_before('Anchor[jenkins::end]') |
40 | 41 | end |
41 | 42 | end |
| 43 | +======= |
| 44 | + context '$cli => true' do |
| 45 | + let(:params) {{ :cli => true, |
| 46 | + :cli_ssh_keyfile => '/path/to/key', |
| 47 | + :config_hash => { 'HTTP_PORT' => { 'value' => '9000' } }} |
| 48 | + } |
| 49 | + it { should contain_class('jenkins::cli') } |
| 50 | + it { should contain_exec('jenkins-cli') } |
| 51 | + it { should contain_exec('reload-jenkins').with_command(/http:\/\/localhost:9000/) } |
| 52 | + it { should contain_exec('reload-jenkins').with_command(/-i\s'\/path\/to\/key'/) } |
| 53 | + it { should contain_exec('safe-restart-jenkins') } |
| 54 | + it { should contain_exec('safe-restart-jenkins').with('environment' => nil) } |
| 55 | + it { should contain_jenkins__sysconfig('HTTP_PORT').with_value('9000') } |
| 56 | + |
| 57 | + describe 'jenkins::cli' do |
| 58 | + describe 'relationships' do |
| 59 | + it do |
| 60 | + should contain_class('jenkins::cli'). |
| 61 | + that_requires('Class[jenkins::service]') |
| 62 | +>>>>>>> 14d095a... CIP-389 Resolve credential leak via ps with cli |
| 63 | + end |
| 64 | + |
| 65 | + context '$cli_password is defined' do |
| 66 | + let(:params) do |
| 67 | + { |
| 68 | + version: '2.54', |
| 69 | + libdir: '/path/to/libdir', |
| 70 | + cli: true, |
| 71 | + cli_remoting_free: true, |
| 72 | + cli_username: 'user01', |
| 73 | + cli_password: 'password01' |
| 74 | + } |
| 75 | + end |
| 76 | + |
| 77 | + it do |
| 78 | + is_expected.to contain_exec('safe-restart-jenkins').with( |
| 79 | + 'environment' => [ |
| 80 | + 'JENKINS_USER_ID=user01', |
| 81 | + 'JENKINS_API_TOKEN=password01' |
| 82 | + ] |
| 83 | + ) |
| 84 | + end |
| 85 | + end |
| 86 | + |
| 87 | + context '$cli_password is defined' do |
| 88 | + let(:params) do |
| 89 | + { |
| 90 | + version: '2.54', |
| 91 | + libdir: '/path/to/libdir', |
| 92 | + cli: true, |
| 93 | + cli_remoting_free: true, |
| 94 | + cli_username: 'user01', |
| 95 | + cli_password: 'password01' |
| 96 | + } |
| 97 | + end |
| 98 | + |
| 99 | + it do |
| 100 | + is_expected.to contain_exec('safe-restart-jenkins').with( |
| 101 | + 'environment' => [ |
| 102 | + 'JENKINS_USER_ID=user01', |
| 103 | + 'JENKINS_API_TOKEN=password01' |
| 104 | + ] |
| 105 | + ) |
| 106 | + end |
42 | 107 | end |
43 | 108 | end |
44 | 109 |
|
|
0 commit comments