|
10 | 10 | # See the License for the specific language governing permissions and limitations under the License.
|
11 | 11 |
|
12 | 12 | control 'tag:testami_tag:config_services_disabled_on_debian_family' do
|
13 |
| - title 'Test that DLAMI multi eni helper is disabled and masked on debian family' |
| 13 | + services = %w(aws-ubuntu-eni-helper wpa_supplicant) |
| 14 | + |
| 15 | + title "Test that #{services.join(',')} are disabled and masked on debian family" |
14 | 16 |
|
15 | 17 | only_if { os_properties.debian_family? && !os_properties.on_docker? }
|
16 | 18 |
|
17 |
| - describe service('aws-ubuntu-eni-helper') do |
18 |
| - it { should_not be_enabled } |
19 |
| - it { should_not be_running } |
20 |
| - end |
| 19 | + services.each do |service_name| |
| 20 | + describe service(service_name) do |
| 21 | + it { should_not be_enabled } |
| 22 | + it { should_not be_running } |
| 23 | + end |
21 | 24 |
|
22 |
| - describe bash('systemctl list-unit-files --state=masked --no-legend') do |
23 |
| - its(:exit_status) { should eq 0 } |
24 |
| - its(:stdout) { should match /aws-ubuntu-eni-helper.service\s*masked/ } |
| 25 | + describe bash('systemctl list-unit-files --state=masked --no-legend') do |
| 26 | + its(:exit_status) { should eq 0 } |
| 27 | + its(:stdout) { should match /#{service_name}.service\s*masked/ } |
| 28 | + end |
25 | 29 | end
|
26 | 30 | end
|
27 | 31 |
|
28 | 32 | control 'tag:testami_tag:config_services_disabled_on_amazon_family' do
|
29 |
| - title 'Test that log4j-cve-2021-44228-hotpatch is disabled and masked on amazon family' |
| 33 | + services = %w(log4j-cve-2021-44228-hotpatch cups) |
30 | 34 |
|
31 |
| - only_if { os_properties.amazon_family? && !os_properties.on_docker? } |
| 35 | + title "Test that #{services.join(',')} are disabled and masked on amazon family" |
32 | 36 |
|
33 |
| - describe service('log4j-cve-2021-44228-hotpatch') do |
34 |
| - it { should_not be_enabled } |
35 |
| - it { should_not be_running } |
36 |
| - end |
37 |
| - |
38 |
| - describe bash('systemctl list-unit-files --state=masked --no-legend') do |
39 |
| - its(:exit_status) { should eq 0 } |
40 |
| - its(:stdout) { should match /log4j-cve-2021-44228-hotpatch.service\s*masked/ } |
41 |
| - end |
| 37 | + only_if { os_properties.amazon_family? && !os_properties.on_docker? } |
42 | 38 |
|
43 |
| - describe bash('systemctl show -p LoadState log4j-cve-2021-44228-hotpatch') do |
44 |
| - its(:exit_status) { should eq 0 } |
45 |
| - its(:stdout) { should match /LoadState=masked/ } |
| 39 | + services.each do |service_name| |
| 40 | + describe service(service_name) do |
| 41 | + it { should_not be_enabled } |
| 42 | + it { should_not be_running } |
| 43 | + end |
| 44 | + |
| 45 | + describe bash('systemctl list-unit-files --state=masked --no-legend') do |
| 46 | + its(:exit_status) { should eq 0 } |
| 47 | + its(:stdout) { should match /#{service_name}.service\s*masked/ } |
| 48 | + end |
| 49 | + |
| 50 | + describe bash("systemctl show -p LoadState #{service_name}") do |
| 51 | + its(:exit_status) { should eq 0 } |
| 52 | + its(:stdout) { should match /LoadState=masked/ } |
| 53 | + end |
46 | 54 | end
|
47 | 55 | end
|
0 commit comments