|
164 | 164 | end
|
165 | 165 | end
|
166 | 166 |
|
167 |
| - context 'is expected to create a github_actions_runner installation script' do |
168 |
| - it do |
| 167 | + context 'installation scripts for different types of runners' do |
| 168 | + let(:params) do |
| 169 | + super().merge( |
| 170 | + 'org_name' => :undef, |
| 171 | + 'enterprise_name' => :undef, |
| 172 | + 'instances' => { |
| 173 | + 'first_runner' => { |
| 174 | + 'org_name' => 'github_org', |
| 175 | + 'repo_name' => 'test_repo', |
| 176 | + }, |
| 177 | + 'org_runner' => { |
| 178 | + 'org_name' => 'github_org', |
| 179 | + 'labels' => ['default'], |
| 180 | + }, |
| 181 | + 'enterprise_runner' => { |
| 182 | + 'org_name' => :undef, |
| 183 | + 'enterprise_name' => 'test_enterprise', |
| 184 | + 'labels' => ['default'], |
| 185 | + }, |
| 186 | + }, |
| 187 | + ) |
| 188 | + end |
| 189 | + |
| 190 | + it 'creates a repo specific runner script' do |
169 | 191 | is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with(
|
170 |
| - 'ensure' => 'present', |
171 |
| - 'owner' => 'root', |
172 |
| - 'group' => 'root', |
173 |
| - 'mode' => '0755', |
| 192 | + 'ensure' => 'present', |
| 193 | + 'owner' => 'root', |
| 194 | + 'group' => 'root', |
| 195 | + 'mode' => '0755', |
| 196 | + ) |
| 197 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content( |
| 198 | + %r{https://api.github.com/repos/github_org/test_repo/actions/runners/registration-token}, |
174 | 199 | )
|
| 200 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(%r{--url https://github.com/github_org/test_repo }) |
| 201 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(%r{--name foo-first_runner }) |
175 | 202 | is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').that_requires('Archive[first_runner-actions-runner-linux-x64-2.272.0.tar.gz]')
|
176 | 203 | is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').that_notifies('Exec[first_runner-run_configure_install_runner.sh]')
|
177 | 204 | end
|
| 205 | + |
| 206 | + it 'creates an org specific runner script' do |
| 207 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/org_runner/configure_install_runner.sh').with( |
| 208 | + 'ensure' => 'present', |
| 209 | + 'owner' => 'root', |
| 210 | + 'group' => 'root', |
| 211 | + 'mode' => '0755', |
| 212 | + ) |
| 213 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/org_runner/configure_install_runner.sh').with_content( |
| 214 | + %r{https://api.github.com/orgs/github_org/actions/runners/registration-token}, |
| 215 | + ) |
| 216 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/org_runner/configure_install_runner.sh').with_content(%r{--url https://github.com/github_org }) |
| 217 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/org_runner/configure_install_runner.sh').with_content(%r{--name foo-org_runner }) |
| 218 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/org_runner/configure_install_runner.sh').that_requires('Archive[org_runner-actions-runner-linux-x64-2.272.0.tar.gz]') |
| 219 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/org_runner/configure_install_runner.sh').that_notifies('Exec[org_runner-run_configure_install_runner.sh]') |
| 220 | + end |
| 221 | + |
| 222 | + it 'creates an enterprise specific runner script' do |
| 223 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/enterprise_runner/configure_install_runner.sh').with( |
| 224 | + 'ensure' => 'present', |
| 225 | + 'owner' => 'root', |
| 226 | + 'group' => 'root', |
| 227 | + 'mode' => '0755', |
| 228 | + ) |
| 229 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/enterprise_runner/configure_install_runner.sh').with_content( |
| 230 | + %r{https://api.github.com/enterprises/test_enterprise/actions/runners/registration-token}, |
| 231 | + ) |
| 232 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/enterprise_runner/configure_install_runner.sh').with_content(%r{--url https://github.com/enterprises/test_enterprise }) |
| 233 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/enterprise_runner/configure_install_runner.sh').with_content(%r{--name foo-enterprise_runner }) |
| 234 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/enterprise_runner/configure_install_runner.sh').that_requires( |
| 235 | + 'Archive[enterprise_runner-actions-runner-linux-x64-2.272.0.tar.gz]', |
| 236 | + ) |
| 237 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/enterprise_runner/configure_install_runner.sh').that_notifies('Exec[enterprise_runner-run_configure_install_runner.sh]') |
| 238 | + end |
178 | 239 | end
|
179 | 240 |
|
180 | 241 | context 'is expected to create a github_actions_runner installation script with test version' do
|
|
234 | 295 |
|
235 | 296 | it do
|
236 | 297 | is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(%r{https://github.com/enterprises/test_enterprise})
|
| 298 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(%r{--url https://github.com/enterprises/test_enterprise }) |
| 299 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(%r{--name foo-first_runner }) |
237 | 300 | end
|
238 | 301 | end
|
239 | 302 |
|
|
0 commit comments