mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-24 13:05:17 +00:00
14f9e986c9
Signed-off-by: Evan Lezar <elezar@nvidia.com>
151 lines
3.4 KiB
Go
151 lines
3.4 KiB
Go
// Code generated by moq; DO NOT EDIT.
|
|
// github.com/matryer/moq
|
|
|
|
package discover
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
// Ensure, that DiscoverMock does implement Discover.
|
|
// If this is not the case, regenerate this file with moq.
|
|
var _ Discover = &DiscoverMock{}
|
|
|
|
// DiscoverMock is a mock implementation of Discover.
|
|
//
|
|
// func TestSomethingThatUsesDiscover(t *testing.T) {
|
|
//
|
|
// // make and configure a mocked Discover
|
|
// mockedDiscover := &DiscoverMock{
|
|
// DevicesFunc: func() ([]Device, error) {
|
|
// panic("mock out the Devices method")
|
|
// },
|
|
// HooksFunc: func() ([]Hook, error) {
|
|
// panic("mock out the Hooks method")
|
|
// },
|
|
// MountsFunc: func() ([]Mount, error) {
|
|
// panic("mock out the Mounts method")
|
|
// },
|
|
// }
|
|
//
|
|
// // use mockedDiscover in code that requires Discover
|
|
// // and then make assertions.
|
|
//
|
|
// }
|
|
type DiscoverMock struct {
|
|
// DevicesFunc mocks the Devices method.
|
|
DevicesFunc func() ([]Device, error)
|
|
|
|
// HooksFunc mocks the Hooks method.
|
|
HooksFunc func() ([]Hook, error)
|
|
|
|
// MountsFunc mocks the Mounts method.
|
|
MountsFunc func() ([]Mount, error)
|
|
|
|
// calls tracks calls to the methods.
|
|
calls struct {
|
|
// Devices holds details about calls to the Devices method.
|
|
Devices []struct {
|
|
}
|
|
// Hooks holds details about calls to the Hooks method.
|
|
Hooks []struct {
|
|
}
|
|
// Mounts holds details about calls to the Mounts method.
|
|
Mounts []struct {
|
|
}
|
|
}
|
|
lockDevices sync.RWMutex
|
|
lockHooks sync.RWMutex
|
|
lockMounts sync.RWMutex
|
|
}
|
|
|
|
// Devices calls DevicesFunc.
|
|
func (mock *DiscoverMock) Devices() ([]Device, error) {
|
|
callInfo := struct {
|
|
}{}
|
|
mock.lockDevices.Lock()
|
|
mock.calls.Devices = append(mock.calls.Devices, callInfo)
|
|
mock.lockDevices.Unlock()
|
|
if mock.DevicesFunc == nil {
|
|
var (
|
|
devicesOut []Device
|
|
errOut error
|
|
)
|
|
return devicesOut, errOut
|
|
}
|
|
return mock.DevicesFunc()
|
|
}
|
|
|
|
// DevicesCalls gets all the calls that were made to Devices.
|
|
// Check the length with:
|
|
// len(mockedDiscover.DevicesCalls())
|
|
func (mock *DiscoverMock) DevicesCalls() []struct {
|
|
} {
|
|
var calls []struct {
|
|
}
|
|
mock.lockDevices.RLock()
|
|
calls = mock.calls.Devices
|
|
mock.lockDevices.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// Hooks calls HooksFunc.
|
|
func (mock *DiscoverMock) Hooks() ([]Hook, error) {
|
|
callInfo := struct {
|
|
}{}
|
|
mock.lockHooks.Lock()
|
|
mock.calls.Hooks = append(mock.calls.Hooks, callInfo)
|
|
mock.lockHooks.Unlock()
|
|
if mock.HooksFunc == nil {
|
|
var (
|
|
hooksOut []Hook
|
|
errOut error
|
|
)
|
|
return hooksOut, errOut
|
|
}
|
|
return mock.HooksFunc()
|
|
}
|
|
|
|
// HooksCalls gets all the calls that were made to Hooks.
|
|
// Check the length with:
|
|
// len(mockedDiscover.HooksCalls())
|
|
func (mock *DiscoverMock) HooksCalls() []struct {
|
|
} {
|
|
var calls []struct {
|
|
}
|
|
mock.lockHooks.RLock()
|
|
calls = mock.calls.Hooks
|
|
mock.lockHooks.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// Mounts calls MountsFunc.
|
|
func (mock *DiscoverMock) Mounts() ([]Mount, error) {
|
|
callInfo := struct {
|
|
}{}
|
|
mock.lockMounts.Lock()
|
|
mock.calls.Mounts = append(mock.calls.Mounts, callInfo)
|
|
mock.lockMounts.Unlock()
|
|
if mock.MountsFunc == nil {
|
|
var (
|
|
mountsOut []Mount
|
|
errOut error
|
|
)
|
|
return mountsOut, errOut
|
|
}
|
|
return mock.MountsFunc()
|
|
}
|
|
|
|
// MountsCalls gets all the calls that were made to Mounts.
|
|
// Check the length with:
|
|
// len(mockedDiscover.MountsCalls())
|
|
func (mock *DiscoverMock) MountsCalls() []struct {
|
|
} {
|
|
var calls []struct {
|
|
}
|
|
mock.lockMounts.RLock()
|
|
calls = mock.calls.Mounts
|
|
mock.lockMounts.RUnlock()
|
|
return calls
|
|
}
|