diff --git a/cookbooks/aws-parallelcluster-platform/spec/unit/resources/nvidia_driver_spec.rb b/cookbooks/aws-parallelcluster-platform/spec/unit/resources/nvidia_driver_spec.rb index 02dcf8ea19..88de441955 100644 --- a/cookbooks/aws-parallelcluster-platform/spec/unit/resources/nvidia_driver_spec.rb +++ b/cookbooks/aws-parallelcluster-platform/spec/unit/resources/nvidia_driver_spec.rb @@ -95,6 +95,28 @@ def self.setup(chef_run, nvidia_driver_version: nil) end end +describe 'nvidia_driver:nvidia_kernel_module' do + cached(:chef_run) do + ChefSpec::SoloRunner.new(step_into: ['nvidia_driver']) + end + cached(:resource) do + ConvergeNvidiaDriver.setup(chef_run) + chef_run.find_resource('nvidia_driver', 'setup') + end + context 'when on kernel' do + it 'is kernel' do + allow_any_instance_of(Object).to receive(:nvidia_kernel_module).and_return("kernel") + expect(resource.nvidia_kernel_module).to eq('kernel') + end + end + context 'when on kernel-open' do + it 'is kernel-open' do + allow_any_instance_of(Object).to receive(:nvidia_kernel_module).and_return("kernel-open") + expect(resource.nvidia_kernel_module).to eq('kernel-open') + end + end +end + describe 'nvidia_driver:nvidia_arch' do cached(:chef_run) do ChefSpec::SoloRunner.new(step_into: ['nvidia_driver'])