From 86df6ceee4bd7d4617e8104734824aa5f72f4f14 Mon Sep 17 00:00:00 2001 From: Hanwen Date: Mon, 27 Jan 2025 09:36:06 -0800 Subject: [PATCH] [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 --- .../test/controls/c_states_spec.rb | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/cookbooks/aws-parallelcluster-platform/test/controls/c_states_spec.rb b/cookbooks/aws-parallelcluster-platform/test/controls/c_states_spec.rb index 40f9309284..86b5686008 100644 --- a/cookbooks/aws-parallelcluster-platform/test/controls/c_states_spec.rb +++ b/cookbooks/aws-parallelcluster-platform/test/controls/c_states_spec.rb @@ -3,27 +3,22 @@ title 'Check the configuration to disable c states' only_if { !os_properties.on_docker? && os_properties.x86? } - describe file('/etc/default/grub') do - it { should exist } - its('content') { should match(/processor.max_cstate=1/) } - its('content') { should match(/intel_idle.max_cstate=1/) } - end - - if os_properties.redhat8? || os_properties.alinux2? || os_properties.centos7? || os_properties.rocky8? - - describe file('/boot/grub2/grub.cfg') do + if os_properties.ubuntu2004? + describe file('/etc/default/grub') do it { should exist } its('content') { should match(/processor.max_cstate=1/) } its('content') { should match(/intel_idle.max_cstate=1/) } end - - elsif os.debian? - describe file('/boot/grub/grub.cfg') do it { should exist } its('content') { should match(/processor.max_cstate=1/) } its('content') { should match(/intel_idle.max_cstate=1/) } end + else + describe bash('cpupower idle-info') do + its('stdout') { should match(/Number of idle states: 2/) } + its('stdout') { should match(/Available idle states: POLL C1/) } + end end end