Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.

Commit 9a0e529

Browse files
committed
add tests for enterprise_name and org_name
1 parent 5ae5dcc commit 9a0e529

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

data/common.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ github_actions_runner::base_dir_name: '/some_dir/actions-runner'
44
github_actions_runner::package_name: 'actions-runner-linux-x64'
55
github_actions_runner::package_ensure: '2.272.0'
66
github_actions_runner::repository_url: 'https://github.com/actions/runner/releases/download'
7-
github_actions_runner::org_name: 'github_org'
87
github_actions_runner::personal_access_token: 'PAT'
98
github_actions_runner::user: 'root'
109
github_actions_runner::group: 'root'

spec/classes/github_actions_runner_spec.rb

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,20 @@
66
let(:facts) { os_facts }
77
let(:params) do
88
{
9+
'instances' => {
10+
'first_runner' => {},
11+
},
12+
}
13+
end
14+
15+
it { is_expected.to compile.and_raise_error(/Either 'org_name' or 'enterprise_name' is required to create runner instances/) }
16+
17+
let(:params) do
18+
{
19+
'org_name' => 'github_org',
920
'instances' => {
1021
'first_runner' => {
11-
'labels' => ['test_label1', 'test_label2'],
22+
'labels' => ['test_label1', 'test_label2'],
1223
'repo_name' => 'test_repo',
1324
},
1425
},
@@ -170,7 +181,7 @@
170181
end
171182
end
172183

173-
context 'is expected to create a github_actions_runner installation script with test_org in content ' do
184+
context 'is expected to create a github_actions_runner installation script with test_org in content' do
174185
let(:params) do
175186
super().merge('org_name' => 'test_org')
176187
end
@@ -180,6 +191,16 @@
180191
end
181192
end
182193

194+
context 'is expected to create a github_actions_runner installation script with test_enterprise in content' do
195+
let(:params) do
196+
super().merge('enterprise_name' => 'test_enterprise')
197+
end
198+
199+
it do
200+
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})
201+
end
202+
end
203+
183204
context 'is expected to create a github_actions_runner installation script with labels in content' do
184205
it do
185206
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})

0 commit comments

Comments
 (0)