mirror of
https://github.com/clearml/go-nvlib
synced 2025-01-31 02:47:02 +00:00
Merge branch 'add-more-apis' into 'main'
Add new APIs in nvml and nvlib.device See merge request nvidia/cloud-native/go-nvlib!29
This commit is contained in:
commit
6fe07bb333
@ -26,7 +26,9 @@ type Interface interface {
|
||||
GetMigDevices() ([]MigDevice, error)
|
||||
GetMigProfiles() ([]MigProfile, error)
|
||||
NewDevice(d nvml.Device) (Device, error)
|
||||
NewDeviceByUUID(uuid string) (Device, error)
|
||||
NewMigDevice(d nvml.Device) (MigDevice, error)
|
||||
NewMigDeviceByUUID(uuid string) (MigDevice, error)
|
||||
NewMigProfile(giProfileID, ciProfileID, ciEngProfileID int, migMemorySizeMB, deviceMemorySizeBytes uint64) (MigProfile, error)
|
||||
ParseMigProfile(profile string) (MigProfile, error)
|
||||
VisitDevices(func(i int, d Device) error) error
|
||||
|
@ -46,6 +46,15 @@ func (d *devicelib) NewDevice(dev nvml.Device) (Device, error) {
|
||||
return d.newDevice(dev)
|
||||
}
|
||||
|
||||
// NewDeviceByUUID builds a new Device from a UUID
|
||||
func (d *devicelib) NewDeviceByUUID(uuid string) (Device, error) {
|
||||
dev, ret := d.nvml.DeviceGetHandleByUUID(uuid)
|
||||
if ret != nvml.SUCCESS {
|
||||
return nil, fmt.Errorf("error getting device handle for uuid '%v': %v", uuid, ret)
|
||||
}
|
||||
return d.newDevice(dev)
|
||||
}
|
||||
|
||||
// newDevice creates a device from an nvml.Device
|
||||
func (d *devicelib) newDevice(dev nvml.Device) (*device, error) {
|
||||
return &device{dev, d}, nil
|
||||
|
@ -48,6 +48,15 @@ func (d *devicelib) NewMigDevice(handle nvml.Device) (MigDevice, error) {
|
||||
return &migdevice{handle, d, nil}, nil
|
||||
}
|
||||
|
||||
// NewMigDeviceByUUID builds a new MigDevice from a UUID
|
||||
func (d *devicelib) NewMigDeviceByUUID(uuid string) (MigDevice, error) {
|
||||
dev, ret := d.nvml.DeviceGetHandleByUUID(uuid)
|
||||
if ret != nvml.SUCCESS {
|
||||
return nil, fmt.Errorf("error getting device handle for uuid '%v': %v", uuid, ret)
|
||||
}
|
||||
return d.NewMigDevice(dev)
|
||||
}
|
||||
|
||||
// GetProfile returns the MIG profile associated with a MIG device
|
||||
func (m *migdevice) GetProfile() (MigProfile, error) {
|
||||
if m.profile != nil {
|
||||
|
@ -13,22 +13,22 @@ var _ ComputeInstance = &ComputeInstanceMock{}
|
||||
|
||||
// ComputeInstanceMock is a mock implementation of ComputeInstance.
|
||||
//
|
||||
// func TestSomethingThatUsesComputeInstance(t *testing.T) {
|
||||
// func TestSomethingThatUsesComputeInstance(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked ComputeInstance
|
||||
// mockedComputeInstance := &ComputeInstanceMock{
|
||||
// DestroyFunc: func() Return {
|
||||
// panic("mock out the Destroy method")
|
||||
// },
|
||||
// GetInfoFunc: func() (ComputeInstanceInfo, Return) {
|
||||
// panic("mock out the GetInfo method")
|
||||
// },
|
||||
// }
|
||||
// // make and configure a mocked ComputeInstance
|
||||
// mockedComputeInstance := &ComputeInstanceMock{
|
||||
// DestroyFunc: func() Return {
|
||||
// panic("mock out the Destroy method")
|
||||
// },
|
||||
// GetInfoFunc: func() (ComputeInstanceInfo, Return) {
|
||||
// panic("mock out the GetInfo method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedComputeInstance in code that requires ComputeInstance
|
||||
// // and then make assertions.
|
||||
// // use mockedComputeInstance in code that requires ComputeInstance
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
// }
|
||||
type ComputeInstanceMock struct {
|
||||
// DestroyFunc mocks the Destroy method.
|
||||
DestroyFunc func() Return
|
||||
@ -64,7 +64,8 @@ func (mock *ComputeInstanceMock) Destroy() Return {
|
||||
|
||||
// DestroyCalls gets all the calls that were made to Destroy.
|
||||
// Check the length with:
|
||||
// len(mockedComputeInstance.DestroyCalls())
|
||||
//
|
||||
// len(mockedComputeInstance.DestroyCalls())
|
||||
func (mock *ComputeInstanceMock) DestroyCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -90,7 +91,8 @@ func (mock *ComputeInstanceMock) GetInfo() (ComputeInstanceInfo, Return) {
|
||||
|
||||
// GetInfoCalls gets all the calls that were made to GetInfo.
|
||||
// Check the length with:
|
||||
// len(mockedComputeInstance.GetInfoCalls())
|
||||
//
|
||||
// len(mockedComputeInstance.GetInfoCalls())
|
||||
func (mock *ComputeInstanceMock) GetInfoCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
|
@ -88,6 +88,16 @@ func (d nvmlDevice) GetGpuInstanceProfileInfo(profile int) (GpuInstanceProfileIn
|
||||
return GpuInstanceProfileInfo(p), Return(r)
|
||||
}
|
||||
|
||||
// GetGpuInstancePossiblePlacements returns the possible placements of a GPU Instance
|
||||
func (d nvmlDevice) GetGpuInstancePossiblePlacements(info *GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return) {
|
||||
nvmlPlacements, r := nvml.Device(d).GetGpuInstancePossiblePlacements((*nvml.GpuInstanceProfileInfo)(info))
|
||||
var placements []GpuInstancePlacement
|
||||
for _, p := range nvmlPlacements {
|
||||
placements = append(placements, GpuInstancePlacement(p))
|
||||
}
|
||||
return placements, Return(r)
|
||||
}
|
||||
|
||||
// GetGpuInstances returns the set of GPU Instances associated with a Device
|
||||
func (d nvmlDevice) GetGpuInstances(info *GpuInstanceProfileInfo) ([]GpuInstance, Return) {
|
||||
nvmlGis, r := nvml.Device(d).GetGpuInstances((*nvml.GpuInstanceProfileInfo)(info))
|
||||
@ -98,6 +108,12 @@ func (d nvmlDevice) GetGpuInstances(info *GpuInstanceProfileInfo) ([]GpuInstance
|
||||
return gis, Return(r)
|
||||
}
|
||||
|
||||
// CreateGpuInstanceWithPlacement creates a GPU Instance with a specific placement
|
||||
func (d nvmlDevice) CreateGpuInstanceWithPlacement(info *GpuInstanceProfileInfo, placement *GpuInstancePlacement) (GpuInstance, Return) {
|
||||
gi, r := nvml.Device(d).CreateGpuInstanceWithPlacement((*nvml.GpuInstanceProfileInfo)(info), (*nvml.GpuInstancePlacement)(placement))
|
||||
return nvmlGpuInstance(gi), Return(r)
|
||||
}
|
||||
|
||||
// GetMaxMigDeviceCount returns the maximum number of MIG devices that can be created on a Device
|
||||
func (d nvmlDevice) GetMaxMigDeviceCount() (int, Return) {
|
||||
m, r := nvml.Device(d).GetMaxMigDeviceCount()
|
||||
|
@ -13,80 +13,89 @@ var _ Device = &DeviceMock{}
|
||||
|
||||
// DeviceMock is a mock implementation of Device.
|
||||
//
|
||||
// func TestSomethingThatUsesDevice(t *testing.T) {
|
||||
// func TestSomethingThatUsesDevice(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked Device
|
||||
// mockedDevice := &DeviceMock{
|
||||
// GetAttributesFunc: func() (DeviceAttributes, Return) {
|
||||
// panic("mock out the GetAttributes method")
|
||||
// },
|
||||
// GetComputeInstanceIdFunc: func() (int, Return) {
|
||||
// panic("mock out the GetComputeInstanceId method")
|
||||
// },
|
||||
// GetCudaComputeCapabilityFunc: func() (int, int, Return) {
|
||||
// panic("mock out the GetCudaComputeCapability method")
|
||||
// },
|
||||
// GetDeviceHandleFromMigDeviceHandleFunc: func() (Device, Return) {
|
||||
// panic("mock out the GetDeviceHandleFromMigDeviceHandle method")
|
||||
// },
|
||||
// GetGpuInstanceByIdFunc: func(ID int) (GpuInstance, Return) {
|
||||
// panic("mock out the GetGpuInstanceById method")
|
||||
// },
|
||||
// GetGpuInstanceIdFunc: func() (int, Return) {
|
||||
// panic("mock out the GetGpuInstanceId method")
|
||||
// },
|
||||
// GetGpuInstanceProfileInfoFunc: func(Profile int) (GpuInstanceProfileInfo, Return) {
|
||||
// panic("mock out the GetGpuInstanceProfileInfo method")
|
||||
// },
|
||||
// GetGpuInstancesFunc: func(Info *GpuInstanceProfileInfo) ([]GpuInstance, Return) {
|
||||
// panic("mock out the GetGpuInstances method")
|
||||
// },
|
||||
// GetIndexFunc: func() (int, Return) {
|
||||
// panic("mock out the GetIndex method")
|
||||
// },
|
||||
// GetMaxMigDeviceCountFunc: func() (int, Return) {
|
||||
// panic("mock out the GetMaxMigDeviceCount method")
|
||||
// },
|
||||
// GetMemoryInfoFunc: func() (Memory, Return) {
|
||||
// panic("mock out the GetMemoryInfo method")
|
||||
// },
|
||||
// GetMigDeviceHandleByIndexFunc: func(Index int) (Device, Return) {
|
||||
// panic("mock out the GetMigDeviceHandleByIndex method")
|
||||
// },
|
||||
// GetMigModeFunc: func() (int, int, Return) {
|
||||
// panic("mock out the GetMigMode method")
|
||||
// },
|
||||
// GetMinorNumberFunc: func() (int, Return) {
|
||||
// panic("mock out the GetMinorNumber method")
|
||||
// },
|
||||
// GetNameFunc: func() (string, Return) {
|
||||
// panic("mock out the GetName method")
|
||||
// },
|
||||
// GetPciInfoFunc: func() (PciInfo, Return) {
|
||||
// panic("mock out the GetPciInfo method")
|
||||
// },
|
||||
// GetSupportedEventTypesFunc: func() (uint64, Return) {
|
||||
// panic("mock out the GetSupportedEventTypes method")
|
||||
// },
|
||||
// GetUUIDFunc: func() (string, Return) {
|
||||
// panic("mock out the GetUUID method")
|
||||
// },
|
||||
// IsMigDeviceHandleFunc: func() (bool, Return) {
|
||||
// panic("mock out the IsMigDeviceHandle method")
|
||||
// },
|
||||
// RegisterEventsFunc: func(v uint64, eventSet EventSet) Return {
|
||||
// panic("mock out the RegisterEvents method")
|
||||
// },
|
||||
// SetMigModeFunc: func(Mode int) (Return, Return) {
|
||||
// panic("mock out the SetMigMode method")
|
||||
// },
|
||||
// }
|
||||
// // make and configure a mocked Device
|
||||
// mockedDevice := &DeviceMock{
|
||||
// CreateGpuInstanceWithPlacementFunc: func(gpuInstanceProfileInfo *GpuInstanceProfileInfo, gpuInstancePlacement *GpuInstancePlacement) (GpuInstance, Return) {
|
||||
// panic("mock out the CreateGpuInstanceWithPlacement method")
|
||||
// },
|
||||
// GetAttributesFunc: func() (DeviceAttributes, Return) {
|
||||
// panic("mock out the GetAttributes method")
|
||||
// },
|
||||
// GetComputeInstanceIdFunc: func() (int, Return) {
|
||||
// panic("mock out the GetComputeInstanceId method")
|
||||
// },
|
||||
// GetCudaComputeCapabilityFunc: func() (int, int, Return) {
|
||||
// panic("mock out the GetCudaComputeCapability method")
|
||||
// },
|
||||
// GetDeviceHandleFromMigDeviceHandleFunc: func() (Device, Return) {
|
||||
// panic("mock out the GetDeviceHandleFromMigDeviceHandle method")
|
||||
// },
|
||||
// GetGpuInstanceByIdFunc: func(ID int) (GpuInstance, Return) {
|
||||
// panic("mock out the GetGpuInstanceById method")
|
||||
// },
|
||||
// GetGpuInstanceIdFunc: func() (int, Return) {
|
||||
// panic("mock out the GetGpuInstanceId method")
|
||||
// },
|
||||
// GetGpuInstancePossiblePlacementsFunc: func(gpuInstanceProfileInfo *GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return) {
|
||||
// panic("mock out the GetGpuInstancePossiblePlacements method")
|
||||
// },
|
||||
// GetGpuInstanceProfileInfoFunc: func(Profile int) (GpuInstanceProfileInfo, Return) {
|
||||
// panic("mock out the GetGpuInstanceProfileInfo method")
|
||||
// },
|
||||
// GetGpuInstancesFunc: func(Info *GpuInstanceProfileInfo) ([]GpuInstance, Return) {
|
||||
// panic("mock out the GetGpuInstances method")
|
||||
// },
|
||||
// GetIndexFunc: func() (int, Return) {
|
||||
// panic("mock out the GetIndex method")
|
||||
// },
|
||||
// GetMaxMigDeviceCountFunc: func() (int, Return) {
|
||||
// panic("mock out the GetMaxMigDeviceCount method")
|
||||
// },
|
||||
// GetMemoryInfoFunc: func() (Memory, Return) {
|
||||
// panic("mock out the GetMemoryInfo method")
|
||||
// },
|
||||
// GetMigDeviceHandleByIndexFunc: func(Index int) (Device, Return) {
|
||||
// panic("mock out the GetMigDeviceHandleByIndex method")
|
||||
// },
|
||||
// GetMigModeFunc: func() (int, int, Return) {
|
||||
// panic("mock out the GetMigMode method")
|
||||
// },
|
||||
// GetMinorNumberFunc: func() (int, Return) {
|
||||
// panic("mock out the GetMinorNumber method")
|
||||
// },
|
||||
// GetNameFunc: func() (string, Return) {
|
||||
// panic("mock out the GetName method")
|
||||
// },
|
||||
// GetPciInfoFunc: func() (PciInfo, Return) {
|
||||
// panic("mock out the GetPciInfo method")
|
||||
// },
|
||||
// GetSupportedEventTypesFunc: func() (uint64, Return) {
|
||||
// panic("mock out the GetSupportedEventTypes method")
|
||||
// },
|
||||
// GetUUIDFunc: func() (string, Return) {
|
||||
// panic("mock out the GetUUID method")
|
||||
// },
|
||||
// IsMigDeviceHandleFunc: func() (bool, Return) {
|
||||
// panic("mock out the IsMigDeviceHandle method")
|
||||
// },
|
||||
// RegisterEventsFunc: func(v uint64, eventSet EventSet) Return {
|
||||
// panic("mock out the RegisterEvents method")
|
||||
// },
|
||||
// SetMigModeFunc: func(Mode int) (Return, Return) {
|
||||
// panic("mock out the SetMigMode method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedDevice in code that requires Device
|
||||
// // and then make assertions.
|
||||
// // use mockedDevice in code that requires Device
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
// }
|
||||
type DeviceMock struct {
|
||||
// CreateGpuInstanceWithPlacementFunc mocks the CreateGpuInstanceWithPlacement method.
|
||||
CreateGpuInstanceWithPlacementFunc func(gpuInstanceProfileInfo *GpuInstanceProfileInfo, gpuInstancePlacement *GpuInstancePlacement) (GpuInstance, Return)
|
||||
|
||||
// GetAttributesFunc mocks the GetAttributes method.
|
||||
GetAttributesFunc func() (DeviceAttributes, Return)
|
||||
|
||||
@ -105,6 +114,9 @@ type DeviceMock struct {
|
||||
// GetGpuInstanceIdFunc mocks the GetGpuInstanceId method.
|
||||
GetGpuInstanceIdFunc func() (int, Return)
|
||||
|
||||
// GetGpuInstancePossiblePlacementsFunc mocks the GetGpuInstancePossiblePlacements method.
|
||||
GetGpuInstancePossiblePlacementsFunc func(gpuInstanceProfileInfo *GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return)
|
||||
|
||||
// GetGpuInstanceProfileInfoFunc mocks the GetGpuInstanceProfileInfo method.
|
||||
GetGpuInstanceProfileInfoFunc func(Profile int) (GpuInstanceProfileInfo, Return)
|
||||
|
||||
@ -152,6 +164,13 @@ type DeviceMock struct {
|
||||
|
||||
// calls tracks calls to the methods.
|
||||
calls struct {
|
||||
// CreateGpuInstanceWithPlacement holds details about calls to the CreateGpuInstanceWithPlacement method.
|
||||
CreateGpuInstanceWithPlacement []struct {
|
||||
// GpuInstanceProfileInfo is the gpuInstanceProfileInfo argument value.
|
||||
GpuInstanceProfileInfo *GpuInstanceProfileInfo
|
||||
// GpuInstancePlacement is the gpuInstancePlacement argument value.
|
||||
GpuInstancePlacement *GpuInstancePlacement
|
||||
}
|
||||
// GetAttributes holds details about calls to the GetAttributes method.
|
||||
GetAttributes []struct {
|
||||
}
|
||||
@ -172,6 +191,11 @@ type DeviceMock struct {
|
||||
// GetGpuInstanceId holds details about calls to the GetGpuInstanceId method.
|
||||
GetGpuInstanceId []struct {
|
||||
}
|
||||
// GetGpuInstancePossiblePlacements holds details about calls to the GetGpuInstancePossiblePlacements method.
|
||||
GetGpuInstancePossiblePlacements []struct {
|
||||
// GpuInstanceProfileInfo is the gpuInstanceProfileInfo argument value.
|
||||
GpuInstanceProfileInfo *GpuInstanceProfileInfo
|
||||
}
|
||||
// GetGpuInstanceProfileInfo holds details about calls to the GetGpuInstanceProfileInfo method.
|
||||
GetGpuInstanceProfileInfo []struct {
|
||||
// Profile is the Profile argument value.
|
||||
@ -230,12 +254,14 @@ type DeviceMock struct {
|
||||
Mode int
|
||||
}
|
||||
}
|
||||
lockCreateGpuInstanceWithPlacement sync.RWMutex
|
||||
lockGetAttributes sync.RWMutex
|
||||
lockGetComputeInstanceId sync.RWMutex
|
||||
lockGetCudaComputeCapability sync.RWMutex
|
||||
lockGetDeviceHandleFromMigDeviceHandle sync.RWMutex
|
||||
lockGetGpuInstanceById sync.RWMutex
|
||||
lockGetGpuInstanceId sync.RWMutex
|
||||
lockGetGpuInstancePossiblePlacements sync.RWMutex
|
||||
lockGetGpuInstanceProfileInfo sync.RWMutex
|
||||
lockGetGpuInstances sync.RWMutex
|
||||
lockGetIndex sync.RWMutex
|
||||
@ -253,6 +279,42 @@ type DeviceMock struct {
|
||||
lockSetMigMode sync.RWMutex
|
||||
}
|
||||
|
||||
// CreateGpuInstanceWithPlacement calls CreateGpuInstanceWithPlacementFunc.
|
||||
func (mock *DeviceMock) CreateGpuInstanceWithPlacement(gpuInstanceProfileInfo *GpuInstanceProfileInfo, gpuInstancePlacement *GpuInstancePlacement) (GpuInstance, Return) {
|
||||
if mock.CreateGpuInstanceWithPlacementFunc == nil {
|
||||
panic("DeviceMock.CreateGpuInstanceWithPlacementFunc: method is nil but Device.CreateGpuInstanceWithPlacement was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
GpuInstanceProfileInfo *GpuInstanceProfileInfo
|
||||
GpuInstancePlacement *GpuInstancePlacement
|
||||
}{
|
||||
GpuInstanceProfileInfo: gpuInstanceProfileInfo,
|
||||
GpuInstancePlacement: gpuInstancePlacement,
|
||||
}
|
||||
mock.lockCreateGpuInstanceWithPlacement.Lock()
|
||||
mock.calls.CreateGpuInstanceWithPlacement = append(mock.calls.CreateGpuInstanceWithPlacement, callInfo)
|
||||
mock.lockCreateGpuInstanceWithPlacement.Unlock()
|
||||
return mock.CreateGpuInstanceWithPlacementFunc(gpuInstanceProfileInfo, gpuInstancePlacement)
|
||||
}
|
||||
|
||||
// CreateGpuInstanceWithPlacementCalls gets all the calls that were made to CreateGpuInstanceWithPlacement.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedDevice.CreateGpuInstanceWithPlacementCalls())
|
||||
func (mock *DeviceMock) CreateGpuInstanceWithPlacementCalls() []struct {
|
||||
GpuInstanceProfileInfo *GpuInstanceProfileInfo
|
||||
GpuInstancePlacement *GpuInstancePlacement
|
||||
} {
|
||||
var calls []struct {
|
||||
GpuInstanceProfileInfo *GpuInstanceProfileInfo
|
||||
GpuInstancePlacement *GpuInstancePlacement
|
||||
}
|
||||
mock.lockCreateGpuInstanceWithPlacement.RLock()
|
||||
calls = mock.calls.CreateGpuInstanceWithPlacement
|
||||
mock.lockCreateGpuInstanceWithPlacement.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetAttributes calls GetAttributesFunc.
|
||||
func (mock *DeviceMock) GetAttributes() (DeviceAttributes, Return) {
|
||||
if mock.GetAttributesFunc == nil {
|
||||
@ -268,7 +330,8 @@ func (mock *DeviceMock) GetAttributes() (DeviceAttributes, Return) {
|
||||
|
||||
// GetAttributesCalls gets all the calls that were made to GetAttributes.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetAttributesCalls())
|
||||
//
|
||||
// len(mockedDevice.GetAttributesCalls())
|
||||
func (mock *DeviceMock) GetAttributesCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -294,7 +357,8 @@ func (mock *DeviceMock) GetComputeInstanceId() (int, Return) {
|
||||
|
||||
// GetComputeInstanceIdCalls gets all the calls that were made to GetComputeInstanceId.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetComputeInstanceIdCalls())
|
||||
//
|
||||
// len(mockedDevice.GetComputeInstanceIdCalls())
|
||||
func (mock *DeviceMock) GetComputeInstanceIdCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -320,7 +384,8 @@ func (mock *DeviceMock) GetCudaComputeCapability() (int, int, Return) {
|
||||
|
||||
// GetCudaComputeCapabilityCalls gets all the calls that were made to GetCudaComputeCapability.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetCudaComputeCapabilityCalls())
|
||||
//
|
||||
// len(mockedDevice.GetCudaComputeCapabilityCalls())
|
||||
func (mock *DeviceMock) GetCudaComputeCapabilityCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -346,7 +411,8 @@ func (mock *DeviceMock) GetDeviceHandleFromMigDeviceHandle() (Device, Return) {
|
||||
|
||||
// GetDeviceHandleFromMigDeviceHandleCalls gets all the calls that were made to GetDeviceHandleFromMigDeviceHandle.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetDeviceHandleFromMigDeviceHandleCalls())
|
||||
//
|
||||
// len(mockedDevice.GetDeviceHandleFromMigDeviceHandleCalls())
|
||||
func (mock *DeviceMock) GetDeviceHandleFromMigDeviceHandleCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -375,7 +441,8 @@ func (mock *DeviceMock) GetGpuInstanceById(ID int) (GpuInstance, Return) {
|
||||
|
||||
// GetGpuInstanceByIdCalls gets all the calls that were made to GetGpuInstanceById.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetGpuInstanceByIdCalls())
|
||||
//
|
||||
// len(mockedDevice.GetGpuInstanceByIdCalls())
|
||||
func (mock *DeviceMock) GetGpuInstanceByIdCalls() []struct {
|
||||
ID int
|
||||
} {
|
||||
@ -403,7 +470,8 @@ func (mock *DeviceMock) GetGpuInstanceId() (int, Return) {
|
||||
|
||||
// GetGpuInstanceIdCalls gets all the calls that were made to GetGpuInstanceId.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetGpuInstanceIdCalls())
|
||||
//
|
||||
// len(mockedDevice.GetGpuInstanceIdCalls())
|
||||
func (mock *DeviceMock) GetGpuInstanceIdCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -414,6 +482,38 @@ func (mock *DeviceMock) GetGpuInstanceIdCalls() []struct {
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetGpuInstancePossiblePlacements calls GetGpuInstancePossiblePlacementsFunc.
|
||||
func (mock *DeviceMock) GetGpuInstancePossiblePlacements(gpuInstanceProfileInfo *GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return) {
|
||||
if mock.GetGpuInstancePossiblePlacementsFunc == nil {
|
||||
panic("DeviceMock.GetGpuInstancePossiblePlacementsFunc: method is nil but Device.GetGpuInstancePossiblePlacements was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
GpuInstanceProfileInfo *GpuInstanceProfileInfo
|
||||
}{
|
||||
GpuInstanceProfileInfo: gpuInstanceProfileInfo,
|
||||
}
|
||||
mock.lockGetGpuInstancePossiblePlacements.Lock()
|
||||
mock.calls.GetGpuInstancePossiblePlacements = append(mock.calls.GetGpuInstancePossiblePlacements, callInfo)
|
||||
mock.lockGetGpuInstancePossiblePlacements.Unlock()
|
||||
return mock.GetGpuInstancePossiblePlacementsFunc(gpuInstanceProfileInfo)
|
||||
}
|
||||
|
||||
// GetGpuInstancePossiblePlacementsCalls gets all the calls that were made to GetGpuInstancePossiblePlacements.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedDevice.GetGpuInstancePossiblePlacementsCalls())
|
||||
func (mock *DeviceMock) GetGpuInstancePossiblePlacementsCalls() []struct {
|
||||
GpuInstanceProfileInfo *GpuInstanceProfileInfo
|
||||
} {
|
||||
var calls []struct {
|
||||
GpuInstanceProfileInfo *GpuInstanceProfileInfo
|
||||
}
|
||||
mock.lockGetGpuInstancePossiblePlacements.RLock()
|
||||
calls = mock.calls.GetGpuInstancePossiblePlacements
|
||||
mock.lockGetGpuInstancePossiblePlacements.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetGpuInstanceProfileInfo calls GetGpuInstanceProfileInfoFunc.
|
||||
func (mock *DeviceMock) GetGpuInstanceProfileInfo(Profile int) (GpuInstanceProfileInfo, Return) {
|
||||
if mock.GetGpuInstanceProfileInfoFunc == nil {
|
||||
@ -432,7 +532,8 @@ func (mock *DeviceMock) GetGpuInstanceProfileInfo(Profile int) (GpuInstanceProfi
|
||||
|
||||
// GetGpuInstanceProfileInfoCalls gets all the calls that were made to GetGpuInstanceProfileInfo.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetGpuInstanceProfileInfoCalls())
|
||||
//
|
||||
// len(mockedDevice.GetGpuInstanceProfileInfoCalls())
|
||||
func (mock *DeviceMock) GetGpuInstanceProfileInfoCalls() []struct {
|
||||
Profile int
|
||||
} {
|
||||
@ -463,7 +564,8 @@ func (mock *DeviceMock) GetGpuInstances(Info *GpuInstanceProfileInfo) ([]GpuInst
|
||||
|
||||
// GetGpuInstancesCalls gets all the calls that were made to GetGpuInstances.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetGpuInstancesCalls())
|
||||
//
|
||||
// len(mockedDevice.GetGpuInstancesCalls())
|
||||
func (mock *DeviceMock) GetGpuInstancesCalls() []struct {
|
||||
Info *GpuInstanceProfileInfo
|
||||
} {
|
||||
@ -491,7 +593,8 @@ func (mock *DeviceMock) GetIndex() (int, Return) {
|
||||
|
||||
// GetIndexCalls gets all the calls that were made to GetIndex.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetIndexCalls())
|
||||
//
|
||||
// len(mockedDevice.GetIndexCalls())
|
||||
func (mock *DeviceMock) GetIndexCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -517,7 +620,8 @@ func (mock *DeviceMock) GetMaxMigDeviceCount() (int, Return) {
|
||||
|
||||
// GetMaxMigDeviceCountCalls gets all the calls that were made to GetMaxMigDeviceCount.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetMaxMigDeviceCountCalls())
|
||||
//
|
||||
// len(mockedDevice.GetMaxMigDeviceCountCalls())
|
||||
func (mock *DeviceMock) GetMaxMigDeviceCountCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -543,7 +647,8 @@ func (mock *DeviceMock) GetMemoryInfo() (Memory, Return) {
|
||||
|
||||
// GetMemoryInfoCalls gets all the calls that were made to GetMemoryInfo.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetMemoryInfoCalls())
|
||||
//
|
||||
// len(mockedDevice.GetMemoryInfoCalls())
|
||||
func (mock *DeviceMock) GetMemoryInfoCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -572,7 +677,8 @@ func (mock *DeviceMock) GetMigDeviceHandleByIndex(Index int) (Device, Return) {
|
||||
|
||||
// GetMigDeviceHandleByIndexCalls gets all the calls that were made to GetMigDeviceHandleByIndex.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetMigDeviceHandleByIndexCalls())
|
||||
//
|
||||
// len(mockedDevice.GetMigDeviceHandleByIndexCalls())
|
||||
func (mock *DeviceMock) GetMigDeviceHandleByIndexCalls() []struct {
|
||||
Index int
|
||||
} {
|
||||
@ -600,7 +706,8 @@ func (mock *DeviceMock) GetMigMode() (int, int, Return) {
|
||||
|
||||
// GetMigModeCalls gets all the calls that were made to GetMigMode.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetMigModeCalls())
|
||||
//
|
||||
// len(mockedDevice.GetMigModeCalls())
|
||||
func (mock *DeviceMock) GetMigModeCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -626,7 +733,8 @@ func (mock *DeviceMock) GetMinorNumber() (int, Return) {
|
||||
|
||||
// GetMinorNumberCalls gets all the calls that were made to GetMinorNumber.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetMinorNumberCalls())
|
||||
//
|
||||
// len(mockedDevice.GetMinorNumberCalls())
|
||||
func (mock *DeviceMock) GetMinorNumberCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -652,7 +760,8 @@ func (mock *DeviceMock) GetName() (string, Return) {
|
||||
|
||||
// GetNameCalls gets all the calls that were made to GetName.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetNameCalls())
|
||||
//
|
||||
// len(mockedDevice.GetNameCalls())
|
||||
func (mock *DeviceMock) GetNameCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -678,7 +787,8 @@ func (mock *DeviceMock) GetPciInfo() (PciInfo, Return) {
|
||||
|
||||
// GetPciInfoCalls gets all the calls that were made to GetPciInfo.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetPciInfoCalls())
|
||||
//
|
||||
// len(mockedDevice.GetPciInfoCalls())
|
||||
func (mock *DeviceMock) GetPciInfoCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -704,7 +814,8 @@ func (mock *DeviceMock) GetSupportedEventTypes() (uint64, Return) {
|
||||
|
||||
// GetSupportedEventTypesCalls gets all the calls that were made to GetSupportedEventTypes.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetSupportedEventTypesCalls())
|
||||
//
|
||||
// len(mockedDevice.GetSupportedEventTypesCalls())
|
||||
func (mock *DeviceMock) GetSupportedEventTypesCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -730,7 +841,8 @@ func (mock *DeviceMock) GetUUID() (string, Return) {
|
||||
|
||||
// GetUUIDCalls gets all the calls that were made to GetUUID.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.GetUUIDCalls())
|
||||
//
|
||||
// len(mockedDevice.GetUUIDCalls())
|
||||
func (mock *DeviceMock) GetUUIDCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -756,7 +868,8 @@ func (mock *DeviceMock) IsMigDeviceHandle() (bool, Return) {
|
||||
|
||||
// IsMigDeviceHandleCalls gets all the calls that were made to IsMigDeviceHandle.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.IsMigDeviceHandleCalls())
|
||||
//
|
||||
// len(mockedDevice.IsMigDeviceHandleCalls())
|
||||
func (mock *DeviceMock) IsMigDeviceHandleCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -787,7 +900,8 @@ func (mock *DeviceMock) RegisterEvents(v uint64, eventSet EventSet) Return {
|
||||
|
||||
// RegisterEventsCalls gets all the calls that were made to RegisterEvents.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.RegisterEventsCalls())
|
||||
//
|
||||
// len(mockedDevice.RegisterEventsCalls())
|
||||
func (mock *DeviceMock) RegisterEventsCalls() []struct {
|
||||
V uint64
|
||||
EventSet EventSet
|
||||
@ -820,7 +934,8 @@ func (mock *DeviceMock) SetMigMode(Mode int) (Return, Return) {
|
||||
|
||||
// SetMigModeCalls gets all the calls that were made to SetMigMode.
|
||||
// Check the length with:
|
||||
// len(mockedDevice.SetMigModeCalls())
|
||||
//
|
||||
// len(mockedDevice.SetMigModeCalls())
|
||||
func (mock *DeviceMock) SetMigModeCalls() []struct {
|
||||
Mode int
|
||||
} {
|
||||
|
@ -13,34 +13,34 @@ var _ GpuInstance = &GpuInstanceMock{}
|
||||
|
||||
// GpuInstanceMock is a mock implementation of GpuInstance.
|
||||
//
|
||||
// func TestSomethingThatUsesGpuInstance(t *testing.T) {
|
||||
// func TestSomethingThatUsesGpuInstance(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked GpuInstance
|
||||
// mockedGpuInstance := &GpuInstanceMock{
|
||||
// CreateComputeInstanceFunc: func(Info *ComputeInstanceProfileInfo) (ComputeInstance, Return) {
|
||||
// panic("mock out the CreateComputeInstance method")
|
||||
// },
|
||||
// DestroyFunc: func() Return {
|
||||
// panic("mock out the Destroy method")
|
||||
// },
|
||||
// GetComputeInstanceByIdFunc: func(ID int) (ComputeInstance, Return) {
|
||||
// panic("mock out the GetComputeInstanceById method")
|
||||
// },
|
||||
// GetComputeInstanceProfileInfoFunc: func(Profile int, EngProfile int) (ComputeInstanceProfileInfo, Return) {
|
||||
// panic("mock out the GetComputeInstanceProfileInfo method")
|
||||
// },
|
||||
// GetComputeInstancesFunc: func(Info *ComputeInstanceProfileInfo) ([]ComputeInstance, Return) {
|
||||
// panic("mock out the GetComputeInstances method")
|
||||
// },
|
||||
// GetInfoFunc: func() (GpuInstanceInfo, Return) {
|
||||
// panic("mock out the GetInfo method")
|
||||
// },
|
||||
// }
|
||||
// // make and configure a mocked GpuInstance
|
||||
// mockedGpuInstance := &GpuInstanceMock{
|
||||
// CreateComputeInstanceFunc: func(Info *ComputeInstanceProfileInfo) (ComputeInstance, Return) {
|
||||
// panic("mock out the CreateComputeInstance method")
|
||||
// },
|
||||
// DestroyFunc: func() Return {
|
||||
// panic("mock out the Destroy method")
|
||||
// },
|
||||
// GetComputeInstanceByIdFunc: func(ID int) (ComputeInstance, Return) {
|
||||
// panic("mock out the GetComputeInstanceById method")
|
||||
// },
|
||||
// GetComputeInstanceProfileInfoFunc: func(Profile int, EngProfile int) (ComputeInstanceProfileInfo, Return) {
|
||||
// panic("mock out the GetComputeInstanceProfileInfo method")
|
||||
// },
|
||||
// GetComputeInstancesFunc: func(Info *ComputeInstanceProfileInfo) ([]ComputeInstance, Return) {
|
||||
// panic("mock out the GetComputeInstances method")
|
||||
// },
|
||||
// GetInfoFunc: func() (GpuInstanceInfo, Return) {
|
||||
// panic("mock out the GetInfo method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedGpuInstance in code that requires GpuInstance
|
||||
// // and then make assertions.
|
||||
// // use mockedGpuInstance in code that requires GpuInstance
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
// }
|
||||
type GpuInstanceMock struct {
|
||||
// CreateComputeInstanceFunc mocks the CreateComputeInstance method.
|
||||
CreateComputeInstanceFunc func(Info *ComputeInstanceProfileInfo) (ComputeInstance, Return)
|
||||
@ -117,7 +117,8 @@ func (mock *GpuInstanceMock) CreateComputeInstance(Info *ComputeInstanceProfileI
|
||||
|
||||
// CreateComputeInstanceCalls gets all the calls that were made to CreateComputeInstance.
|
||||
// Check the length with:
|
||||
// len(mockedGpuInstance.CreateComputeInstanceCalls())
|
||||
//
|
||||
// len(mockedGpuInstance.CreateComputeInstanceCalls())
|
||||
func (mock *GpuInstanceMock) CreateComputeInstanceCalls() []struct {
|
||||
Info *ComputeInstanceProfileInfo
|
||||
} {
|
||||
@ -145,7 +146,8 @@ func (mock *GpuInstanceMock) Destroy() Return {
|
||||
|
||||
// DestroyCalls gets all the calls that were made to Destroy.
|
||||
// Check the length with:
|
||||
// len(mockedGpuInstance.DestroyCalls())
|
||||
//
|
||||
// len(mockedGpuInstance.DestroyCalls())
|
||||
func (mock *GpuInstanceMock) DestroyCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -174,7 +176,8 @@ func (mock *GpuInstanceMock) GetComputeInstanceById(ID int) (ComputeInstance, Re
|
||||
|
||||
// GetComputeInstanceByIdCalls gets all the calls that were made to GetComputeInstanceById.
|
||||
// Check the length with:
|
||||
// len(mockedGpuInstance.GetComputeInstanceByIdCalls())
|
||||
//
|
||||
// len(mockedGpuInstance.GetComputeInstanceByIdCalls())
|
||||
func (mock *GpuInstanceMock) GetComputeInstanceByIdCalls() []struct {
|
||||
ID int
|
||||
} {
|
||||
@ -207,7 +210,8 @@ func (mock *GpuInstanceMock) GetComputeInstanceProfileInfo(Profile int, EngProfi
|
||||
|
||||
// GetComputeInstanceProfileInfoCalls gets all the calls that were made to GetComputeInstanceProfileInfo.
|
||||
// Check the length with:
|
||||
// len(mockedGpuInstance.GetComputeInstanceProfileInfoCalls())
|
||||
//
|
||||
// len(mockedGpuInstance.GetComputeInstanceProfileInfoCalls())
|
||||
func (mock *GpuInstanceMock) GetComputeInstanceProfileInfoCalls() []struct {
|
||||
Profile int
|
||||
EngProfile int
|
||||
@ -240,7 +244,8 @@ func (mock *GpuInstanceMock) GetComputeInstances(Info *ComputeInstanceProfileInf
|
||||
|
||||
// GetComputeInstancesCalls gets all the calls that were made to GetComputeInstances.
|
||||
// Check the length with:
|
||||
// len(mockedGpuInstance.GetComputeInstancesCalls())
|
||||
//
|
||||
// len(mockedGpuInstance.GetComputeInstancesCalls())
|
||||
func (mock *GpuInstanceMock) GetComputeInstancesCalls() []struct {
|
||||
Info *ComputeInstanceProfileInfo
|
||||
} {
|
||||
@ -268,7 +273,8 @@ func (mock *GpuInstanceMock) GetInfo() (GpuInstanceInfo, Return) {
|
||||
|
||||
// GetInfoCalls gets all the calls that were made to GetInfo.
|
||||
// Check the length with:
|
||||
// len(mockedGpuInstance.GetInfoCalls())
|
||||
//
|
||||
// len(mockedGpuInstance.GetInfoCalls())
|
||||
func (mock *GpuInstanceMock) GetInfoCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
|
@ -13,43 +13,43 @@ var _ Interface = &InterfaceMock{}
|
||||
|
||||
// InterfaceMock is a mock implementation of Interface.
|
||||
//
|
||||
// func TestSomethingThatUsesInterface(t *testing.T) {
|
||||
// func TestSomethingThatUsesInterface(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked Interface
|
||||
// mockedInterface := &InterfaceMock{
|
||||
// DeviceGetCountFunc: func() (int, Return) {
|
||||
// panic("mock out the DeviceGetCount method")
|
||||
// },
|
||||
// DeviceGetHandleByIndexFunc: func(Index int) (Device, Return) {
|
||||
// panic("mock out the DeviceGetHandleByIndex method")
|
||||
// },
|
||||
// DeviceGetHandleByUUIDFunc: func(UUID string) (Device, Return) {
|
||||
// panic("mock out the DeviceGetHandleByUUID method")
|
||||
// },
|
||||
// ErrorStringFunc: func(r Return) string {
|
||||
// panic("mock out the ErrorString method")
|
||||
// },
|
||||
// EventSetCreateFunc: func() (EventSet, Return) {
|
||||
// panic("mock out the EventSetCreate method")
|
||||
// },
|
||||
// InitFunc: func() Return {
|
||||
// panic("mock out the Init method")
|
||||
// },
|
||||
// ShutdownFunc: func() Return {
|
||||
// panic("mock out the Shutdown method")
|
||||
// },
|
||||
// SystemGetCudaDriverVersionFunc: func() (int, Return) {
|
||||
// panic("mock out the SystemGetCudaDriverVersion method")
|
||||
// },
|
||||
// SystemGetDriverVersionFunc: func() (string, Return) {
|
||||
// panic("mock out the SystemGetDriverVersion method")
|
||||
// },
|
||||
// }
|
||||
// // make and configure a mocked Interface
|
||||
// mockedInterface := &InterfaceMock{
|
||||
// DeviceGetCountFunc: func() (int, Return) {
|
||||
// panic("mock out the DeviceGetCount method")
|
||||
// },
|
||||
// DeviceGetHandleByIndexFunc: func(Index int) (Device, Return) {
|
||||
// panic("mock out the DeviceGetHandleByIndex method")
|
||||
// },
|
||||
// DeviceGetHandleByUUIDFunc: func(UUID string) (Device, Return) {
|
||||
// panic("mock out the DeviceGetHandleByUUID method")
|
||||
// },
|
||||
// ErrorStringFunc: func(r Return) string {
|
||||
// panic("mock out the ErrorString method")
|
||||
// },
|
||||
// EventSetCreateFunc: func() (EventSet, Return) {
|
||||
// panic("mock out the EventSetCreate method")
|
||||
// },
|
||||
// InitFunc: func() Return {
|
||||
// panic("mock out the Init method")
|
||||
// },
|
||||
// ShutdownFunc: func() Return {
|
||||
// panic("mock out the Shutdown method")
|
||||
// },
|
||||
// SystemGetCudaDriverVersionFunc: func() (int, Return) {
|
||||
// panic("mock out the SystemGetCudaDriverVersion method")
|
||||
// },
|
||||
// SystemGetDriverVersionFunc: func() (string, Return) {
|
||||
// panic("mock out the SystemGetDriverVersion method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedInterface in code that requires Interface
|
||||
// // and then make assertions.
|
||||
// // use mockedInterface in code that requires Interface
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
// }
|
||||
type InterfaceMock struct {
|
||||
// DeviceGetCountFunc mocks the DeviceGetCount method.
|
||||
DeviceGetCountFunc func() (int, Return)
|
||||
@ -140,7 +140,8 @@ func (mock *InterfaceMock) DeviceGetCount() (int, Return) {
|
||||
|
||||
// DeviceGetCountCalls gets all the calls that were made to DeviceGetCount.
|
||||
// Check the length with:
|
||||
// len(mockedInterface.DeviceGetCountCalls())
|
||||
//
|
||||
// len(mockedInterface.DeviceGetCountCalls())
|
||||
func (mock *InterfaceMock) DeviceGetCountCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -169,7 +170,8 @@ func (mock *InterfaceMock) DeviceGetHandleByIndex(Index int) (Device, Return) {
|
||||
|
||||
// DeviceGetHandleByIndexCalls gets all the calls that were made to DeviceGetHandleByIndex.
|
||||
// Check the length with:
|
||||
// len(mockedInterface.DeviceGetHandleByIndexCalls())
|
||||
//
|
||||
// len(mockedInterface.DeviceGetHandleByIndexCalls())
|
||||
func (mock *InterfaceMock) DeviceGetHandleByIndexCalls() []struct {
|
||||
Index int
|
||||
} {
|
||||
@ -200,7 +202,8 @@ func (mock *InterfaceMock) DeviceGetHandleByUUID(UUID string) (Device, Return) {
|
||||
|
||||
// DeviceGetHandleByUUIDCalls gets all the calls that were made to DeviceGetHandleByUUID.
|
||||
// Check the length with:
|
||||
// len(mockedInterface.DeviceGetHandleByUUIDCalls())
|
||||
//
|
||||
// len(mockedInterface.DeviceGetHandleByUUIDCalls())
|
||||
func (mock *InterfaceMock) DeviceGetHandleByUUIDCalls() []struct {
|
||||
UUID string
|
||||
} {
|
||||
@ -231,7 +234,8 @@ func (mock *InterfaceMock) ErrorString(r Return) string {
|
||||
|
||||
// ErrorStringCalls gets all the calls that were made to ErrorString.
|
||||
// Check the length with:
|
||||
// len(mockedInterface.ErrorStringCalls())
|
||||
//
|
||||
// len(mockedInterface.ErrorStringCalls())
|
||||
func (mock *InterfaceMock) ErrorStringCalls() []struct {
|
||||
R Return
|
||||
} {
|
||||
@ -259,7 +263,8 @@ func (mock *InterfaceMock) EventSetCreate() (EventSet, Return) {
|
||||
|
||||
// EventSetCreateCalls gets all the calls that were made to EventSetCreate.
|
||||
// Check the length with:
|
||||
// len(mockedInterface.EventSetCreateCalls())
|
||||
//
|
||||
// len(mockedInterface.EventSetCreateCalls())
|
||||
func (mock *InterfaceMock) EventSetCreateCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -285,7 +290,8 @@ func (mock *InterfaceMock) Init() Return {
|
||||
|
||||
// InitCalls gets all the calls that were made to Init.
|
||||
// Check the length with:
|
||||
// len(mockedInterface.InitCalls())
|
||||
//
|
||||
// len(mockedInterface.InitCalls())
|
||||
func (mock *InterfaceMock) InitCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -311,7 +317,8 @@ func (mock *InterfaceMock) Shutdown() Return {
|
||||
|
||||
// ShutdownCalls gets all the calls that were made to Shutdown.
|
||||
// Check the length with:
|
||||
// len(mockedInterface.ShutdownCalls())
|
||||
//
|
||||
// len(mockedInterface.ShutdownCalls())
|
||||
func (mock *InterfaceMock) ShutdownCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -337,7 +344,8 @@ func (mock *InterfaceMock) SystemGetCudaDriverVersion() (int, Return) {
|
||||
|
||||
// SystemGetCudaDriverVersionCalls gets all the calls that were made to SystemGetCudaDriverVersion.
|
||||
// Check the length with:
|
||||
// len(mockedInterface.SystemGetCudaDriverVersionCalls())
|
||||
//
|
||||
// len(mockedInterface.SystemGetCudaDriverVersionCalls())
|
||||
func (mock *InterfaceMock) SystemGetCudaDriverVersionCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -363,7 +371,8 @@ func (mock *InterfaceMock) SystemGetDriverVersion() (string, Return) {
|
||||
|
||||
// SystemGetDriverVersionCalls gets all the calls that were made to SystemGetDriverVersion.
|
||||
// Check the length with:
|
||||
// len(mockedInterface.SystemGetDriverVersionCalls())
|
||||
//
|
||||
// len(mockedInterface.SystemGetDriverVersionCalls())
|
||||
func (mock *InterfaceMock) SystemGetDriverVersionCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
|
@ -39,12 +39,14 @@ type Interface interface {
|
||||
//
|
||||
//go:generate moq -out device_mock.go . Device
|
||||
type Device interface {
|
||||
CreateGpuInstanceWithPlacement(*GpuInstanceProfileInfo, *GpuInstancePlacement) (GpuInstance, Return)
|
||||
GetAttributes() (DeviceAttributes, Return)
|
||||
GetComputeInstanceId() (int, Return)
|
||||
GetCudaComputeCapability() (int, int, Return)
|
||||
GetDeviceHandleFromMigDeviceHandle() (Device, Return)
|
||||
GetGpuInstanceById(ID int) (GpuInstance, Return)
|
||||
GetGpuInstanceId() (int, Return)
|
||||
GetGpuInstancePossiblePlacements(*GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return)
|
||||
GetGpuInstanceProfileInfo(Profile int) (GpuInstanceProfileInfo, Return)
|
||||
GetGpuInstances(Info *GpuInstanceProfileInfo) ([]GpuInstance, Return)
|
||||
GetIndex() (int, Return)
|
||||
|
Loading…
Reference in New Issue
Block a user