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

Commit e7b8a46

Browse files
committed
Add relationship between resources tests
1 parent 4d8ae2c commit e7b8a46

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

manifests/instance.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@
135135
exec { "${instance_name}-check-runner-configured":
136136
user => $user,
137137
cwd => "${github_actions_runner::root_dir}/${instance_name}",
138-
command => "true",
138+
command => 'true',
139139
unless => "test -f ${github_actions_runner::root_dir}/${instance_name}/runsvc.sh",
140-
path => ["/bin", "/usr/bin"],
140+
path => ['/bin', '/usr/bin'],
141141
notify => Exec["${instance_name}-run_configure_install_runner.sh"],
142142
}
143143

spec/classes/github_actions_runner_spec.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
'group' => 'root',
8484
'mode' => '0644',
8585
)
86+
is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner').that_requires(['File[/some_dir/actions-runner-2.272.0]'])
8687
end
8788
end
8889

@@ -99,6 +100,7 @@
99100
'group' => 'test_group',
100101
'mode' => '0644',
101102
)
103+
is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner').that_requires(['File[/some_dir/actions-runner-2.272.0]'])
102104
end
103105
end
104106

@@ -109,6 +111,7 @@
109111
'user' => 'root',
110112
'group' => 'root',
111113
)
114+
is_expected.to contain_archive('first_runner-actions-runner-linux-x64-2.272.0.tar.gz').that_requires(['File[/some_dir/actions-runner-2.272.0/first_runner]'])
112115
end
113116
end
114117

@@ -126,6 +129,7 @@
126129
'group' => 'root',
127130
'source' => 'https://test_url/v9.9.9/test_package-9.9.9.tar.gz',
128131
)
132+
is_expected.to contain_archive('first_runner-test_package-9.9.9.tar.gz').that_requires(['File[/some_dir/actions-runner-9.9.9/first_runner]'])
129133
end
130134
end
131135

@@ -135,6 +139,19 @@
135139
'user' => 'root',
136140
'command' => '/bin/chown -R root:root /some_dir/actions-runner-2.272.0/first_runner',
137141
)
142+
is_expected.to contain_exec('first_runner-ownership').that_subscribes_to('Archive[first_runner-actions-runner-linux-x64-2.272.0.tar.gz]')
143+
end
144+
end
145+
146+
context 'is expected to contain a exec checking runner configured' do
147+
it do
148+
is_expected.to contain_exec('first_runner-check-runner-configured').with(
149+
'user' => 'root',
150+
'command' => 'true',
151+
'unless' => 'test -f /some_dir/actions-runner-2.272.0/first_runner/runsvc.sh',
152+
'path' => ['/bin', '/usr/bin'],
153+
)
154+
is_expected.to contain_exec('first_runner-check-runner-configured').that_notifies('Exec[first_runner-run_configure_install_runner.sh]')
138155
end
139156
end
140157

@@ -155,6 +172,8 @@
155172
'group' => 'root',
156173
'mode' => '0755',
157174
)
175+
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+
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]')
158177
end
159178
end
160179

@@ -170,6 +189,8 @@
170189
'group' => 'root',
171190
'mode' => '0755',
172191
)
192+
is_expected.to contain_file('/some_dir/actions-runner-9.9.9/first_runner/configure_install_runner.sh').that_requires('Archive[first_runner-actions-runner-linux-x64-9.9.9.tar.gz]')
193+
is_expected.to contain_file('/some_dir/actions-runner-9.9.9/first_runner/configure_install_runner.sh').that_notifies('Exec[first_runner-run_configure_install_runner.sh]')
173194
end
174195
end
175196

@@ -259,6 +280,8 @@
259280
'enable' => true,
260281
'active' => true,
261282
)
283+
is_expected.to contain_systemd__unit_file('github-actions-runner.first_runner.service').that_requires(['File[/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh]',
284+
'Exec[first_runner-run_configure_install_runner.sh]'])
262285
end
263286
end
264287

0 commit comments

Comments
 (0)