|
6 | 6 | let(:facts) { os_facts }
|
7 | 7 | let(:params) do
|
8 | 8 | {
|
9 |
| - :ensure => 'present', |
10 |
| - :org_name => 'test_org', |
11 |
| - :personal_access_token => 'test_PAT', |
12 |
| - :package_name => 'test_package', |
13 |
| - :package_ensure => '1.0.1', |
14 |
| - :repository_url => 'https://test_url', |
15 |
| - :user => 'test_user', |
16 |
| - :group => 'test_group', |
17 |
| - :base_dir_name => '/tmp/actions-runner', |
18 |
| - :instances => { 'first_runner' => { 'labels' => ['test_label1', 'test_label2'], 'repo_name' => 'test_repo'}}, } |
| 9 | + :instances => { 'first_runner' => { 'labels' => ['test_label1', 'test_label2'], 'repo_name' => 'test_repo'}}, } |
19 | 10 | end
|
20 | 11 |
|
21 | 12 | it { is_expected.to compile.with_all_deps }
|
22 | 13 | it { is_expected.to contain_class('github_actions_runner') }
|
23 | 14 |
|
24 | 15 | context 'is expected to create a github_actions_runner root directory' do
|
25 | 16 | it do
|
26 |
| - is_expected.to contain_file('/tmp/actions-runner-1.0.1').with({ |
| 17 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0').with({ |
| 18 | + 'ensure' => 'directory', |
| 19 | + 'owner' => 'root', |
| 20 | + 'group' => 'root', |
| 21 | + 'mode' => '0644', |
| 22 | + }) |
| 23 | + end |
| 24 | + end |
| 25 | + |
| 26 | + context 'is expected to create a github_actions_runner a new root directory' do |
| 27 | + let(:params) do |
| 28 | + super().merge({ 'base_dir_name' => '/tmp/actions-runner'}) |
| 29 | + end |
| 30 | + it do |
| 31 | + is_expected.to contain_file('/tmp/actions-runner-2.272.0').with({ |
| 32 | + 'ensure' => 'directory', |
| 33 | + 'owner' => 'root', |
| 34 | + 'group' => 'root', |
| 35 | + 'mode' => '0644', |
| 36 | + }) |
| 37 | + end |
| 38 | + end |
| 39 | + |
| 40 | + context 'is expected to create a github_actions_runner root directory with test user' do |
| 41 | + let(:params) do |
| 42 | + super().merge({ 'user' => 'test_user', |
| 43 | + 'group' => 'test_group'}) |
| 44 | + end |
| 45 | + it do |
| 46 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0').with({ |
27 | 47 | 'ensure' => 'directory',
|
28 | 48 | 'owner' => 'test_user',
|
29 | 49 | 'group' => 'test_group',
|
|
34 | 54 |
|
35 | 55 | context 'is expected to create a github_actions_runner instance directory' do
|
36 | 56 | it do
|
37 |
| - is_expected.to contain_file('/tmp/actions-runner-1.0.1/first_runner').with({ |
| 57 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner').with({ |
| 58 | + 'ensure' => 'directory', |
| 59 | + 'owner' => 'root', |
| 60 | + 'group' => 'root', |
| 61 | + 'mode' => '0644', |
| 62 | + }) |
| 63 | + end |
| 64 | + end |
| 65 | + |
| 66 | + context 'is expected to create a github_actions_runner instance directory with test user' do |
| 67 | + let(:params) do |
| 68 | + super().merge({ 'user' => 'test_user', |
| 69 | + 'group' => 'test_group'}) |
| 70 | + end |
| 71 | + it do |
| 72 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner').with({ |
38 | 73 | 'ensure' => 'directory',
|
39 | 74 | 'owner' => 'test_user',
|
40 | 75 | 'group' => 'test_group',
|
|
49 | 84 | end
|
50 | 85 | end
|
51 | 86 |
|
| 87 | + context 'is expected to contain archive' do |
| 88 | + it do |
| 89 | + is_expected.to contain_archive("first_runner-actions-runner-linux-x64-2.272.0.tar.gz").with({ |
| 90 | + 'ensure' => 'present', |
| 91 | + 'user' => 'root', |
| 92 | + 'group' => 'root', |
| 93 | + }) |
| 94 | + end |
| 95 | + end |
| 96 | + |
| 97 | + context 'is expected to contain archive with test package and test url' do |
| 98 | + let(:params) do |
| 99 | + super().merge({ 'package_name' => 'test_package', |
| 100 | + 'package_ensure' => '9.9.9', |
| 101 | + 'repository_url' => 'https://test_url'}) |
| 102 | + end |
| 103 | + it do |
| 104 | + is_expected.to contain_archive("first_runner-test_package-9.9.9.tar.gz").with({ |
| 105 | + 'ensure' => 'present', |
| 106 | + 'user' => 'root', |
| 107 | + 'group' => 'root', |
| 108 | + 'source' => 'https://test_url/v9.9.9/test_package-9.9.9.tar.gz' |
| 109 | + }) |
| 110 | + end |
| 111 | + end |
| 112 | + |
| 113 | + context 'is expected to contain an ownership exec' do |
| 114 | + it do |
| 115 | + is_expected.to contain_exec('first_runner-ownership').with({ |
| 116 | + 'user' => 'root', |
| 117 | + 'command' => '/bin/chown -R root:root /some_dir/actions-runner-2.272.0/first_runner', |
| 118 | + }) |
| 119 | + end |
| 120 | + end |
| 121 | + |
| 122 | + context 'is expected to contain a Run exec' do |
| 123 | + it do |
| 124 | + is_expected.to contain_exec('first_runner-run_configure_install_runner.sh').with({ |
| 125 | + 'user' => 'root', |
| 126 | + 'command' => '/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh', |
| 127 | + }) |
| 128 | + end |
| 129 | + end |
| 130 | + |
52 | 131 | context 'is expected to create a github_actions_runner installation script' do
|
53 | 132 | it do
|
54 |
| - is_expected.to contain_file('/tmp/actions-runner-1.0.1/first_runner/configure_install_runner.sh').with({ |
| 133 | + is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with({ |
55 | 134 | 'ensure' => 'present',
|
56 |
| - 'owner' => 'test_user', |
57 |
| - 'group' => 'test_group', |
| 135 | + 'owner' => 'root', |
| 136 | + 'group' => 'root', |
| 137 | + 'mode' => '0755', |
| 138 | + }) |
| 139 | + end |
| 140 | + end |
| 141 | + |
| 142 | + context 'is expected to create a github_actions_runner installation script with test version' do |
| 143 | + let(:params) do |
| 144 | + super().merge({ 'package_ensure' => '9.9.9'}) |
| 145 | + end |
| 146 | + it do |
| 147 | + is_expected.to contain_file('/some_dir/actions-runner-9.9.9/first_runner/configure_install_runner.sh').with({ |
| 148 | + 'ensure' => 'present', |
| 149 | + 'owner' => 'root', |
| 150 | + 'group' => 'root', |
58 | 151 | 'mode' => '0755',
|
59 | 152 | })
|
60 | 153 | end
|
61 | 154 | end
|
62 | 155 |
|
63 | 156 | context 'is expected to create a github_actions_runner installation script with config in content' do
|
64 | 157 | it do
|
65 |
| - is_expected.to contain_file('/tmp/actions-runner-1.0.1/first_runner/configure_install_runner.sh').with_content(/\/tmp\/actions-runner-1.0.1\/first_runner\/config.sh/) |
| 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/) |
66 | 159 | end
|
67 | 160 | end
|
68 | 161 |
|
69 |
| - context 'is expected to create a github_actions_runner installation script with repo url in content' do |
| 162 | + context 'is expected to create a github_actions_runner installation script with github org in content' do |
70 | 163 | it do
|
71 |
| - is_expected.to contain_file('/tmp/actions-runner-1.0.1/first_runner/configure_install_runner.sh').with_content(/https:\/\/github.com\/test_org\/test_repo/) |
| 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/) |
| 165 | + end |
| 166 | + end |
| 167 | + |
| 168 | + context 'is expected to create a github_actions_runner installation script with test_org in content ' do |
| 169 | + let(:params) do |
| 170 | + super().merge({ 'org_name' => 'test_org'}) |
| 171 | + end |
| 172 | + 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/) |
72 | 174 | end
|
73 | 175 | end
|
74 | 176 |
|
75 | 177 | context 'is expected to create a github_actions_runner installation script with labels in content' do
|
76 | 178 | it do
|
77 |
| - is_expected.to contain_file('/tmp/actions-runner-1.0.1/first_runner/configure_install_runner.sh').with_content(/test_label1,test_label2/) |
| 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/) |
| 180 | + end |
| 181 | + end |
| 182 | + |
| 183 | + context 'is expected to create a github_actions_runner installation script with PAT in content' do |
| 184 | + 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/) |
| 186 | + end |
| 187 | + end |
| 188 | + |
| 189 | + context 'is expected to create a github_actions_runner installation script with test_PAT in content' do |
| 190 | + let(:params) do |
| 191 | + super().merge({ 'personal_access_token' => 'test_PAT'}) |
| 192 | + end |
| 193 | + 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/) |
78 | 195 | end
|
79 | 196 | end
|
80 | 197 | end
|
|
0 commit comments