|
6 | 6 | let(:facts) { os_facts }
|
7 | 7 | let(:params) do
|
8 | 8 | {
|
9 |
| - :instances => { 'first_runner' => { 'labels' => ['test_label1', 'test_label2'], 'repo_name' => 'test_repo'}}, } |
| 9 | + 'instances' => { |
| 10 | + 'first_runner' => { |
| 11 | + 'labels' => ['test_label1', 'test_label2'], |
| 12 | + 'repo_name' => 'test_repo', |
| 13 | + }, |
| 14 | + }, |
| 15 | + } |
10 | 16 | end
|
11 | 17 |
|
12 | 18 | it { is_expected.to compile.with_all_deps }
|
13 | 19 | it { is_expected.to contain_class('github_actions_runner') }
|
14 | 20 |
|
15 | 21 | context 'is expected to create a github_actions_runner root directory' do
|
16 | 22 | it do
|
17 |
| - is_expected.to contain_file('/some_dir/actions-runner-2.272.0').with({ |
| 23 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0').with( |
18 | 24 | 'ensure' => 'directory',
|
19 | 25 | 'owner' => 'root',
|
20 | 26 | 'group' => 'root',
|
21 | 27 | 'mode' => '0644',
|
22 |
| - }) |
| 28 | + ) |
23 | 29 | end
|
24 | 30 | end
|
25 | 31 |
|
26 | 32 | context 'is expected to create a github_actions_runner a new root directory' do
|
27 | 33 | let(:params) do
|
28 |
| - super().merge({ 'base_dir_name' => '/tmp/actions-runner'}) |
| 34 | + super().merge('base_dir_name' => '/tmp/actions-runner') |
29 | 35 | end
|
| 36 | + |
30 | 37 | it do
|
31 |
| - is_expected.to contain_file('/tmp/actions-runner-2.272.0').with({ |
| 38 | + is_expected.to contain_file('/tmp/actions-runner-2.272.0').with( |
32 | 39 | 'ensure' => 'directory',
|
33 | 40 | 'owner' => 'root',
|
34 | 41 | 'group' => 'root',
|
35 | 42 | 'mode' => '0644',
|
36 |
| - }) |
| 43 | + ) |
37 | 44 | end
|
38 | 45 | end
|
39 | 46 |
|
40 | 47 | context 'is expected to create a github_actions_runner root directory with test user' do
|
41 | 48 | let(:params) do
|
42 |
| - super().merge({ 'user' => 'test_user', |
43 |
| - 'group' => 'test_group'}) |
| 49 | + super().merge('user' => 'test_user', |
| 50 | + 'group' => 'test_group') |
44 | 51 | end
|
| 52 | + |
45 | 53 | it do
|
46 |
| - is_expected.to contain_file('/some_dir/actions-runner-2.272.0').with({ |
| 54 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0').with( |
47 | 55 | 'ensure' => 'directory',
|
48 | 56 | 'owner' => 'test_user',
|
49 | 57 | 'group' => 'test_group',
|
50 | 58 | 'mode' => '0644',
|
51 |
| - }) |
| 59 | + ) |
52 | 60 | end
|
53 | 61 | end
|
54 | 62 |
|
55 | 63 | context 'is expected to create a github_actions_runner instance directory' do
|
56 | 64 | it do
|
57 |
| - is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner').with({ |
| 65 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner').with( |
58 | 66 | 'ensure' => 'directory',
|
59 | 67 | 'owner' => 'root',
|
60 | 68 | 'group' => 'root',
|
61 | 69 | 'mode' => '0644',
|
62 |
| - }) |
| 70 | + ) |
63 | 71 | end
|
64 | 72 | end
|
65 | 73 |
|
66 | 74 | context 'is expected to create a github_actions_runner instance directory with test user' do
|
67 | 75 | let(:params) do
|
68 |
| - super().merge({ 'user' => 'test_user', |
69 |
| - 'group' => 'test_group'}) |
| 76 | + super().merge('user' => 'test_user', |
| 77 | + 'group' => 'test_group') |
70 | 78 | end
|
| 79 | + |
71 | 80 | it do
|
72 |
| - is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner').with({ |
| 81 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner').with( |
73 | 82 | 'ensure' => 'directory',
|
74 | 83 | 'owner' => 'test_user',
|
75 | 84 | 'group' => 'test_group',
|
76 | 85 | 'mode' => '0644',
|
77 |
| - }) |
| 86 | + ) |
78 | 87 | end
|
79 | 88 | end
|
80 | 89 |
|
|
86 | 95 |
|
87 | 96 | context 'is expected to contain archive' do
|
88 | 97 | it do
|
89 |
| - is_expected.to contain_archive("first_runner-actions-runner-linux-x64-2.272.0.tar.gz").with({ |
| 98 | + is_expected.to contain_archive('first_runner-actions-runner-linux-x64-2.272.0.tar.gz').with( |
90 | 99 | 'ensure' => 'present',
|
91 | 100 | 'user' => 'root',
|
92 | 101 | 'group' => 'root',
|
93 |
| - }) |
| 102 | + ) |
94 | 103 | end
|
95 | 104 | end
|
96 | 105 |
|
97 | 106 | context 'is expected to contain archive with test package and test url' do
|
98 | 107 | let(:params) do
|
99 |
| - super().merge({ 'package_name' => 'test_package', |
100 |
| - 'package_ensure' => '9.9.9', |
101 |
| - 'repository_url' => 'https://test_url'}) |
| 108 | + super().merge('package_name' => 'test_package', |
| 109 | + 'package_ensure' => '9.9.9', |
| 110 | + 'repository_url' => 'https://test_url') |
102 | 111 | end
|
| 112 | + |
103 | 113 | it do
|
104 |
| - is_expected.to contain_archive("first_runner-test_package-9.9.9.tar.gz").with({ |
| 114 | + is_expected.to contain_archive('first_runner-test_package-9.9.9.tar.gz').with( |
105 | 115 | 'ensure' => 'present',
|
106 | 116 | 'user' => 'root',
|
107 | 117 | 'group' => 'root',
|
108 |
| - 'source' => 'https://test_url/v9.9.9/test_package-9.9.9.tar.gz' |
109 |
| - }) |
| 118 | + 'source' => 'https://test_url/v9.9.9/test_package-9.9.9.tar.gz', |
| 119 | + ) |
110 | 120 | end
|
111 | 121 | end
|
112 | 122 |
|
113 | 123 | context 'is expected to contain an ownership exec' do
|
114 | 124 | it do
|
115 |
| - is_expected.to contain_exec('first_runner-ownership').with({ |
| 125 | + is_expected.to contain_exec('first_runner-ownership').with( |
116 | 126 | 'user' => 'root',
|
117 | 127 | 'command' => '/bin/chown -R root:root /some_dir/actions-runner-2.272.0/first_runner',
|
118 |
| - }) |
| 128 | + ) |
119 | 129 | end
|
120 | 130 | end
|
121 | 131 |
|
122 | 132 | context 'is expected to contain a Run exec' do
|
123 | 133 | it do
|
124 |
| - is_expected.to contain_exec('first_runner-run_configure_install_runner.sh').with({ |
| 134 | + is_expected.to contain_exec('first_runner-run_configure_install_runner.sh').with( |
125 | 135 | 'user' => 'root',
|
126 | 136 | 'command' => '/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh',
|
127 |
| - }) |
| 137 | + ) |
128 | 138 | end
|
129 | 139 | end
|
130 | 140 |
|
131 | 141 | context 'is expected to create a github_actions_runner installation script' do
|
132 | 142 | it do
|
133 |
| - is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with({ |
| 143 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with( |
134 | 144 | 'ensure' => 'present',
|
135 | 145 | 'owner' => 'root',
|
136 | 146 | 'group' => 'root',
|
137 | 147 | 'mode' => '0755',
|
138 |
| - }) |
| 148 | + ) |
139 | 149 | end
|
140 | 150 | end
|
141 | 151 |
|
142 | 152 | context 'is expected to create a github_actions_runner installation script with test version' do
|
143 | 153 | let(:params) do
|
144 |
| - super().merge({ 'package_ensure' => '9.9.9'}) |
| 154 | + super().merge('package_ensure' => '9.9.9') |
145 | 155 | end
|
| 156 | + |
146 | 157 | it do
|
147 |
| - is_expected.to contain_file('/some_dir/actions-runner-9.9.9/first_runner/configure_install_runner.sh').with({ |
| 158 | + is_expected.to contain_file('/some_dir/actions-runner-9.9.9/first_runner/configure_install_runner.sh').with( |
148 | 159 | 'ensure' => 'present',
|
149 | 160 | 'owner' => 'root',
|
150 | 161 | 'group' => 'root',
|
151 | 162 | 'mode' => '0755',
|
152 |
| - }) |
| 163 | + ) |
153 | 164 | end
|
154 | 165 | end
|
155 | 166 |
|
156 | 167 | context 'is expected to create a github_actions_runner installation script with config in content' do
|
157 | 168 | it do
|
158 |
| - is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(/\/some_dir\/actions-runner-2.272.0\/first_runner\/config.sh/) |
| 169 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(%r{/some_dir/actions-runner-2.272.0/first_runner/config.sh}) |
159 | 170 | end
|
160 | 171 | end
|
161 | 172 |
|
162 | 173 | context 'is expected to create a github_actions_runner installation script with github org in content' do
|
163 | 174 | it do
|
164 |
| - is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(/https:\/\/github.com\/github_org\/test_repo/) |
| 175 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(%r{https://github.com/github_org/test_repo}) |
165 | 176 | end
|
166 | 177 | end
|
167 | 178 |
|
168 | 179 | context 'is expected to create a github_actions_runner installation script with test_org in content ' do
|
169 | 180 | let(:params) do
|
170 |
| - super().merge({ 'org_name' => 'test_org'}) |
| 181 | + super().merge('org_name' => 'test_org') |
171 | 182 | end
|
| 183 | + |
172 | 184 | it do
|
173 |
| - is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(/https:\/\/github.com\/test_org\/test_repo/) |
| 185 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(%r{https://github.com/test_org/test_repo}) |
174 | 186 | end
|
175 | 187 | end
|
176 | 188 |
|
177 | 189 | context 'is expected to create a github_actions_runner installation script with labels in content' do
|
178 | 190 | it do
|
179 |
| - is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(/test_label1,test_label2/) |
| 191 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(%r{test_label1,test_label2}) |
180 | 192 | end
|
181 | 193 | end
|
182 | 194 |
|
183 | 195 | context 'is expected to create a github_actions_runner installation script with PAT in content' do
|
184 | 196 | it do
|
185 |
| - is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(/authorization: token PAT/) |
| 197 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(%r{authorization: token PAT}) |
186 | 198 | end
|
187 | 199 | end
|
188 | 200 |
|
189 | 201 | context 'is expected to create a github_actions_runner installation script with test_PAT in content' do
|
190 | 202 | let(:params) do
|
191 |
| - super().merge({ 'personal_access_token' => 'test_PAT'}) |
| 203 | + super().merge('personal_access_token' => 'test_PAT') |
192 | 204 | end
|
| 205 | + |
193 | 206 | it do
|
194 |
| - is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(/authorization: token test_PAT/) |
| 207 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(%r{authorization: token test_PAT}) |
195 | 208 | end
|
196 | 209 | end
|
197 | 210 |
|
198 | 211 | context 'is expected to create a github_actions_runner installation with proxy settings in systemd globally in init.pp' do
|
199 | 212 | let(:params) do
|
200 | 213 | super().merge(
|
201 |
| - 'http_proxy' => 'http://proxy.local', |
202 |
| - 'https_proxy' => 'http://proxy.local', |
203 |
| - 'no_proxy' => 'example.com', |
204 |
| - 'instances' => { |
205 |
| - 'first_runner' => { |
206 |
| - 'labels' => ['test_label1'], |
207 |
| - 'repo_name' => 'test_repo', |
208 |
| - }, |
209 |
| - }, |
| 214 | + 'http_proxy' => 'http://proxy.local', |
| 215 | + 'https_proxy' => 'http://proxy.local', |
| 216 | + 'no_proxy' => 'example.com', |
| 217 | + 'instances' => { |
| 218 | + 'first_runner' => { |
| 219 | + 'labels' => ['test_label1'], |
| 220 | + 'repo_name' => 'test_repo', |
| 221 | + }, |
| 222 | + }, |
210 | 223 | )
|
211 | 224 | end
|
212 | 225 |
|
|
220 | 233 | context 'is expected to create a github_actions_runner installation with proxy settings in systemd globally in init.pp overwriting in a instance' do
|
221 | 234 | let(:params) do
|
222 | 235 | super().merge(
|
223 |
| - 'http_proxy' => 'http://proxy.local', |
224 |
| - 'https_proxy' => 'http://proxy.local', |
225 |
| - 'no_proxy' => 'example.com', |
226 |
| - 'instances' => { |
227 |
| - 'first_runner' => { |
228 |
| - 'labels' => ['test_label1'], |
229 |
| - 'repo_name' => 'test_repo', |
230 |
| - 'http_proxy' => 'http://newproxy.local', |
231 |
| - }, |
232 |
| - }, |
| 236 | + 'http_proxy' => 'http://proxy.local', |
| 237 | + 'https_proxy' => 'http://proxy.local', |
| 238 | + 'no_proxy' => 'example.com', |
| 239 | + 'instances' => { |
| 240 | + 'first_runner' => { |
| 241 | + 'labels' => ['test_label1'], |
| 242 | + 'repo_name' => 'test_repo', |
| 243 | + 'http_proxy' => 'http://newproxy.local', |
| 244 | + }, |
| 245 | + }, |
233 | 246 | )
|
234 | 247 | end
|
235 | 248 |
|
|
243 | 256 | context 'is expected to create a github_actions_runner installation with proxy settings in systemd' do
|
244 | 257 | let(:params) do
|
245 | 258 | super().merge(
|
246 |
| - 'instances' => { |
247 |
| - 'first_runner' => { |
248 |
| - 'labels' => ['test_label1'], |
249 |
| - 'repo_name' => 'test_repo', |
250 |
| - 'http_proxy' => 'http://proxy.local', |
251 |
| - 'https_proxy' => 'http://proxy.local', |
252 |
| - 'no_proxy' => 'example.com'}, |
253 |
| - }, |
| 259 | + 'instances' => { |
| 260 | + 'first_runner' => { |
| 261 | + 'labels' => ['test_label1'], |
| 262 | + 'repo_name' => 'test_repo', |
| 263 | + 'http_proxy' => 'http://proxy.local', |
| 264 | + 'https_proxy' => 'http://proxy.local', |
| 265 | + 'no_proxy' => 'example.com', |
| 266 | + }, |
| 267 | + }, |
254 | 268 | )
|
255 | 269 | end
|
256 | 270 |
|
|
264 | 278 | context 'is expected to create a github_actions_runner installation without proxy settings in systemd' do
|
265 | 279 | let(:params) do
|
266 | 280 | super().merge(
|
267 |
| - 'instances' => { |
268 |
| - 'first_runner' => { |
269 |
| - 'labels' => ['test_label1'], |
270 |
| - 'repo_name' => 'test_repo'}, |
271 |
| - }, |
| 281 | + 'instances' => { |
| 282 | + 'first_runner' => { |
| 283 | + 'labels' => ['test_label1'], |
| 284 | + 'repo_name' => 'test_repo', |
| 285 | + }, |
| 286 | + }, |
272 | 287 | )
|
273 | 288 | end
|
274 | 289 |
|
|
0 commit comments