Skip to content

Commit 46a0ac1

Browse files
[Kitchen test] Simplify cstate check
`grubby` command on Rocky 9.5 no longer writes to `/etc/default/grub`. It uses another file. To avoid too many branches based on operating system, this commit use `cpupower` command to check CPU cstate. `cpupower` doesn't work on Ubuntu20, for which this commit keeps the old checks. Signed-off-by: Hanwen <[email protected]>
1 parent 5e4aba8 commit 46a0ac1

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

cookbooks/aws-parallelcluster-platform/test/controls/c_states_spec.rb

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,22 @@
33
title 'Check the configuration to disable c states'
44
only_if { !os_properties.on_docker? && os_properties.x86? }
55

6-
describe file('/etc/default/grub') do
7-
it { should exist }
8-
its('content') { should match(/processor.max_cstate=1/) }
9-
its('content') { should match(/intel_idle.max_cstate=1/) }
10-
end
11-
12-
if os_properties.redhat8? || os_properties.alinux2? || os_properties.centos7? || os_properties.rocky8?
13-
14-
describe file('/boot/grub2/grub.cfg') do
6+
if os_properties.ubuntu2004?
7+
describe file('/etc/default/grub') do
158
it { should exist }
169
its('content') { should match(/processor.max_cstate=1/) }
1710
its('content') { should match(/intel_idle.max_cstate=1/) }
1811
end
19-
20-
elsif os.debian?
21-
2212
describe file('/boot/grub/grub.cfg') do
2313
it { should exist }
2414
its('content') { should match(/processor.max_cstate=1/) }
2515
its('content') { should match(/intel_idle.max_cstate=1/) }
2616
end
17+
else
18+
describe bash('cpupower idle-info') do
19+
its('stdout') { should match(/Number of idle states: 2/) }
20+
its('stdout') { should match(/Available idle states: POLL C1/) }
21+
end
2722
end
2823
end
2924

0 commit comments

Comments
 (0)