mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 08:18:32 +00:00
d52dbeaa7a
This changes splits the functionality in the internal system package into two packages: one for dealing with devices and one for dealing with kernel modules. This removes ambiguity around the meaning of driver / device roots in each case. In each case, a root can be specified where device nodes are created or kernel modules loaded. Signed-off-by: Evan Lezar <elezar@nvidia.com>
84 lines
1.7 KiB
Go
84 lines
1.7 KiB
Go
// Code generated by moq; DO NOT EDIT.
|
|
// github.com/matryer/moq
|
|
|
|
package nvmodules
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
// Ensure, that cmderMock does implement cmder.
|
|
// If this is not the case, regenerate this file with moq.
|
|
var _ cmder = &cmderMock{}
|
|
|
|
// cmderMock is a mock implementation of cmder.
|
|
//
|
|
// func TestSomethingThatUsescmder(t *testing.T) {
|
|
//
|
|
// // make and configure a mocked cmder
|
|
// mockedcmder := &cmderMock{
|
|
// RunFunc: func(s string, strings ...string) error {
|
|
// panic("mock out the Run method")
|
|
// },
|
|
// }
|
|
//
|
|
// // use mockedcmder in code that requires cmder
|
|
// // and then make assertions.
|
|
//
|
|
// }
|
|
type cmderMock struct {
|
|
// RunFunc mocks the Run method.
|
|
RunFunc func(s string, strings ...string) error
|
|
|
|
// calls tracks calls to the methods.
|
|
calls struct {
|
|
// Run holds details about calls to the Run method.
|
|
Run []struct {
|
|
// S is the s argument value.
|
|
S string
|
|
// Strings is the strings argument value.
|
|
Strings []string
|
|
}
|
|
}
|
|
lockRun sync.RWMutex
|
|
}
|
|
|
|
// Run calls RunFunc.
|
|
func (mock *cmderMock) Run(s string, strings ...string) error {
|
|
callInfo := struct {
|
|
S string
|
|
Strings []string
|
|
}{
|
|
S: s,
|
|
Strings: strings,
|
|
}
|
|
mock.lockRun.Lock()
|
|
mock.calls.Run = append(mock.calls.Run, callInfo)
|
|
mock.lockRun.Unlock()
|
|
if mock.RunFunc == nil {
|
|
var (
|
|
errOut error
|
|
)
|
|
return errOut
|
|
}
|
|
return mock.RunFunc(s, strings...)
|
|
}
|
|
|
|
// RunCalls gets all the calls that were made to Run.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedcmder.RunCalls())
|
|
func (mock *cmderMock) RunCalls() []struct {
|
|
S string
|
|
Strings []string
|
|
} {
|
|
var calls []struct {
|
|
S string
|
|
Strings []string
|
|
}
|
|
mock.lockRun.RLock()
|
|
calls = mock.calls.Run
|
|
mock.lockRun.RUnlock()
|
|
return calls
|
|
}
|