Skip to content

Commit

Permalink
Add ChefSpec for nvidia_kernel_module
Browse files Browse the repository at this point in the history
  • Loading branch information
hgreebe committed Jan 16, 2024
1 parent 73f016d commit 51571e4
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down

0 comments on commit 51571e4

Please sign in to comment.