|
54 | 54 | end |
55 | 55 | run.converge(described_recipe) |
56 | 56 | end |
| 57 | + before do |
| 58 | + stub_command("grep -q '# Provides: go-agent$' /etc/init.d/go-agent").and_return(false) |
| 59 | + end |
57 | 60 | it_behaves_like :agent_recipe |
58 | 61 | it_behaves_like :apt_repository_recipe |
59 | 62 | it 'installs go-agent package' do |
|
70 | 73 | end |
71 | 74 | run.converge(described_recipe) |
72 | 75 | end |
| 76 | + before do |
| 77 | + stub_command("grep -q '# Provides: go-agent$' /etc/init.d/go-agent").and_return(false) |
| 78 | + end |
73 | 79 | it_behaves_like :agent_recipe |
74 | 80 | it_behaves_like :yum_repository_recipe |
75 | 81 | it 'installs go-agent package' do |
|
90 | 96 | end |
91 | 97 | run.converge(described_recipe) |
92 | 98 | end |
| 99 | + before do |
| 100 | + stub_command("grep -q '# Provides: go-agent$' /etc/init.d/go-agent").and_return(false) |
| 101 | + stub_command("grep -q '# Provides: go-agent$' /etc/init.d/go-agent-1").and_return(true) |
| 102 | + end |
93 | 103 | it_behaves_like :agent_recipe |
94 | 104 | it_behaves_like :apt_repository_recipe |
95 | 105 | it 'installs go-agent package' do |
|
100 | 110 | expect(chef_run).to create_gocd_agent('go-agent-1') |
101 | 111 | end |
102 | 112 | it 'creates init.d script to start additional agent' do |
103 | | - expect(chef_run).to create_link('/etc/init.d/go-agent-1').with( |
104 | | - to: '/etc/init.d/go-agent' |
105 | | - ) |
| 113 | + expect(chef_run).to run_bash('setup init.d for go-agent-1') |
106 | 114 | end |
107 | 115 | it 'links /usr/share/go-agent script' do |
108 | 116 | expect(chef_run).to create_link('/usr/share/go-agent-1').with( |
|
152 | 160 | end |
153 | 161 | run.converge(described_recipe) |
154 | 162 | end |
| 163 | + before do |
| 164 | + stub_command("grep -q '# Provides: go-agent$' /etc/init.d/go-agent").and_return(false) |
| 165 | + end |
155 | 166 | it_behaves_like :agent_recipe |
156 | 167 | it 'downloads go-agent .deb from remote URL' do |
157 | 168 | expect(chef_run).to create_remote_file('go-agent-15.2.0-2248.deb').with( |
|
172 | 183 | end |
173 | 184 | run.converge(described_recipe) |
174 | 185 | end |
| 186 | + before do |
| 187 | + stub_command("grep -q '# Provides: go-agent$' /etc/init.d/go-agent").and_return(false) |
| 188 | + end |
175 | 189 | it_behaves_like :agent_recipe |
176 | 190 | it 'downloads go-agent .rpm from remote URL' do |
177 | 191 | expect(chef_run).to create_remote_file('go-agent-15.2.0-2248.noarch.rpm').with( |
|
199 | 213 | end |
200 | 214 | run.converge(described_recipe) |
201 | 215 | end |
| 216 | + before do |
| 217 | + stub_command("grep -q '# Provides: go-agent$' /etc/init.d/go-agent").and_return(false) |
| 218 | + end |
202 | 219 | it_behaves_like :agent_recipe |
203 | 220 | it 'includes apt recipe' do |
204 | 221 | expect(chef_run).to include_recipe('apt') |
|
226 | 243 | end |
227 | 244 | run.converge(described_recipe) |
228 | 245 | end |
| 246 | + before do |
| 247 | + stub_command("grep -q '# Provides: go-agent$' /etc/init.d/go-agent").and_return(false) |
| 248 | + end |
229 | 249 | it_behaves_like :agent_recipe |
230 | 250 | it 'includes yum recipe' do |
231 | 251 | expect(chef_run).to include_recipe('yum') |
|
0 commit comments