mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-28 23:17:24 +00:00
Use nvml/mock package
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
082ce066ed
commit
d5f6e6f868
@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
"github.com/NVIDIA/go-nvlib/pkg/nvlib/device"
|
"github.com/NVIDIA/go-nvlib/pkg/nvlib/device"
|
||||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||||
|
"github.com/NVIDIA/go-nvml/pkg/nvml/mock"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -32,7 +33,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
description: "init failure returns false",
|
description: "init failure returns false",
|
||||||
nvmllib: &nvml.InterfaceMock{
|
nvmllib: &mock.Interface{
|
||||||
InitFunc: func() nvml.Return {
|
InitFunc: func() nvml.Return {
|
||||||
return nvml.ERROR_LIBRARY_NOT_FOUND
|
return nvml.ERROR_LIBRARY_NOT_FOUND
|
||||||
},
|
},
|
||||||
@ -41,7 +42,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "no devices returns false",
|
description: "no devices returns false",
|
||||||
nvmllib: &nvml.InterfaceMock{
|
nvmllib: &mock.Interface{
|
||||||
InitFunc: func() nvml.Return {
|
InitFunc: func() nvml.Return {
|
||||||
return nvml.SUCCESS
|
return nvml.SUCCESS
|
||||||
},
|
},
|
||||||
@ -56,7 +57,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "DeviceGetCount error returns false",
|
description: "DeviceGetCount error returns false",
|
||||||
nvmllib: &nvml.InterfaceMock{
|
nvmllib: &mock.Interface{
|
||||||
InitFunc: func() nvml.Return {
|
InitFunc: func() nvml.Return {
|
||||||
return nvml.SUCCESS
|
return nvml.SUCCESS
|
||||||
},
|
},
|
||||||
@ -71,7 +72,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "Failure to get device name returns false",
|
description: "Failure to get device name returns false",
|
||||||
nvmllib: &nvml.InterfaceMock{
|
nvmllib: &mock.Interface{
|
||||||
InitFunc: func() nvml.Return {
|
InitFunc: func() nvml.Return {
|
||||||
return nvml.SUCCESS
|
return nvml.SUCCESS
|
||||||
},
|
},
|
||||||
@ -82,7 +83,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
return 1, nvml.SUCCESS
|
return 1, nvml.SUCCESS
|
||||||
},
|
},
|
||||||
DeviceGetHandleByIndexFunc: func(index int) (nvml.Device, nvml.Return) {
|
DeviceGetHandleByIndexFunc: func(index int) (nvml.Device, nvml.Return) {
|
||||||
device := &nvml.DeviceMock{
|
device := &mock.Device{
|
||||||
GetNameFunc: func() (string, nvml.Return) {
|
GetNameFunc: func() (string, nvml.Return) {
|
||||||
return "", nvml.ERROR_UNKNOWN
|
return "", nvml.ERROR_UNKNOWN
|
||||||
},
|
},
|
||||||
@ -94,7 +95,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "nested panic returns false",
|
description: "nested panic returns false",
|
||||||
nvmllib: &nvml.InterfaceMock{
|
nvmllib: &mock.Interface{
|
||||||
InitFunc: func() nvml.Return {
|
InitFunc: func() nvml.Return {
|
||||||
return nvml.SUCCESS
|
return nvml.SUCCESS
|
||||||
},
|
},
|
||||||
@ -105,7 +106,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
return 1, nvml.SUCCESS
|
return 1, nvml.SUCCESS
|
||||||
},
|
},
|
||||||
DeviceGetHandleByIndexFunc: func(index int) (nvml.Device, nvml.Return) {
|
DeviceGetHandleByIndexFunc: func(index int) (nvml.Device, nvml.Return) {
|
||||||
device := &nvml.DeviceMock{
|
device := &mock.Device{
|
||||||
GetNameFunc: func() (string, nvml.Return) {
|
GetNameFunc: func() (string, nvml.Return) {
|
||||||
panic("deep panic")
|
panic("deep panic")
|
||||||
},
|
},
|
||||||
@ -117,7 +118,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "Single device name with no nvgpu",
|
description: "Single device name with no nvgpu",
|
||||||
nvmllib: &nvml.InterfaceMock{
|
nvmllib: &mock.Interface{
|
||||||
InitFunc: func() nvml.Return {
|
InitFunc: func() nvml.Return {
|
||||||
return nvml.SUCCESS
|
return nvml.SUCCESS
|
||||||
},
|
},
|
||||||
@ -128,7 +129,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
return 1, nvml.SUCCESS
|
return 1, nvml.SUCCESS
|
||||||
},
|
},
|
||||||
DeviceGetHandleByIndexFunc: func(index int) (nvml.Device, nvml.Return) {
|
DeviceGetHandleByIndexFunc: func(index int) (nvml.Device, nvml.Return) {
|
||||||
device := &nvml.DeviceMock{
|
device := &mock.Device{
|
||||||
GetNameFunc: func() (string, nvml.Return) {
|
GetNameFunc: func() (string, nvml.Return) {
|
||||||
return "NVIDIA A100-SXM4-40GB", nvml.SUCCESS
|
return "NVIDIA A100-SXM4-40GB", nvml.SUCCESS
|
||||||
},
|
},
|
||||||
@ -140,7 +141,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "Single device name with nvgpu",
|
description: "Single device name with nvgpu",
|
||||||
nvmllib: &nvml.InterfaceMock{
|
nvmllib: &mock.Interface{
|
||||||
InitFunc: func() nvml.Return {
|
InitFunc: func() nvml.Return {
|
||||||
return nvml.SUCCESS
|
return nvml.SUCCESS
|
||||||
},
|
},
|
||||||
@ -151,7 +152,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
return 1, nvml.SUCCESS
|
return 1, nvml.SUCCESS
|
||||||
},
|
},
|
||||||
DeviceGetHandleByIndexFunc: func(index int) (nvml.Device, nvml.Return) {
|
DeviceGetHandleByIndexFunc: func(index int) (nvml.Device, nvml.Return) {
|
||||||
device := &nvml.DeviceMock{
|
device := &mock.Device{
|
||||||
GetNameFunc: func() (string, nvml.Return) {
|
GetNameFunc: func() (string, nvml.Return) {
|
||||||
return "Orin (nvgpu)", nvml.SUCCESS
|
return "Orin (nvgpu)", nvml.SUCCESS
|
||||||
},
|
},
|
||||||
@ -163,7 +164,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "Multiple device names with no nvgpu",
|
description: "Multiple device names with no nvgpu",
|
||||||
nvmllib: &nvml.InterfaceMock{
|
nvmllib: &mock.Interface{
|
||||||
InitFunc: func() nvml.Return {
|
InitFunc: func() nvml.Return {
|
||||||
return nvml.SUCCESS
|
return nvml.SUCCESS
|
||||||
},
|
},
|
||||||
@ -174,7 +175,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
return 2, nvml.SUCCESS
|
return 2, nvml.SUCCESS
|
||||||
},
|
},
|
||||||
DeviceGetHandleByIndexFunc: func(index int) (nvml.Device, nvml.Return) {
|
DeviceGetHandleByIndexFunc: func(index int) (nvml.Device, nvml.Return) {
|
||||||
device := &nvml.DeviceMock{
|
device := &mock.Device{
|
||||||
GetNameFunc: func() (string, nvml.Return) {
|
GetNameFunc: func() (string, nvml.Return) {
|
||||||
return "NVIDIA A100-SXM4-40GB", nvml.SUCCESS
|
return "NVIDIA A100-SXM4-40GB", nvml.SUCCESS
|
||||||
},
|
},
|
||||||
@ -186,7 +187,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "Multiple device names with nvgpu",
|
description: "Multiple device names with nvgpu",
|
||||||
nvmllib: &nvml.InterfaceMock{
|
nvmllib: &mock.Interface{
|
||||||
InitFunc: func() nvml.Return {
|
InitFunc: func() nvml.Return {
|
||||||
return nvml.SUCCESS
|
return nvml.SUCCESS
|
||||||
},
|
},
|
||||||
@ -197,7 +198,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
return 2, nvml.SUCCESS
|
return 2, nvml.SUCCESS
|
||||||
},
|
},
|
||||||
DeviceGetHandleByIndexFunc: func(index int) (nvml.Device, nvml.Return) {
|
DeviceGetHandleByIndexFunc: func(index int) (nvml.Device, nvml.Return) {
|
||||||
device := &nvml.DeviceMock{
|
device := &mock.Device{
|
||||||
GetNameFunc: func() (string, nvml.Return) {
|
GetNameFunc: func() (string, nvml.Return) {
|
||||||
return "Orin (nvgpu)", nvml.SUCCESS
|
return "Orin (nvgpu)", nvml.SUCCESS
|
||||||
},
|
},
|
||||||
@ -209,7 +210,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "Mixed device names",
|
description: "Mixed device names",
|
||||||
nvmllib: &nvml.InterfaceMock{
|
nvmllib: &mock.Interface{
|
||||||
InitFunc: func() nvml.Return {
|
InitFunc: func() nvml.Return {
|
||||||
return nvml.SUCCESS
|
return nvml.SUCCESS
|
||||||
},
|
},
|
||||||
@ -226,7 +227,7 @@ func TestUsesNVGPUModule(t *testing.T) {
|
|||||||
} else {
|
} else {
|
||||||
deviceName = "Orin (nvgpu)"
|
deviceName = "Orin (nvgpu)"
|
||||||
}
|
}
|
||||||
device := &nvml.DeviceMock{
|
device := &mock.Device{
|
||||||
GetNameFunc: func() (string, nvml.Return) {
|
GetNameFunc: func() (string, nvml.Return) {
|
||||||
return deviceName, nvml.SUCCESS
|
return deviceName, nvml.SUCCESS
|
||||||
},
|
},
|
||||||
|
105
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/computeinstance.go
generated
vendored
Normal file
105
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/computeinstance.go
generated
vendored
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
// Code generated by moq; DO NOT EDIT.
|
||||||
|
// github.com/matryer/moq
|
||||||
|
|
||||||
|
package mock
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Ensure, that ComputeInstance does implement nvml.ComputeInstance.
|
||||||
|
// If this is not the case, regenerate this file with moq.
|
||||||
|
var _ nvml.ComputeInstance = &ComputeInstance{}
|
||||||
|
|
||||||
|
// ComputeInstance is a mock implementation of nvml.ComputeInstance.
|
||||||
|
//
|
||||||
|
// func TestSomethingThatUsesComputeInstance(t *testing.T) {
|
||||||
|
//
|
||||||
|
// // make and configure a mocked nvml.ComputeInstance
|
||||||
|
// mockedComputeInstance := &ComputeInstance{
|
||||||
|
// DestroyFunc: func() nvml.Return {
|
||||||
|
// panic("mock out the Destroy method")
|
||||||
|
// },
|
||||||
|
// GetInfoFunc: func() (nvml.ComputeInstanceInfo, nvml.Return) {
|
||||||
|
// panic("mock out the GetInfo method")
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // use mockedComputeInstance in code that requires nvml.ComputeInstance
|
||||||
|
// // and then make assertions.
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
type ComputeInstance struct {
|
||||||
|
// DestroyFunc mocks the Destroy method.
|
||||||
|
DestroyFunc func() nvml.Return
|
||||||
|
|
||||||
|
// GetInfoFunc mocks the GetInfo method.
|
||||||
|
GetInfoFunc func() (nvml.ComputeInstanceInfo, nvml.Return)
|
||||||
|
|
||||||
|
// calls tracks calls to the methods.
|
||||||
|
calls struct {
|
||||||
|
// Destroy holds details about calls to the Destroy method.
|
||||||
|
Destroy []struct {
|
||||||
|
}
|
||||||
|
// GetInfo holds details about calls to the GetInfo method.
|
||||||
|
GetInfo []struct {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lockDestroy sync.RWMutex
|
||||||
|
lockGetInfo sync.RWMutex
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destroy calls DestroyFunc.
|
||||||
|
func (mock *ComputeInstance) Destroy() nvml.Return {
|
||||||
|
if mock.DestroyFunc == nil {
|
||||||
|
panic("ComputeInstance.DestroyFunc: method is nil but ComputeInstance.Destroy was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockDestroy.Lock()
|
||||||
|
mock.calls.Destroy = append(mock.calls.Destroy, callInfo)
|
||||||
|
mock.lockDestroy.Unlock()
|
||||||
|
return mock.DestroyFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// DestroyCalls gets all the calls that were made to Destroy.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedComputeInstance.DestroyCalls())
|
||||||
|
func (mock *ComputeInstance) DestroyCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockDestroy.RLock()
|
||||||
|
calls = mock.calls.Destroy
|
||||||
|
mock.lockDestroy.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetInfo calls GetInfoFunc.
|
||||||
|
func (mock *ComputeInstance) GetInfo() (nvml.ComputeInstanceInfo, nvml.Return) {
|
||||||
|
if mock.GetInfoFunc == nil {
|
||||||
|
panic("ComputeInstance.GetInfoFunc: method is nil but ComputeInstance.GetInfo was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetInfo.Lock()
|
||||||
|
mock.calls.GetInfo = append(mock.calls.GetInfo, callInfo)
|
||||||
|
mock.lockGetInfo.Unlock()
|
||||||
|
return mock.GetInfoFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetInfoCalls gets all the calls that were made to GetInfo.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedComputeInstance.GetInfoCalls())
|
||||||
|
func (mock *ComputeInstance) GetInfoCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetInfo.RLock()
|
||||||
|
calls = mock.calls.GetInfo
|
||||||
|
mock.lockGetInfo.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
8283
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/device.go
generated
vendored
Normal file
8283
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/device.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
112
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/eventset.go
generated
vendored
Normal file
112
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/eventset.go
generated
vendored
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
// Code generated by moq; DO NOT EDIT.
|
||||||
|
// github.com/matryer/moq
|
||||||
|
|
||||||
|
package mock
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Ensure, that EventSet does implement nvml.EventSet.
|
||||||
|
// If this is not the case, regenerate this file with moq.
|
||||||
|
var _ nvml.EventSet = &EventSet{}
|
||||||
|
|
||||||
|
// EventSet is a mock implementation of nvml.EventSet.
|
||||||
|
//
|
||||||
|
// func TestSomethingThatUsesEventSet(t *testing.T) {
|
||||||
|
//
|
||||||
|
// // make and configure a mocked nvml.EventSet
|
||||||
|
// mockedEventSet := &EventSet{
|
||||||
|
// FreeFunc: func() nvml.Return {
|
||||||
|
// panic("mock out the Free method")
|
||||||
|
// },
|
||||||
|
// WaitFunc: func(v uint32) (nvml.EventData, nvml.Return) {
|
||||||
|
// panic("mock out the Wait method")
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // use mockedEventSet in code that requires nvml.EventSet
|
||||||
|
// // and then make assertions.
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
type EventSet struct {
|
||||||
|
// FreeFunc mocks the Free method.
|
||||||
|
FreeFunc func() nvml.Return
|
||||||
|
|
||||||
|
// WaitFunc mocks the Wait method.
|
||||||
|
WaitFunc func(v uint32) (nvml.EventData, nvml.Return)
|
||||||
|
|
||||||
|
// calls tracks calls to the methods.
|
||||||
|
calls struct {
|
||||||
|
// Free holds details about calls to the Free method.
|
||||||
|
Free []struct {
|
||||||
|
}
|
||||||
|
// Wait holds details about calls to the Wait method.
|
||||||
|
Wait []struct {
|
||||||
|
// V is the v argument value.
|
||||||
|
V uint32
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lockFree sync.RWMutex
|
||||||
|
lockWait sync.RWMutex
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free calls FreeFunc.
|
||||||
|
func (mock *EventSet) Free() nvml.Return {
|
||||||
|
if mock.FreeFunc == nil {
|
||||||
|
panic("EventSet.FreeFunc: method is nil but EventSet.Free was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockFree.Lock()
|
||||||
|
mock.calls.Free = append(mock.calls.Free, callInfo)
|
||||||
|
mock.lockFree.Unlock()
|
||||||
|
return mock.FreeFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FreeCalls gets all the calls that were made to Free.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedEventSet.FreeCalls())
|
||||||
|
func (mock *EventSet) FreeCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockFree.RLock()
|
||||||
|
calls = mock.calls.Free
|
||||||
|
mock.lockFree.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait calls WaitFunc.
|
||||||
|
func (mock *EventSet) Wait(v uint32) (nvml.EventData, nvml.Return) {
|
||||||
|
if mock.WaitFunc == nil {
|
||||||
|
panic("EventSet.WaitFunc: method is nil but EventSet.Wait was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
V uint32
|
||||||
|
}{
|
||||||
|
V: v,
|
||||||
|
}
|
||||||
|
mock.lockWait.Lock()
|
||||||
|
mock.calls.Wait = append(mock.calls.Wait, callInfo)
|
||||||
|
mock.lockWait.Unlock()
|
||||||
|
return mock.WaitFunc(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// WaitCalls gets all the calls that were made to Wait.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedEventSet.WaitCalls())
|
||||||
|
func (mock *EventSet) WaitCalls() []struct {
|
||||||
|
V uint32
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
V uint32
|
||||||
|
}
|
||||||
|
mock.lockWait.RLock()
|
||||||
|
calls = mock.calls.Wait
|
||||||
|
mock.lockWait.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
75
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/extendedinterface.go
generated
vendored
Normal file
75
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/extendedinterface.go
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
// Code generated by moq; DO NOT EDIT.
|
||||||
|
// github.com/matryer/moq
|
||||||
|
|
||||||
|
package mock
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Ensure, that ExtendedInterface does implement nvml.ExtendedInterface.
|
||||||
|
// If this is not the case, regenerate this file with moq.
|
||||||
|
var _ nvml.ExtendedInterface = &ExtendedInterface{}
|
||||||
|
|
||||||
|
// ExtendedInterface is a mock implementation of nvml.ExtendedInterface.
|
||||||
|
//
|
||||||
|
// func TestSomethingThatUsesExtendedInterface(t *testing.T) {
|
||||||
|
//
|
||||||
|
// // make and configure a mocked nvml.ExtendedInterface
|
||||||
|
// mockedExtendedInterface := &ExtendedInterface{
|
||||||
|
// LookupSymbolFunc: func(s string) error {
|
||||||
|
// panic("mock out the LookupSymbol method")
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // use mockedExtendedInterface in code that requires nvml.ExtendedInterface
|
||||||
|
// // and then make assertions.
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
type ExtendedInterface struct {
|
||||||
|
// LookupSymbolFunc mocks the LookupSymbol method.
|
||||||
|
LookupSymbolFunc func(s string) error
|
||||||
|
|
||||||
|
// calls tracks calls to the methods.
|
||||||
|
calls struct {
|
||||||
|
// LookupSymbol holds details about calls to the LookupSymbol method.
|
||||||
|
LookupSymbol []struct {
|
||||||
|
// S is the s argument value.
|
||||||
|
S string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lockLookupSymbol sync.RWMutex
|
||||||
|
}
|
||||||
|
|
||||||
|
// LookupSymbol calls LookupSymbolFunc.
|
||||||
|
func (mock *ExtendedInterface) LookupSymbol(s string) error {
|
||||||
|
if mock.LookupSymbolFunc == nil {
|
||||||
|
panic("ExtendedInterface.LookupSymbolFunc: method is nil but ExtendedInterface.LookupSymbol was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
S string
|
||||||
|
}{
|
||||||
|
S: s,
|
||||||
|
}
|
||||||
|
mock.lockLookupSymbol.Lock()
|
||||||
|
mock.calls.LookupSymbol = append(mock.calls.LookupSymbol, callInfo)
|
||||||
|
mock.lockLookupSymbol.Unlock()
|
||||||
|
return mock.LookupSymbolFunc(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
// LookupSymbolCalls gets all the calls that were made to LookupSymbol.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedExtendedInterface.LookupSymbolCalls())
|
||||||
|
func (mock *ExtendedInterface) LookupSymbolCalls() []struct {
|
||||||
|
S string
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
S string
|
||||||
|
}
|
||||||
|
mock.lockLookupSymbol.RLock()
|
||||||
|
calls = mock.calls.LookupSymbol
|
||||||
|
mock.lockLookupSymbol.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
162
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/gpmsample.go
generated
vendored
Normal file
162
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/gpmsample.go
generated
vendored
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
// Code generated by moq; DO NOT EDIT.
|
||||||
|
// github.com/matryer/moq
|
||||||
|
|
||||||
|
package mock
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Ensure, that GpmSample does implement nvml.GpmSample.
|
||||||
|
// If this is not the case, regenerate this file with moq.
|
||||||
|
var _ nvml.GpmSample = &GpmSample{}
|
||||||
|
|
||||||
|
// GpmSample is a mock implementation of nvml.GpmSample.
|
||||||
|
//
|
||||||
|
// func TestSomethingThatUsesGpmSample(t *testing.T) {
|
||||||
|
//
|
||||||
|
// // make and configure a mocked nvml.GpmSample
|
||||||
|
// mockedGpmSample := &GpmSample{
|
||||||
|
// FreeFunc: func() nvml.Return {
|
||||||
|
// panic("mock out the Free method")
|
||||||
|
// },
|
||||||
|
// GetFunc: func(device nvml.Device) nvml.Return {
|
||||||
|
// panic("mock out the Get method")
|
||||||
|
// },
|
||||||
|
// MigGetFunc: func(device nvml.Device, n int) nvml.Return {
|
||||||
|
// panic("mock out the MigGet method")
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // use mockedGpmSample in code that requires nvml.GpmSample
|
||||||
|
// // and then make assertions.
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
type GpmSample struct {
|
||||||
|
// FreeFunc mocks the Free method.
|
||||||
|
FreeFunc func() nvml.Return
|
||||||
|
|
||||||
|
// GetFunc mocks the Get method.
|
||||||
|
GetFunc func(device nvml.Device) nvml.Return
|
||||||
|
|
||||||
|
// MigGetFunc mocks the MigGet method.
|
||||||
|
MigGetFunc func(device nvml.Device, n int) nvml.Return
|
||||||
|
|
||||||
|
// calls tracks calls to the methods.
|
||||||
|
calls struct {
|
||||||
|
// Free holds details about calls to the Free method.
|
||||||
|
Free []struct {
|
||||||
|
}
|
||||||
|
// Get holds details about calls to the Get method.
|
||||||
|
Get []struct {
|
||||||
|
// Device is the device argument value.
|
||||||
|
Device nvml.Device
|
||||||
|
}
|
||||||
|
// MigGet holds details about calls to the MigGet method.
|
||||||
|
MigGet []struct {
|
||||||
|
// Device is the device argument value.
|
||||||
|
Device nvml.Device
|
||||||
|
// N is the n argument value.
|
||||||
|
N int
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lockFree sync.RWMutex
|
||||||
|
lockGet sync.RWMutex
|
||||||
|
lockMigGet sync.RWMutex
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free calls FreeFunc.
|
||||||
|
func (mock *GpmSample) Free() nvml.Return {
|
||||||
|
if mock.FreeFunc == nil {
|
||||||
|
panic("GpmSample.FreeFunc: method is nil but GpmSample.Free was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockFree.Lock()
|
||||||
|
mock.calls.Free = append(mock.calls.Free, callInfo)
|
||||||
|
mock.lockFree.Unlock()
|
||||||
|
return mock.FreeFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FreeCalls gets all the calls that were made to Free.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedGpmSample.FreeCalls())
|
||||||
|
func (mock *GpmSample) FreeCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockFree.RLock()
|
||||||
|
calls = mock.calls.Free
|
||||||
|
mock.lockFree.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get calls GetFunc.
|
||||||
|
func (mock *GpmSample) Get(device nvml.Device) nvml.Return {
|
||||||
|
if mock.GetFunc == nil {
|
||||||
|
panic("GpmSample.GetFunc: method is nil but GpmSample.Get was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
Device nvml.Device
|
||||||
|
}{
|
||||||
|
Device: device,
|
||||||
|
}
|
||||||
|
mock.lockGet.Lock()
|
||||||
|
mock.calls.Get = append(mock.calls.Get, callInfo)
|
||||||
|
mock.lockGet.Unlock()
|
||||||
|
return mock.GetFunc(device)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCalls gets all the calls that were made to Get.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedGpmSample.GetCalls())
|
||||||
|
func (mock *GpmSample) GetCalls() []struct {
|
||||||
|
Device nvml.Device
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
Device nvml.Device
|
||||||
|
}
|
||||||
|
mock.lockGet.RLock()
|
||||||
|
calls = mock.calls.Get
|
||||||
|
mock.lockGet.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// MigGet calls MigGetFunc.
|
||||||
|
func (mock *GpmSample) MigGet(device nvml.Device, n int) nvml.Return {
|
||||||
|
if mock.MigGetFunc == nil {
|
||||||
|
panic("GpmSample.MigGetFunc: method is nil but GpmSample.MigGet was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
Device nvml.Device
|
||||||
|
N int
|
||||||
|
}{
|
||||||
|
Device: device,
|
||||||
|
N: n,
|
||||||
|
}
|
||||||
|
mock.lockMigGet.Lock()
|
||||||
|
mock.calls.MigGet = append(mock.calls.MigGet, callInfo)
|
||||||
|
mock.lockMigGet.Unlock()
|
||||||
|
return mock.MigGetFunc(device, n)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MigGetCalls gets all the calls that were made to MigGet.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedGpmSample.MigGetCalls())
|
||||||
|
func (mock *GpmSample) MigGetCalls() []struct {
|
||||||
|
Device nvml.Device
|
||||||
|
N int
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
Device nvml.Device
|
||||||
|
N int
|
||||||
|
}
|
||||||
|
mock.lockMigGet.RLock()
|
||||||
|
calls = mock.calls.MigGet
|
||||||
|
mock.lockMigGet.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
475
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/gpuinstance.go
generated
vendored
Normal file
475
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/gpuinstance.go
generated
vendored
Normal file
@ -0,0 +1,475 @@
|
|||||||
|
// Code generated by moq; DO NOT EDIT.
|
||||||
|
// github.com/matryer/moq
|
||||||
|
|
||||||
|
package mock
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Ensure, that GpuInstance does implement nvml.GpuInstance.
|
||||||
|
// If this is not the case, regenerate this file with moq.
|
||||||
|
var _ nvml.GpuInstance = &GpuInstance{}
|
||||||
|
|
||||||
|
// GpuInstance is a mock implementation of nvml.GpuInstance.
|
||||||
|
//
|
||||||
|
// func TestSomethingThatUsesGpuInstance(t *testing.T) {
|
||||||
|
//
|
||||||
|
// // make and configure a mocked nvml.GpuInstance
|
||||||
|
// mockedGpuInstance := &GpuInstance{
|
||||||
|
// CreateComputeInstanceFunc: func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) (nvml.ComputeInstance, nvml.Return) {
|
||||||
|
// panic("mock out the CreateComputeInstance method")
|
||||||
|
// },
|
||||||
|
// CreateComputeInstanceWithPlacementFunc: func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo, computeInstancePlacement *nvml.ComputeInstancePlacement) (nvml.ComputeInstance, nvml.Return) {
|
||||||
|
// panic("mock out the CreateComputeInstanceWithPlacement method")
|
||||||
|
// },
|
||||||
|
// DestroyFunc: func() nvml.Return {
|
||||||
|
// panic("mock out the Destroy method")
|
||||||
|
// },
|
||||||
|
// GetComputeInstanceByIdFunc: func(n int) (nvml.ComputeInstance, nvml.Return) {
|
||||||
|
// panic("mock out the GetComputeInstanceById method")
|
||||||
|
// },
|
||||||
|
// GetComputeInstancePossiblePlacementsFunc: func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) ([]nvml.ComputeInstancePlacement, nvml.Return) {
|
||||||
|
// panic("mock out the GetComputeInstancePossiblePlacements method")
|
||||||
|
// },
|
||||||
|
// GetComputeInstanceProfileInfoFunc: func(n1 int, n2 int) (nvml.ComputeInstanceProfileInfo, nvml.Return) {
|
||||||
|
// panic("mock out the GetComputeInstanceProfileInfo method")
|
||||||
|
// },
|
||||||
|
// GetComputeInstanceProfileInfoVFunc: func(n1 int, n2 int) nvml.ComputeInstanceProfileInfoV {
|
||||||
|
// panic("mock out the GetComputeInstanceProfileInfoV method")
|
||||||
|
// },
|
||||||
|
// GetComputeInstanceRemainingCapacityFunc: func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) (int, nvml.Return) {
|
||||||
|
// panic("mock out the GetComputeInstanceRemainingCapacity method")
|
||||||
|
// },
|
||||||
|
// GetComputeInstancesFunc: func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) ([]nvml.ComputeInstance, nvml.Return) {
|
||||||
|
// panic("mock out the GetComputeInstances method")
|
||||||
|
// },
|
||||||
|
// GetInfoFunc: func() (nvml.GpuInstanceInfo, nvml.Return) {
|
||||||
|
// panic("mock out the GetInfo method")
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // use mockedGpuInstance in code that requires nvml.GpuInstance
|
||||||
|
// // and then make assertions.
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
type GpuInstance struct {
|
||||||
|
// CreateComputeInstanceFunc mocks the CreateComputeInstance method.
|
||||||
|
CreateComputeInstanceFunc func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) (nvml.ComputeInstance, nvml.Return)
|
||||||
|
|
||||||
|
// CreateComputeInstanceWithPlacementFunc mocks the CreateComputeInstanceWithPlacement method.
|
||||||
|
CreateComputeInstanceWithPlacementFunc func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo, computeInstancePlacement *nvml.ComputeInstancePlacement) (nvml.ComputeInstance, nvml.Return)
|
||||||
|
|
||||||
|
// DestroyFunc mocks the Destroy method.
|
||||||
|
DestroyFunc func() nvml.Return
|
||||||
|
|
||||||
|
// GetComputeInstanceByIdFunc mocks the GetComputeInstanceById method.
|
||||||
|
GetComputeInstanceByIdFunc func(n int) (nvml.ComputeInstance, nvml.Return)
|
||||||
|
|
||||||
|
// GetComputeInstancePossiblePlacementsFunc mocks the GetComputeInstancePossiblePlacements method.
|
||||||
|
GetComputeInstancePossiblePlacementsFunc func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) ([]nvml.ComputeInstancePlacement, nvml.Return)
|
||||||
|
|
||||||
|
// GetComputeInstanceProfileInfoFunc mocks the GetComputeInstanceProfileInfo method.
|
||||||
|
GetComputeInstanceProfileInfoFunc func(n1 int, n2 int) (nvml.ComputeInstanceProfileInfo, nvml.Return)
|
||||||
|
|
||||||
|
// GetComputeInstanceProfileInfoVFunc mocks the GetComputeInstanceProfileInfoV method.
|
||||||
|
GetComputeInstanceProfileInfoVFunc func(n1 int, n2 int) nvml.ComputeInstanceProfileInfoV
|
||||||
|
|
||||||
|
// GetComputeInstanceRemainingCapacityFunc mocks the GetComputeInstanceRemainingCapacity method.
|
||||||
|
GetComputeInstanceRemainingCapacityFunc func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) (int, nvml.Return)
|
||||||
|
|
||||||
|
// GetComputeInstancesFunc mocks the GetComputeInstances method.
|
||||||
|
GetComputeInstancesFunc func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) ([]nvml.ComputeInstance, nvml.Return)
|
||||||
|
|
||||||
|
// GetInfoFunc mocks the GetInfo method.
|
||||||
|
GetInfoFunc func() (nvml.GpuInstanceInfo, nvml.Return)
|
||||||
|
|
||||||
|
// calls tracks calls to the methods.
|
||||||
|
calls struct {
|
||||||
|
// CreateComputeInstance holds details about calls to the CreateComputeInstance method.
|
||||||
|
CreateComputeInstance []struct {
|
||||||
|
// ComputeInstanceProfileInfo is the computeInstanceProfileInfo argument value.
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
}
|
||||||
|
// CreateComputeInstanceWithPlacement holds details about calls to the CreateComputeInstanceWithPlacement method.
|
||||||
|
CreateComputeInstanceWithPlacement []struct {
|
||||||
|
// ComputeInstanceProfileInfo is the computeInstanceProfileInfo argument value.
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
// ComputeInstancePlacement is the computeInstancePlacement argument value.
|
||||||
|
ComputeInstancePlacement *nvml.ComputeInstancePlacement
|
||||||
|
}
|
||||||
|
// Destroy holds details about calls to the Destroy method.
|
||||||
|
Destroy []struct {
|
||||||
|
}
|
||||||
|
// GetComputeInstanceById holds details about calls to the GetComputeInstanceById method.
|
||||||
|
GetComputeInstanceById []struct {
|
||||||
|
// N is the n argument value.
|
||||||
|
N int
|
||||||
|
}
|
||||||
|
// GetComputeInstancePossiblePlacements holds details about calls to the GetComputeInstancePossiblePlacements method.
|
||||||
|
GetComputeInstancePossiblePlacements []struct {
|
||||||
|
// ComputeInstanceProfileInfo is the computeInstanceProfileInfo argument value.
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
}
|
||||||
|
// GetComputeInstanceProfileInfo holds details about calls to the GetComputeInstanceProfileInfo method.
|
||||||
|
GetComputeInstanceProfileInfo []struct {
|
||||||
|
// N1 is the n1 argument value.
|
||||||
|
N1 int
|
||||||
|
// N2 is the n2 argument value.
|
||||||
|
N2 int
|
||||||
|
}
|
||||||
|
// GetComputeInstanceProfileInfoV holds details about calls to the GetComputeInstanceProfileInfoV method.
|
||||||
|
GetComputeInstanceProfileInfoV []struct {
|
||||||
|
// N1 is the n1 argument value.
|
||||||
|
N1 int
|
||||||
|
// N2 is the n2 argument value.
|
||||||
|
N2 int
|
||||||
|
}
|
||||||
|
// GetComputeInstanceRemainingCapacity holds details about calls to the GetComputeInstanceRemainingCapacity method.
|
||||||
|
GetComputeInstanceRemainingCapacity []struct {
|
||||||
|
// ComputeInstanceProfileInfo is the computeInstanceProfileInfo argument value.
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
}
|
||||||
|
// GetComputeInstances holds details about calls to the GetComputeInstances method.
|
||||||
|
GetComputeInstances []struct {
|
||||||
|
// ComputeInstanceProfileInfo is the computeInstanceProfileInfo argument value.
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
}
|
||||||
|
// GetInfo holds details about calls to the GetInfo method.
|
||||||
|
GetInfo []struct {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lockCreateComputeInstance sync.RWMutex
|
||||||
|
lockCreateComputeInstanceWithPlacement sync.RWMutex
|
||||||
|
lockDestroy sync.RWMutex
|
||||||
|
lockGetComputeInstanceById sync.RWMutex
|
||||||
|
lockGetComputeInstancePossiblePlacements sync.RWMutex
|
||||||
|
lockGetComputeInstanceProfileInfo sync.RWMutex
|
||||||
|
lockGetComputeInstanceProfileInfoV sync.RWMutex
|
||||||
|
lockGetComputeInstanceRemainingCapacity sync.RWMutex
|
||||||
|
lockGetComputeInstances sync.RWMutex
|
||||||
|
lockGetInfo sync.RWMutex
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateComputeInstance calls CreateComputeInstanceFunc.
|
||||||
|
func (mock *GpuInstance) CreateComputeInstance(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) (nvml.ComputeInstance, nvml.Return) {
|
||||||
|
if mock.CreateComputeInstanceFunc == nil {
|
||||||
|
panic("GpuInstance.CreateComputeInstanceFunc: method is nil but GpuInstance.CreateComputeInstance was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
}{
|
||||||
|
ComputeInstanceProfileInfo: computeInstanceProfileInfo,
|
||||||
|
}
|
||||||
|
mock.lockCreateComputeInstance.Lock()
|
||||||
|
mock.calls.CreateComputeInstance = append(mock.calls.CreateComputeInstance, callInfo)
|
||||||
|
mock.lockCreateComputeInstance.Unlock()
|
||||||
|
return mock.CreateComputeInstanceFunc(computeInstanceProfileInfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateComputeInstanceCalls gets all the calls that were made to CreateComputeInstance.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedGpuInstance.CreateComputeInstanceCalls())
|
||||||
|
func (mock *GpuInstance) CreateComputeInstanceCalls() []struct {
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
}
|
||||||
|
mock.lockCreateComputeInstance.RLock()
|
||||||
|
calls = mock.calls.CreateComputeInstance
|
||||||
|
mock.lockCreateComputeInstance.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateComputeInstanceWithPlacement calls CreateComputeInstanceWithPlacementFunc.
|
||||||
|
func (mock *GpuInstance) CreateComputeInstanceWithPlacement(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo, computeInstancePlacement *nvml.ComputeInstancePlacement) (nvml.ComputeInstance, nvml.Return) {
|
||||||
|
if mock.CreateComputeInstanceWithPlacementFunc == nil {
|
||||||
|
panic("GpuInstance.CreateComputeInstanceWithPlacementFunc: method is nil but GpuInstance.CreateComputeInstanceWithPlacement was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
ComputeInstancePlacement *nvml.ComputeInstancePlacement
|
||||||
|
}{
|
||||||
|
ComputeInstanceProfileInfo: computeInstanceProfileInfo,
|
||||||
|
ComputeInstancePlacement: computeInstancePlacement,
|
||||||
|
}
|
||||||
|
mock.lockCreateComputeInstanceWithPlacement.Lock()
|
||||||
|
mock.calls.CreateComputeInstanceWithPlacement = append(mock.calls.CreateComputeInstanceWithPlacement, callInfo)
|
||||||
|
mock.lockCreateComputeInstanceWithPlacement.Unlock()
|
||||||
|
return mock.CreateComputeInstanceWithPlacementFunc(computeInstanceProfileInfo, computeInstancePlacement)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateComputeInstanceWithPlacementCalls gets all the calls that were made to CreateComputeInstanceWithPlacement.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedGpuInstance.CreateComputeInstanceWithPlacementCalls())
|
||||||
|
func (mock *GpuInstance) CreateComputeInstanceWithPlacementCalls() []struct {
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
ComputeInstancePlacement *nvml.ComputeInstancePlacement
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
ComputeInstancePlacement *nvml.ComputeInstancePlacement
|
||||||
|
}
|
||||||
|
mock.lockCreateComputeInstanceWithPlacement.RLock()
|
||||||
|
calls = mock.calls.CreateComputeInstanceWithPlacement
|
||||||
|
mock.lockCreateComputeInstanceWithPlacement.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destroy calls DestroyFunc.
|
||||||
|
func (mock *GpuInstance) Destroy() nvml.Return {
|
||||||
|
if mock.DestroyFunc == nil {
|
||||||
|
panic("GpuInstance.DestroyFunc: method is nil but GpuInstance.Destroy was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockDestroy.Lock()
|
||||||
|
mock.calls.Destroy = append(mock.calls.Destroy, callInfo)
|
||||||
|
mock.lockDestroy.Unlock()
|
||||||
|
return mock.DestroyFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// DestroyCalls gets all the calls that were made to Destroy.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedGpuInstance.DestroyCalls())
|
||||||
|
func (mock *GpuInstance) DestroyCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockDestroy.RLock()
|
||||||
|
calls = mock.calls.Destroy
|
||||||
|
mock.lockDestroy.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetComputeInstanceById calls GetComputeInstanceByIdFunc.
|
||||||
|
func (mock *GpuInstance) GetComputeInstanceById(n int) (nvml.ComputeInstance, nvml.Return) {
|
||||||
|
if mock.GetComputeInstanceByIdFunc == nil {
|
||||||
|
panic("GpuInstance.GetComputeInstanceByIdFunc: method is nil but GpuInstance.GetComputeInstanceById was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
N int
|
||||||
|
}{
|
||||||
|
N: n,
|
||||||
|
}
|
||||||
|
mock.lockGetComputeInstanceById.Lock()
|
||||||
|
mock.calls.GetComputeInstanceById = append(mock.calls.GetComputeInstanceById, callInfo)
|
||||||
|
mock.lockGetComputeInstanceById.Unlock()
|
||||||
|
return mock.GetComputeInstanceByIdFunc(n)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetComputeInstanceByIdCalls gets all the calls that were made to GetComputeInstanceById.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedGpuInstance.GetComputeInstanceByIdCalls())
|
||||||
|
func (mock *GpuInstance) GetComputeInstanceByIdCalls() []struct {
|
||||||
|
N int
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
N int
|
||||||
|
}
|
||||||
|
mock.lockGetComputeInstanceById.RLock()
|
||||||
|
calls = mock.calls.GetComputeInstanceById
|
||||||
|
mock.lockGetComputeInstanceById.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetComputeInstancePossiblePlacements calls GetComputeInstancePossiblePlacementsFunc.
|
||||||
|
func (mock *GpuInstance) GetComputeInstancePossiblePlacements(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) ([]nvml.ComputeInstancePlacement, nvml.Return) {
|
||||||
|
if mock.GetComputeInstancePossiblePlacementsFunc == nil {
|
||||||
|
panic("GpuInstance.GetComputeInstancePossiblePlacementsFunc: method is nil but GpuInstance.GetComputeInstancePossiblePlacements was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
}{
|
||||||
|
ComputeInstanceProfileInfo: computeInstanceProfileInfo,
|
||||||
|
}
|
||||||
|
mock.lockGetComputeInstancePossiblePlacements.Lock()
|
||||||
|
mock.calls.GetComputeInstancePossiblePlacements = append(mock.calls.GetComputeInstancePossiblePlacements, callInfo)
|
||||||
|
mock.lockGetComputeInstancePossiblePlacements.Unlock()
|
||||||
|
return mock.GetComputeInstancePossiblePlacementsFunc(computeInstanceProfileInfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetComputeInstancePossiblePlacementsCalls gets all the calls that were made to GetComputeInstancePossiblePlacements.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedGpuInstance.GetComputeInstancePossiblePlacementsCalls())
|
||||||
|
func (mock *GpuInstance) GetComputeInstancePossiblePlacementsCalls() []struct {
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
}
|
||||||
|
mock.lockGetComputeInstancePossiblePlacements.RLock()
|
||||||
|
calls = mock.calls.GetComputeInstancePossiblePlacements
|
||||||
|
mock.lockGetComputeInstancePossiblePlacements.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetComputeInstanceProfileInfo calls GetComputeInstanceProfileInfoFunc.
|
||||||
|
func (mock *GpuInstance) GetComputeInstanceProfileInfo(n1 int, n2 int) (nvml.ComputeInstanceProfileInfo, nvml.Return) {
|
||||||
|
if mock.GetComputeInstanceProfileInfoFunc == nil {
|
||||||
|
panic("GpuInstance.GetComputeInstanceProfileInfoFunc: method is nil but GpuInstance.GetComputeInstanceProfileInfo was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
N1 int
|
||||||
|
N2 int
|
||||||
|
}{
|
||||||
|
N1: n1,
|
||||||
|
N2: n2,
|
||||||
|
}
|
||||||
|
mock.lockGetComputeInstanceProfileInfo.Lock()
|
||||||
|
mock.calls.GetComputeInstanceProfileInfo = append(mock.calls.GetComputeInstanceProfileInfo, callInfo)
|
||||||
|
mock.lockGetComputeInstanceProfileInfo.Unlock()
|
||||||
|
return mock.GetComputeInstanceProfileInfoFunc(n1, n2)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetComputeInstanceProfileInfoCalls gets all the calls that were made to GetComputeInstanceProfileInfo.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedGpuInstance.GetComputeInstanceProfileInfoCalls())
|
||||||
|
func (mock *GpuInstance) GetComputeInstanceProfileInfoCalls() []struct {
|
||||||
|
N1 int
|
||||||
|
N2 int
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
N1 int
|
||||||
|
N2 int
|
||||||
|
}
|
||||||
|
mock.lockGetComputeInstanceProfileInfo.RLock()
|
||||||
|
calls = mock.calls.GetComputeInstanceProfileInfo
|
||||||
|
mock.lockGetComputeInstanceProfileInfo.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetComputeInstanceProfileInfoV calls GetComputeInstanceProfileInfoVFunc.
|
||||||
|
func (mock *GpuInstance) GetComputeInstanceProfileInfoV(n1 int, n2 int) nvml.ComputeInstanceProfileInfoV {
|
||||||
|
if mock.GetComputeInstanceProfileInfoVFunc == nil {
|
||||||
|
panic("GpuInstance.GetComputeInstanceProfileInfoVFunc: method is nil but GpuInstance.GetComputeInstanceProfileInfoV was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
N1 int
|
||||||
|
N2 int
|
||||||
|
}{
|
||||||
|
N1: n1,
|
||||||
|
N2: n2,
|
||||||
|
}
|
||||||
|
mock.lockGetComputeInstanceProfileInfoV.Lock()
|
||||||
|
mock.calls.GetComputeInstanceProfileInfoV = append(mock.calls.GetComputeInstanceProfileInfoV, callInfo)
|
||||||
|
mock.lockGetComputeInstanceProfileInfoV.Unlock()
|
||||||
|
return mock.GetComputeInstanceProfileInfoVFunc(n1, n2)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetComputeInstanceProfileInfoVCalls gets all the calls that were made to GetComputeInstanceProfileInfoV.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedGpuInstance.GetComputeInstanceProfileInfoVCalls())
|
||||||
|
func (mock *GpuInstance) GetComputeInstanceProfileInfoVCalls() []struct {
|
||||||
|
N1 int
|
||||||
|
N2 int
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
N1 int
|
||||||
|
N2 int
|
||||||
|
}
|
||||||
|
mock.lockGetComputeInstanceProfileInfoV.RLock()
|
||||||
|
calls = mock.calls.GetComputeInstanceProfileInfoV
|
||||||
|
mock.lockGetComputeInstanceProfileInfoV.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetComputeInstanceRemainingCapacity calls GetComputeInstanceRemainingCapacityFunc.
|
||||||
|
func (mock *GpuInstance) GetComputeInstanceRemainingCapacity(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) (int, nvml.Return) {
|
||||||
|
if mock.GetComputeInstanceRemainingCapacityFunc == nil {
|
||||||
|
panic("GpuInstance.GetComputeInstanceRemainingCapacityFunc: method is nil but GpuInstance.GetComputeInstanceRemainingCapacity was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
}{
|
||||||
|
ComputeInstanceProfileInfo: computeInstanceProfileInfo,
|
||||||
|
}
|
||||||
|
mock.lockGetComputeInstanceRemainingCapacity.Lock()
|
||||||
|
mock.calls.GetComputeInstanceRemainingCapacity = append(mock.calls.GetComputeInstanceRemainingCapacity, callInfo)
|
||||||
|
mock.lockGetComputeInstanceRemainingCapacity.Unlock()
|
||||||
|
return mock.GetComputeInstanceRemainingCapacityFunc(computeInstanceProfileInfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetComputeInstanceRemainingCapacityCalls gets all the calls that were made to GetComputeInstanceRemainingCapacity.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedGpuInstance.GetComputeInstanceRemainingCapacityCalls())
|
||||||
|
func (mock *GpuInstance) GetComputeInstanceRemainingCapacityCalls() []struct {
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
}
|
||||||
|
mock.lockGetComputeInstanceRemainingCapacity.RLock()
|
||||||
|
calls = mock.calls.GetComputeInstanceRemainingCapacity
|
||||||
|
mock.lockGetComputeInstanceRemainingCapacity.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetComputeInstances calls GetComputeInstancesFunc.
|
||||||
|
func (mock *GpuInstance) GetComputeInstances(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) ([]nvml.ComputeInstance, nvml.Return) {
|
||||||
|
if mock.GetComputeInstancesFunc == nil {
|
||||||
|
panic("GpuInstance.GetComputeInstancesFunc: method is nil but GpuInstance.GetComputeInstances was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
}{
|
||||||
|
ComputeInstanceProfileInfo: computeInstanceProfileInfo,
|
||||||
|
}
|
||||||
|
mock.lockGetComputeInstances.Lock()
|
||||||
|
mock.calls.GetComputeInstances = append(mock.calls.GetComputeInstances, callInfo)
|
||||||
|
mock.lockGetComputeInstances.Unlock()
|
||||||
|
return mock.GetComputeInstancesFunc(computeInstanceProfileInfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetComputeInstancesCalls gets all the calls that were made to GetComputeInstances.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedGpuInstance.GetComputeInstancesCalls())
|
||||||
|
func (mock *GpuInstance) GetComputeInstancesCalls() []struct {
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||||
|
}
|
||||||
|
mock.lockGetComputeInstances.RLock()
|
||||||
|
calls = mock.calls.GetComputeInstances
|
||||||
|
mock.lockGetComputeInstances.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetInfo calls GetInfoFunc.
|
||||||
|
func (mock *GpuInstance) GetInfo() (nvml.GpuInstanceInfo, nvml.Return) {
|
||||||
|
if mock.GetInfoFunc == nil {
|
||||||
|
panic("GpuInstance.GetInfoFunc: method is nil but GpuInstance.GetInfo was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetInfo.Lock()
|
||||||
|
mock.calls.GetInfo = append(mock.calls.GetInfo, callInfo)
|
||||||
|
mock.lockGetInfo.Unlock()
|
||||||
|
return mock.GetInfoFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetInfoCalls gets all the calls that were made to GetInfo.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedGpuInstance.GetInfoCalls())
|
||||||
|
func (mock *GpuInstance) GetInfoCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetInfo.RLock()
|
||||||
|
calls = mock.calls.GetInfo
|
||||||
|
mock.lockGetInfo.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
13588
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/interface.go
generated
vendored
Normal file
13588
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/interface.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
304
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/unit.go
generated
vendored
Normal file
304
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/unit.go
generated
vendored
Normal file
@ -0,0 +1,304 @@
|
|||||||
|
// Code generated by moq; DO NOT EDIT.
|
||||||
|
// github.com/matryer/moq
|
||||||
|
|
||||||
|
package mock
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Ensure, that Unit does implement nvml.Unit.
|
||||||
|
// If this is not the case, regenerate this file with moq.
|
||||||
|
var _ nvml.Unit = &Unit{}
|
||||||
|
|
||||||
|
// Unit is a mock implementation of nvml.Unit.
|
||||||
|
//
|
||||||
|
// func TestSomethingThatUsesUnit(t *testing.T) {
|
||||||
|
//
|
||||||
|
// // make and configure a mocked nvml.Unit
|
||||||
|
// mockedUnit := &Unit{
|
||||||
|
// GetDevicesFunc: func() ([]nvml.Device, nvml.Return) {
|
||||||
|
// panic("mock out the GetDevices method")
|
||||||
|
// },
|
||||||
|
// GetFanSpeedInfoFunc: func() (nvml.UnitFanSpeeds, nvml.Return) {
|
||||||
|
// panic("mock out the GetFanSpeedInfo method")
|
||||||
|
// },
|
||||||
|
// GetLedStateFunc: func() (nvml.LedState, nvml.Return) {
|
||||||
|
// panic("mock out the GetLedState method")
|
||||||
|
// },
|
||||||
|
// GetPsuInfoFunc: func() (nvml.PSUInfo, nvml.Return) {
|
||||||
|
// panic("mock out the GetPsuInfo method")
|
||||||
|
// },
|
||||||
|
// GetTemperatureFunc: func(n int) (uint32, nvml.Return) {
|
||||||
|
// panic("mock out the GetTemperature method")
|
||||||
|
// },
|
||||||
|
// GetUnitInfoFunc: func() (nvml.UnitInfo, nvml.Return) {
|
||||||
|
// panic("mock out the GetUnitInfo method")
|
||||||
|
// },
|
||||||
|
// SetLedStateFunc: func(ledColor nvml.LedColor) nvml.Return {
|
||||||
|
// panic("mock out the SetLedState method")
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // use mockedUnit in code that requires nvml.Unit
|
||||||
|
// // and then make assertions.
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
type Unit struct {
|
||||||
|
// GetDevicesFunc mocks the GetDevices method.
|
||||||
|
GetDevicesFunc func() ([]nvml.Device, nvml.Return)
|
||||||
|
|
||||||
|
// GetFanSpeedInfoFunc mocks the GetFanSpeedInfo method.
|
||||||
|
GetFanSpeedInfoFunc func() (nvml.UnitFanSpeeds, nvml.Return)
|
||||||
|
|
||||||
|
// GetLedStateFunc mocks the GetLedState method.
|
||||||
|
GetLedStateFunc func() (nvml.LedState, nvml.Return)
|
||||||
|
|
||||||
|
// GetPsuInfoFunc mocks the GetPsuInfo method.
|
||||||
|
GetPsuInfoFunc func() (nvml.PSUInfo, nvml.Return)
|
||||||
|
|
||||||
|
// GetTemperatureFunc mocks the GetTemperature method.
|
||||||
|
GetTemperatureFunc func(n int) (uint32, nvml.Return)
|
||||||
|
|
||||||
|
// GetUnitInfoFunc mocks the GetUnitInfo method.
|
||||||
|
GetUnitInfoFunc func() (nvml.UnitInfo, nvml.Return)
|
||||||
|
|
||||||
|
// SetLedStateFunc mocks the SetLedState method.
|
||||||
|
SetLedStateFunc func(ledColor nvml.LedColor) nvml.Return
|
||||||
|
|
||||||
|
// calls tracks calls to the methods.
|
||||||
|
calls struct {
|
||||||
|
// GetDevices holds details about calls to the GetDevices method.
|
||||||
|
GetDevices []struct {
|
||||||
|
}
|
||||||
|
// GetFanSpeedInfo holds details about calls to the GetFanSpeedInfo method.
|
||||||
|
GetFanSpeedInfo []struct {
|
||||||
|
}
|
||||||
|
// GetLedState holds details about calls to the GetLedState method.
|
||||||
|
GetLedState []struct {
|
||||||
|
}
|
||||||
|
// GetPsuInfo holds details about calls to the GetPsuInfo method.
|
||||||
|
GetPsuInfo []struct {
|
||||||
|
}
|
||||||
|
// GetTemperature holds details about calls to the GetTemperature method.
|
||||||
|
GetTemperature []struct {
|
||||||
|
// N is the n argument value.
|
||||||
|
N int
|
||||||
|
}
|
||||||
|
// GetUnitInfo holds details about calls to the GetUnitInfo method.
|
||||||
|
GetUnitInfo []struct {
|
||||||
|
}
|
||||||
|
// SetLedState holds details about calls to the SetLedState method.
|
||||||
|
SetLedState []struct {
|
||||||
|
// LedColor is the ledColor argument value.
|
||||||
|
LedColor nvml.LedColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lockGetDevices sync.RWMutex
|
||||||
|
lockGetFanSpeedInfo sync.RWMutex
|
||||||
|
lockGetLedState sync.RWMutex
|
||||||
|
lockGetPsuInfo sync.RWMutex
|
||||||
|
lockGetTemperature sync.RWMutex
|
||||||
|
lockGetUnitInfo sync.RWMutex
|
||||||
|
lockSetLedState sync.RWMutex
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDevices calls GetDevicesFunc.
|
||||||
|
func (mock *Unit) GetDevices() ([]nvml.Device, nvml.Return) {
|
||||||
|
if mock.GetDevicesFunc == nil {
|
||||||
|
panic("Unit.GetDevicesFunc: method is nil but Unit.GetDevices was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetDevices.Lock()
|
||||||
|
mock.calls.GetDevices = append(mock.calls.GetDevices, callInfo)
|
||||||
|
mock.lockGetDevices.Unlock()
|
||||||
|
return mock.GetDevicesFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDevicesCalls gets all the calls that were made to GetDevices.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedUnit.GetDevicesCalls())
|
||||||
|
func (mock *Unit) GetDevicesCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetDevices.RLock()
|
||||||
|
calls = mock.calls.GetDevices
|
||||||
|
mock.lockGetDevices.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFanSpeedInfo calls GetFanSpeedInfoFunc.
|
||||||
|
func (mock *Unit) GetFanSpeedInfo() (nvml.UnitFanSpeeds, nvml.Return) {
|
||||||
|
if mock.GetFanSpeedInfoFunc == nil {
|
||||||
|
panic("Unit.GetFanSpeedInfoFunc: method is nil but Unit.GetFanSpeedInfo was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetFanSpeedInfo.Lock()
|
||||||
|
mock.calls.GetFanSpeedInfo = append(mock.calls.GetFanSpeedInfo, callInfo)
|
||||||
|
mock.lockGetFanSpeedInfo.Unlock()
|
||||||
|
return mock.GetFanSpeedInfoFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFanSpeedInfoCalls gets all the calls that were made to GetFanSpeedInfo.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedUnit.GetFanSpeedInfoCalls())
|
||||||
|
func (mock *Unit) GetFanSpeedInfoCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetFanSpeedInfo.RLock()
|
||||||
|
calls = mock.calls.GetFanSpeedInfo
|
||||||
|
mock.lockGetFanSpeedInfo.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLedState calls GetLedStateFunc.
|
||||||
|
func (mock *Unit) GetLedState() (nvml.LedState, nvml.Return) {
|
||||||
|
if mock.GetLedStateFunc == nil {
|
||||||
|
panic("Unit.GetLedStateFunc: method is nil but Unit.GetLedState was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetLedState.Lock()
|
||||||
|
mock.calls.GetLedState = append(mock.calls.GetLedState, callInfo)
|
||||||
|
mock.lockGetLedState.Unlock()
|
||||||
|
return mock.GetLedStateFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLedStateCalls gets all the calls that were made to GetLedState.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedUnit.GetLedStateCalls())
|
||||||
|
func (mock *Unit) GetLedStateCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetLedState.RLock()
|
||||||
|
calls = mock.calls.GetLedState
|
||||||
|
mock.lockGetLedState.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPsuInfo calls GetPsuInfoFunc.
|
||||||
|
func (mock *Unit) GetPsuInfo() (nvml.PSUInfo, nvml.Return) {
|
||||||
|
if mock.GetPsuInfoFunc == nil {
|
||||||
|
panic("Unit.GetPsuInfoFunc: method is nil but Unit.GetPsuInfo was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetPsuInfo.Lock()
|
||||||
|
mock.calls.GetPsuInfo = append(mock.calls.GetPsuInfo, callInfo)
|
||||||
|
mock.lockGetPsuInfo.Unlock()
|
||||||
|
return mock.GetPsuInfoFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPsuInfoCalls gets all the calls that were made to GetPsuInfo.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedUnit.GetPsuInfoCalls())
|
||||||
|
func (mock *Unit) GetPsuInfoCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetPsuInfo.RLock()
|
||||||
|
calls = mock.calls.GetPsuInfo
|
||||||
|
mock.lockGetPsuInfo.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTemperature calls GetTemperatureFunc.
|
||||||
|
func (mock *Unit) GetTemperature(n int) (uint32, nvml.Return) {
|
||||||
|
if mock.GetTemperatureFunc == nil {
|
||||||
|
panic("Unit.GetTemperatureFunc: method is nil but Unit.GetTemperature was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
N int
|
||||||
|
}{
|
||||||
|
N: n,
|
||||||
|
}
|
||||||
|
mock.lockGetTemperature.Lock()
|
||||||
|
mock.calls.GetTemperature = append(mock.calls.GetTemperature, callInfo)
|
||||||
|
mock.lockGetTemperature.Unlock()
|
||||||
|
return mock.GetTemperatureFunc(n)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTemperatureCalls gets all the calls that were made to GetTemperature.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedUnit.GetTemperatureCalls())
|
||||||
|
func (mock *Unit) GetTemperatureCalls() []struct {
|
||||||
|
N int
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
N int
|
||||||
|
}
|
||||||
|
mock.lockGetTemperature.RLock()
|
||||||
|
calls = mock.calls.GetTemperature
|
||||||
|
mock.lockGetTemperature.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUnitInfo calls GetUnitInfoFunc.
|
||||||
|
func (mock *Unit) GetUnitInfo() (nvml.UnitInfo, nvml.Return) {
|
||||||
|
if mock.GetUnitInfoFunc == nil {
|
||||||
|
panic("Unit.GetUnitInfoFunc: method is nil but Unit.GetUnitInfo was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetUnitInfo.Lock()
|
||||||
|
mock.calls.GetUnitInfo = append(mock.calls.GetUnitInfo, callInfo)
|
||||||
|
mock.lockGetUnitInfo.Unlock()
|
||||||
|
return mock.GetUnitInfoFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUnitInfoCalls gets all the calls that were made to GetUnitInfo.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedUnit.GetUnitInfoCalls())
|
||||||
|
func (mock *Unit) GetUnitInfoCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetUnitInfo.RLock()
|
||||||
|
calls = mock.calls.GetUnitInfo
|
||||||
|
mock.lockGetUnitInfo.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLedState calls SetLedStateFunc.
|
||||||
|
func (mock *Unit) SetLedState(ledColor nvml.LedColor) nvml.Return {
|
||||||
|
if mock.SetLedStateFunc == nil {
|
||||||
|
panic("Unit.SetLedStateFunc: method is nil but Unit.SetLedState was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
LedColor nvml.LedColor
|
||||||
|
}{
|
||||||
|
LedColor: ledColor,
|
||||||
|
}
|
||||||
|
mock.lockSetLedState.Lock()
|
||||||
|
mock.calls.SetLedState = append(mock.calls.SetLedState, callInfo)
|
||||||
|
mock.lockSetLedState.Unlock()
|
||||||
|
return mock.SetLedStateFunc(ledColor)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLedStateCalls gets all the calls that were made to SetLedState.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedUnit.SetLedStateCalls())
|
||||||
|
func (mock *Unit) SetLedStateCalls() []struct {
|
||||||
|
LedColor nvml.LedColor
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
LedColor nvml.LedColor
|
||||||
|
}
|
||||||
|
mock.lockSetLedState.RLock()
|
||||||
|
calls = mock.calls.SetLedState
|
||||||
|
mock.lockSetLedState.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
896
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/vgpuinstance.go
generated
vendored
Normal file
896
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/vgpuinstance.go
generated
vendored
Normal file
@ -0,0 +1,896 @@
|
|||||||
|
// Code generated by moq; DO NOT EDIT.
|
||||||
|
// github.com/matryer/moq
|
||||||
|
|
||||||
|
package mock
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Ensure, that VgpuInstance does implement nvml.VgpuInstance.
|
||||||
|
// If this is not the case, regenerate this file with moq.
|
||||||
|
var _ nvml.VgpuInstance = &VgpuInstance{}
|
||||||
|
|
||||||
|
// VgpuInstance is a mock implementation of nvml.VgpuInstance.
|
||||||
|
//
|
||||||
|
// func TestSomethingThatUsesVgpuInstance(t *testing.T) {
|
||||||
|
//
|
||||||
|
// // make and configure a mocked nvml.VgpuInstance
|
||||||
|
// mockedVgpuInstance := &VgpuInstance{
|
||||||
|
// ClearAccountingPidsFunc: func() nvml.Return {
|
||||||
|
// panic("mock out the ClearAccountingPids method")
|
||||||
|
// },
|
||||||
|
// GetAccountingModeFunc: func() (nvml.EnableState, nvml.Return) {
|
||||||
|
// panic("mock out the GetAccountingMode method")
|
||||||
|
// },
|
||||||
|
// GetAccountingPidsFunc: func() ([]int, nvml.Return) {
|
||||||
|
// panic("mock out the GetAccountingPids method")
|
||||||
|
// },
|
||||||
|
// GetAccountingStatsFunc: func(n int) (nvml.AccountingStats, nvml.Return) {
|
||||||
|
// panic("mock out the GetAccountingStats method")
|
||||||
|
// },
|
||||||
|
// GetEccModeFunc: func() (nvml.EnableState, nvml.Return) {
|
||||||
|
// panic("mock out the GetEccMode method")
|
||||||
|
// },
|
||||||
|
// GetEncoderCapacityFunc: func() (int, nvml.Return) {
|
||||||
|
// panic("mock out the GetEncoderCapacity method")
|
||||||
|
// },
|
||||||
|
// GetEncoderSessionsFunc: func() (int, nvml.EncoderSessionInfo, nvml.Return) {
|
||||||
|
// panic("mock out the GetEncoderSessions method")
|
||||||
|
// },
|
||||||
|
// GetEncoderStatsFunc: func() (int, uint32, uint32, nvml.Return) {
|
||||||
|
// panic("mock out the GetEncoderStats method")
|
||||||
|
// },
|
||||||
|
// GetFBCSessionsFunc: func() (int, nvml.FBCSessionInfo, nvml.Return) {
|
||||||
|
// panic("mock out the GetFBCSessions method")
|
||||||
|
// },
|
||||||
|
// GetFBCStatsFunc: func() (nvml.FBCStats, nvml.Return) {
|
||||||
|
// panic("mock out the GetFBCStats method")
|
||||||
|
// },
|
||||||
|
// GetFbUsageFunc: func() (uint64, nvml.Return) {
|
||||||
|
// panic("mock out the GetFbUsage method")
|
||||||
|
// },
|
||||||
|
// GetFrameRateLimitFunc: func() (uint32, nvml.Return) {
|
||||||
|
// panic("mock out the GetFrameRateLimit method")
|
||||||
|
// },
|
||||||
|
// GetGpuInstanceIdFunc: func() (int, nvml.Return) {
|
||||||
|
// panic("mock out the GetGpuInstanceId method")
|
||||||
|
// },
|
||||||
|
// GetGpuPciIdFunc: func() (string, nvml.Return) {
|
||||||
|
// panic("mock out the GetGpuPciId method")
|
||||||
|
// },
|
||||||
|
// GetLicenseInfoFunc: func() (nvml.VgpuLicenseInfo, nvml.Return) {
|
||||||
|
// panic("mock out the GetLicenseInfo method")
|
||||||
|
// },
|
||||||
|
// GetLicenseStatusFunc: func() (int, nvml.Return) {
|
||||||
|
// panic("mock out the GetLicenseStatus method")
|
||||||
|
// },
|
||||||
|
// GetMdevUUIDFunc: func() (string, nvml.Return) {
|
||||||
|
// panic("mock out the GetMdevUUID method")
|
||||||
|
// },
|
||||||
|
// GetMetadataFunc: func() (nvml.VgpuMetadata, nvml.Return) {
|
||||||
|
// panic("mock out the GetMetadata method")
|
||||||
|
// },
|
||||||
|
// GetTypeFunc: func() (nvml.VgpuTypeId, nvml.Return) {
|
||||||
|
// panic("mock out the GetType method")
|
||||||
|
// },
|
||||||
|
// GetUUIDFunc: func() (string, nvml.Return) {
|
||||||
|
// panic("mock out the GetUUID method")
|
||||||
|
// },
|
||||||
|
// GetVmDriverVersionFunc: func() (string, nvml.Return) {
|
||||||
|
// panic("mock out the GetVmDriverVersion method")
|
||||||
|
// },
|
||||||
|
// GetVmIDFunc: func() (string, nvml.VgpuVmIdType, nvml.Return) {
|
||||||
|
// panic("mock out the GetVmID method")
|
||||||
|
// },
|
||||||
|
// SetEncoderCapacityFunc: func(n int) nvml.Return {
|
||||||
|
// panic("mock out the SetEncoderCapacity method")
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // use mockedVgpuInstance in code that requires nvml.VgpuInstance
|
||||||
|
// // and then make assertions.
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
type VgpuInstance struct {
|
||||||
|
// ClearAccountingPidsFunc mocks the ClearAccountingPids method.
|
||||||
|
ClearAccountingPidsFunc func() nvml.Return
|
||||||
|
|
||||||
|
// GetAccountingModeFunc mocks the GetAccountingMode method.
|
||||||
|
GetAccountingModeFunc func() (nvml.EnableState, nvml.Return)
|
||||||
|
|
||||||
|
// GetAccountingPidsFunc mocks the GetAccountingPids method.
|
||||||
|
GetAccountingPidsFunc func() ([]int, nvml.Return)
|
||||||
|
|
||||||
|
// GetAccountingStatsFunc mocks the GetAccountingStats method.
|
||||||
|
GetAccountingStatsFunc func(n int) (nvml.AccountingStats, nvml.Return)
|
||||||
|
|
||||||
|
// GetEccModeFunc mocks the GetEccMode method.
|
||||||
|
GetEccModeFunc func() (nvml.EnableState, nvml.Return)
|
||||||
|
|
||||||
|
// GetEncoderCapacityFunc mocks the GetEncoderCapacity method.
|
||||||
|
GetEncoderCapacityFunc func() (int, nvml.Return)
|
||||||
|
|
||||||
|
// GetEncoderSessionsFunc mocks the GetEncoderSessions method.
|
||||||
|
GetEncoderSessionsFunc func() (int, nvml.EncoderSessionInfo, nvml.Return)
|
||||||
|
|
||||||
|
// GetEncoderStatsFunc mocks the GetEncoderStats method.
|
||||||
|
GetEncoderStatsFunc func() (int, uint32, uint32, nvml.Return)
|
||||||
|
|
||||||
|
// GetFBCSessionsFunc mocks the GetFBCSessions method.
|
||||||
|
GetFBCSessionsFunc func() (int, nvml.FBCSessionInfo, nvml.Return)
|
||||||
|
|
||||||
|
// GetFBCStatsFunc mocks the GetFBCStats method.
|
||||||
|
GetFBCStatsFunc func() (nvml.FBCStats, nvml.Return)
|
||||||
|
|
||||||
|
// GetFbUsageFunc mocks the GetFbUsage method.
|
||||||
|
GetFbUsageFunc func() (uint64, nvml.Return)
|
||||||
|
|
||||||
|
// GetFrameRateLimitFunc mocks the GetFrameRateLimit method.
|
||||||
|
GetFrameRateLimitFunc func() (uint32, nvml.Return)
|
||||||
|
|
||||||
|
// GetGpuInstanceIdFunc mocks the GetGpuInstanceId method.
|
||||||
|
GetGpuInstanceIdFunc func() (int, nvml.Return)
|
||||||
|
|
||||||
|
// GetGpuPciIdFunc mocks the GetGpuPciId method.
|
||||||
|
GetGpuPciIdFunc func() (string, nvml.Return)
|
||||||
|
|
||||||
|
// GetLicenseInfoFunc mocks the GetLicenseInfo method.
|
||||||
|
GetLicenseInfoFunc func() (nvml.VgpuLicenseInfo, nvml.Return)
|
||||||
|
|
||||||
|
// GetLicenseStatusFunc mocks the GetLicenseStatus method.
|
||||||
|
GetLicenseStatusFunc func() (int, nvml.Return)
|
||||||
|
|
||||||
|
// GetMdevUUIDFunc mocks the GetMdevUUID method.
|
||||||
|
GetMdevUUIDFunc func() (string, nvml.Return)
|
||||||
|
|
||||||
|
// GetMetadataFunc mocks the GetMetadata method.
|
||||||
|
GetMetadataFunc func() (nvml.VgpuMetadata, nvml.Return)
|
||||||
|
|
||||||
|
// GetTypeFunc mocks the GetType method.
|
||||||
|
GetTypeFunc func() (nvml.VgpuTypeId, nvml.Return)
|
||||||
|
|
||||||
|
// GetUUIDFunc mocks the GetUUID method.
|
||||||
|
GetUUIDFunc func() (string, nvml.Return)
|
||||||
|
|
||||||
|
// GetVmDriverVersionFunc mocks the GetVmDriverVersion method.
|
||||||
|
GetVmDriverVersionFunc func() (string, nvml.Return)
|
||||||
|
|
||||||
|
// GetVmIDFunc mocks the GetVmID method.
|
||||||
|
GetVmIDFunc func() (string, nvml.VgpuVmIdType, nvml.Return)
|
||||||
|
|
||||||
|
// SetEncoderCapacityFunc mocks the SetEncoderCapacity method.
|
||||||
|
SetEncoderCapacityFunc func(n int) nvml.Return
|
||||||
|
|
||||||
|
// calls tracks calls to the methods.
|
||||||
|
calls struct {
|
||||||
|
// ClearAccountingPids holds details about calls to the ClearAccountingPids method.
|
||||||
|
ClearAccountingPids []struct {
|
||||||
|
}
|
||||||
|
// GetAccountingMode holds details about calls to the GetAccountingMode method.
|
||||||
|
GetAccountingMode []struct {
|
||||||
|
}
|
||||||
|
// GetAccountingPids holds details about calls to the GetAccountingPids method.
|
||||||
|
GetAccountingPids []struct {
|
||||||
|
}
|
||||||
|
// GetAccountingStats holds details about calls to the GetAccountingStats method.
|
||||||
|
GetAccountingStats []struct {
|
||||||
|
// N is the n argument value.
|
||||||
|
N int
|
||||||
|
}
|
||||||
|
// GetEccMode holds details about calls to the GetEccMode method.
|
||||||
|
GetEccMode []struct {
|
||||||
|
}
|
||||||
|
// GetEncoderCapacity holds details about calls to the GetEncoderCapacity method.
|
||||||
|
GetEncoderCapacity []struct {
|
||||||
|
}
|
||||||
|
// GetEncoderSessions holds details about calls to the GetEncoderSessions method.
|
||||||
|
GetEncoderSessions []struct {
|
||||||
|
}
|
||||||
|
// GetEncoderStats holds details about calls to the GetEncoderStats method.
|
||||||
|
GetEncoderStats []struct {
|
||||||
|
}
|
||||||
|
// GetFBCSessions holds details about calls to the GetFBCSessions method.
|
||||||
|
GetFBCSessions []struct {
|
||||||
|
}
|
||||||
|
// GetFBCStats holds details about calls to the GetFBCStats method.
|
||||||
|
GetFBCStats []struct {
|
||||||
|
}
|
||||||
|
// GetFbUsage holds details about calls to the GetFbUsage method.
|
||||||
|
GetFbUsage []struct {
|
||||||
|
}
|
||||||
|
// GetFrameRateLimit holds details about calls to the GetFrameRateLimit method.
|
||||||
|
GetFrameRateLimit []struct {
|
||||||
|
}
|
||||||
|
// GetGpuInstanceId holds details about calls to the GetGpuInstanceId method.
|
||||||
|
GetGpuInstanceId []struct {
|
||||||
|
}
|
||||||
|
// GetGpuPciId holds details about calls to the GetGpuPciId method.
|
||||||
|
GetGpuPciId []struct {
|
||||||
|
}
|
||||||
|
// GetLicenseInfo holds details about calls to the GetLicenseInfo method.
|
||||||
|
GetLicenseInfo []struct {
|
||||||
|
}
|
||||||
|
// GetLicenseStatus holds details about calls to the GetLicenseStatus method.
|
||||||
|
GetLicenseStatus []struct {
|
||||||
|
}
|
||||||
|
// GetMdevUUID holds details about calls to the GetMdevUUID method.
|
||||||
|
GetMdevUUID []struct {
|
||||||
|
}
|
||||||
|
// GetMetadata holds details about calls to the GetMetadata method.
|
||||||
|
GetMetadata []struct {
|
||||||
|
}
|
||||||
|
// GetType holds details about calls to the GetType method.
|
||||||
|
GetType []struct {
|
||||||
|
}
|
||||||
|
// GetUUID holds details about calls to the GetUUID method.
|
||||||
|
GetUUID []struct {
|
||||||
|
}
|
||||||
|
// GetVmDriverVersion holds details about calls to the GetVmDriverVersion method.
|
||||||
|
GetVmDriverVersion []struct {
|
||||||
|
}
|
||||||
|
// GetVmID holds details about calls to the GetVmID method.
|
||||||
|
GetVmID []struct {
|
||||||
|
}
|
||||||
|
// SetEncoderCapacity holds details about calls to the SetEncoderCapacity method.
|
||||||
|
SetEncoderCapacity []struct {
|
||||||
|
// N is the n argument value.
|
||||||
|
N int
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lockClearAccountingPids sync.RWMutex
|
||||||
|
lockGetAccountingMode sync.RWMutex
|
||||||
|
lockGetAccountingPids sync.RWMutex
|
||||||
|
lockGetAccountingStats sync.RWMutex
|
||||||
|
lockGetEccMode sync.RWMutex
|
||||||
|
lockGetEncoderCapacity sync.RWMutex
|
||||||
|
lockGetEncoderSessions sync.RWMutex
|
||||||
|
lockGetEncoderStats sync.RWMutex
|
||||||
|
lockGetFBCSessions sync.RWMutex
|
||||||
|
lockGetFBCStats sync.RWMutex
|
||||||
|
lockGetFbUsage sync.RWMutex
|
||||||
|
lockGetFrameRateLimit sync.RWMutex
|
||||||
|
lockGetGpuInstanceId sync.RWMutex
|
||||||
|
lockGetGpuPciId sync.RWMutex
|
||||||
|
lockGetLicenseInfo sync.RWMutex
|
||||||
|
lockGetLicenseStatus sync.RWMutex
|
||||||
|
lockGetMdevUUID sync.RWMutex
|
||||||
|
lockGetMetadata sync.RWMutex
|
||||||
|
lockGetType sync.RWMutex
|
||||||
|
lockGetUUID sync.RWMutex
|
||||||
|
lockGetVmDriverVersion sync.RWMutex
|
||||||
|
lockGetVmID sync.RWMutex
|
||||||
|
lockSetEncoderCapacity sync.RWMutex
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearAccountingPids calls ClearAccountingPidsFunc.
|
||||||
|
func (mock *VgpuInstance) ClearAccountingPids() nvml.Return {
|
||||||
|
if mock.ClearAccountingPidsFunc == nil {
|
||||||
|
panic("VgpuInstance.ClearAccountingPidsFunc: method is nil but VgpuInstance.ClearAccountingPids was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockClearAccountingPids.Lock()
|
||||||
|
mock.calls.ClearAccountingPids = append(mock.calls.ClearAccountingPids, callInfo)
|
||||||
|
mock.lockClearAccountingPids.Unlock()
|
||||||
|
return mock.ClearAccountingPidsFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearAccountingPidsCalls gets all the calls that were made to ClearAccountingPids.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.ClearAccountingPidsCalls())
|
||||||
|
func (mock *VgpuInstance) ClearAccountingPidsCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockClearAccountingPids.RLock()
|
||||||
|
calls = mock.calls.ClearAccountingPids
|
||||||
|
mock.lockClearAccountingPids.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetAccountingMode calls GetAccountingModeFunc.
|
||||||
|
func (mock *VgpuInstance) GetAccountingMode() (nvml.EnableState, nvml.Return) {
|
||||||
|
if mock.GetAccountingModeFunc == nil {
|
||||||
|
panic("VgpuInstance.GetAccountingModeFunc: method is nil but VgpuInstance.GetAccountingMode was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetAccountingMode.Lock()
|
||||||
|
mock.calls.GetAccountingMode = append(mock.calls.GetAccountingMode, callInfo)
|
||||||
|
mock.lockGetAccountingMode.Unlock()
|
||||||
|
return mock.GetAccountingModeFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetAccountingModeCalls gets all the calls that were made to GetAccountingMode.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetAccountingModeCalls())
|
||||||
|
func (mock *VgpuInstance) GetAccountingModeCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetAccountingMode.RLock()
|
||||||
|
calls = mock.calls.GetAccountingMode
|
||||||
|
mock.lockGetAccountingMode.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetAccountingPids calls GetAccountingPidsFunc.
|
||||||
|
func (mock *VgpuInstance) GetAccountingPids() ([]int, nvml.Return) {
|
||||||
|
if mock.GetAccountingPidsFunc == nil {
|
||||||
|
panic("VgpuInstance.GetAccountingPidsFunc: method is nil but VgpuInstance.GetAccountingPids was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetAccountingPids.Lock()
|
||||||
|
mock.calls.GetAccountingPids = append(mock.calls.GetAccountingPids, callInfo)
|
||||||
|
mock.lockGetAccountingPids.Unlock()
|
||||||
|
return mock.GetAccountingPidsFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetAccountingPidsCalls gets all the calls that were made to GetAccountingPids.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetAccountingPidsCalls())
|
||||||
|
func (mock *VgpuInstance) GetAccountingPidsCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetAccountingPids.RLock()
|
||||||
|
calls = mock.calls.GetAccountingPids
|
||||||
|
mock.lockGetAccountingPids.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetAccountingStats calls GetAccountingStatsFunc.
|
||||||
|
func (mock *VgpuInstance) GetAccountingStats(n int) (nvml.AccountingStats, nvml.Return) {
|
||||||
|
if mock.GetAccountingStatsFunc == nil {
|
||||||
|
panic("VgpuInstance.GetAccountingStatsFunc: method is nil but VgpuInstance.GetAccountingStats was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
N int
|
||||||
|
}{
|
||||||
|
N: n,
|
||||||
|
}
|
||||||
|
mock.lockGetAccountingStats.Lock()
|
||||||
|
mock.calls.GetAccountingStats = append(mock.calls.GetAccountingStats, callInfo)
|
||||||
|
mock.lockGetAccountingStats.Unlock()
|
||||||
|
return mock.GetAccountingStatsFunc(n)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetAccountingStatsCalls gets all the calls that were made to GetAccountingStats.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetAccountingStatsCalls())
|
||||||
|
func (mock *VgpuInstance) GetAccountingStatsCalls() []struct {
|
||||||
|
N int
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
N int
|
||||||
|
}
|
||||||
|
mock.lockGetAccountingStats.RLock()
|
||||||
|
calls = mock.calls.GetAccountingStats
|
||||||
|
mock.lockGetAccountingStats.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEccMode calls GetEccModeFunc.
|
||||||
|
func (mock *VgpuInstance) GetEccMode() (nvml.EnableState, nvml.Return) {
|
||||||
|
if mock.GetEccModeFunc == nil {
|
||||||
|
panic("VgpuInstance.GetEccModeFunc: method is nil but VgpuInstance.GetEccMode was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetEccMode.Lock()
|
||||||
|
mock.calls.GetEccMode = append(mock.calls.GetEccMode, callInfo)
|
||||||
|
mock.lockGetEccMode.Unlock()
|
||||||
|
return mock.GetEccModeFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEccModeCalls gets all the calls that were made to GetEccMode.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetEccModeCalls())
|
||||||
|
func (mock *VgpuInstance) GetEccModeCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetEccMode.RLock()
|
||||||
|
calls = mock.calls.GetEccMode
|
||||||
|
mock.lockGetEccMode.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEncoderCapacity calls GetEncoderCapacityFunc.
|
||||||
|
func (mock *VgpuInstance) GetEncoderCapacity() (int, nvml.Return) {
|
||||||
|
if mock.GetEncoderCapacityFunc == nil {
|
||||||
|
panic("VgpuInstance.GetEncoderCapacityFunc: method is nil but VgpuInstance.GetEncoderCapacity was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetEncoderCapacity.Lock()
|
||||||
|
mock.calls.GetEncoderCapacity = append(mock.calls.GetEncoderCapacity, callInfo)
|
||||||
|
mock.lockGetEncoderCapacity.Unlock()
|
||||||
|
return mock.GetEncoderCapacityFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEncoderCapacityCalls gets all the calls that were made to GetEncoderCapacity.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetEncoderCapacityCalls())
|
||||||
|
func (mock *VgpuInstance) GetEncoderCapacityCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetEncoderCapacity.RLock()
|
||||||
|
calls = mock.calls.GetEncoderCapacity
|
||||||
|
mock.lockGetEncoderCapacity.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEncoderSessions calls GetEncoderSessionsFunc.
|
||||||
|
func (mock *VgpuInstance) GetEncoderSessions() (int, nvml.EncoderSessionInfo, nvml.Return) {
|
||||||
|
if mock.GetEncoderSessionsFunc == nil {
|
||||||
|
panic("VgpuInstance.GetEncoderSessionsFunc: method is nil but VgpuInstance.GetEncoderSessions was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetEncoderSessions.Lock()
|
||||||
|
mock.calls.GetEncoderSessions = append(mock.calls.GetEncoderSessions, callInfo)
|
||||||
|
mock.lockGetEncoderSessions.Unlock()
|
||||||
|
return mock.GetEncoderSessionsFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEncoderSessionsCalls gets all the calls that were made to GetEncoderSessions.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetEncoderSessionsCalls())
|
||||||
|
func (mock *VgpuInstance) GetEncoderSessionsCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetEncoderSessions.RLock()
|
||||||
|
calls = mock.calls.GetEncoderSessions
|
||||||
|
mock.lockGetEncoderSessions.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEncoderStats calls GetEncoderStatsFunc.
|
||||||
|
func (mock *VgpuInstance) GetEncoderStats() (int, uint32, uint32, nvml.Return) {
|
||||||
|
if mock.GetEncoderStatsFunc == nil {
|
||||||
|
panic("VgpuInstance.GetEncoderStatsFunc: method is nil but VgpuInstance.GetEncoderStats was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetEncoderStats.Lock()
|
||||||
|
mock.calls.GetEncoderStats = append(mock.calls.GetEncoderStats, callInfo)
|
||||||
|
mock.lockGetEncoderStats.Unlock()
|
||||||
|
return mock.GetEncoderStatsFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEncoderStatsCalls gets all the calls that were made to GetEncoderStats.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetEncoderStatsCalls())
|
||||||
|
func (mock *VgpuInstance) GetEncoderStatsCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetEncoderStats.RLock()
|
||||||
|
calls = mock.calls.GetEncoderStats
|
||||||
|
mock.lockGetEncoderStats.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFBCSessions calls GetFBCSessionsFunc.
|
||||||
|
func (mock *VgpuInstance) GetFBCSessions() (int, nvml.FBCSessionInfo, nvml.Return) {
|
||||||
|
if mock.GetFBCSessionsFunc == nil {
|
||||||
|
panic("VgpuInstance.GetFBCSessionsFunc: method is nil but VgpuInstance.GetFBCSessions was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetFBCSessions.Lock()
|
||||||
|
mock.calls.GetFBCSessions = append(mock.calls.GetFBCSessions, callInfo)
|
||||||
|
mock.lockGetFBCSessions.Unlock()
|
||||||
|
return mock.GetFBCSessionsFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFBCSessionsCalls gets all the calls that were made to GetFBCSessions.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetFBCSessionsCalls())
|
||||||
|
func (mock *VgpuInstance) GetFBCSessionsCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetFBCSessions.RLock()
|
||||||
|
calls = mock.calls.GetFBCSessions
|
||||||
|
mock.lockGetFBCSessions.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFBCStats calls GetFBCStatsFunc.
|
||||||
|
func (mock *VgpuInstance) GetFBCStats() (nvml.FBCStats, nvml.Return) {
|
||||||
|
if mock.GetFBCStatsFunc == nil {
|
||||||
|
panic("VgpuInstance.GetFBCStatsFunc: method is nil but VgpuInstance.GetFBCStats was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetFBCStats.Lock()
|
||||||
|
mock.calls.GetFBCStats = append(mock.calls.GetFBCStats, callInfo)
|
||||||
|
mock.lockGetFBCStats.Unlock()
|
||||||
|
return mock.GetFBCStatsFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFBCStatsCalls gets all the calls that were made to GetFBCStats.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetFBCStatsCalls())
|
||||||
|
func (mock *VgpuInstance) GetFBCStatsCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetFBCStats.RLock()
|
||||||
|
calls = mock.calls.GetFBCStats
|
||||||
|
mock.lockGetFBCStats.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFbUsage calls GetFbUsageFunc.
|
||||||
|
func (mock *VgpuInstance) GetFbUsage() (uint64, nvml.Return) {
|
||||||
|
if mock.GetFbUsageFunc == nil {
|
||||||
|
panic("VgpuInstance.GetFbUsageFunc: method is nil but VgpuInstance.GetFbUsage was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetFbUsage.Lock()
|
||||||
|
mock.calls.GetFbUsage = append(mock.calls.GetFbUsage, callInfo)
|
||||||
|
mock.lockGetFbUsage.Unlock()
|
||||||
|
return mock.GetFbUsageFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFbUsageCalls gets all the calls that were made to GetFbUsage.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetFbUsageCalls())
|
||||||
|
func (mock *VgpuInstance) GetFbUsageCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetFbUsage.RLock()
|
||||||
|
calls = mock.calls.GetFbUsage
|
||||||
|
mock.lockGetFbUsage.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFrameRateLimit calls GetFrameRateLimitFunc.
|
||||||
|
func (mock *VgpuInstance) GetFrameRateLimit() (uint32, nvml.Return) {
|
||||||
|
if mock.GetFrameRateLimitFunc == nil {
|
||||||
|
panic("VgpuInstance.GetFrameRateLimitFunc: method is nil but VgpuInstance.GetFrameRateLimit was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetFrameRateLimit.Lock()
|
||||||
|
mock.calls.GetFrameRateLimit = append(mock.calls.GetFrameRateLimit, callInfo)
|
||||||
|
mock.lockGetFrameRateLimit.Unlock()
|
||||||
|
return mock.GetFrameRateLimitFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFrameRateLimitCalls gets all the calls that were made to GetFrameRateLimit.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetFrameRateLimitCalls())
|
||||||
|
func (mock *VgpuInstance) GetFrameRateLimitCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetFrameRateLimit.RLock()
|
||||||
|
calls = mock.calls.GetFrameRateLimit
|
||||||
|
mock.lockGetFrameRateLimit.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetGpuInstanceId calls GetGpuInstanceIdFunc.
|
||||||
|
func (mock *VgpuInstance) GetGpuInstanceId() (int, nvml.Return) {
|
||||||
|
if mock.GetGpuInstanceIdFunc == nil {
|
||||||
|
panic("VgpuInstance.GetGpuInstanceIdFunc: method is nil but VgpuInstance.GetGpuInstanceId was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetGpuInstanceId.Lock()
|
||||||
|
mock.calls.GetGpuInstanceId = append(mock.calls.GetGpuInstanceId, callInfo)
|
||||||
|
mock.lockGetGpuInstanceId.Unlock()
|
||||||
|
return mock.GetGpuInstanceIdFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetGpuInstanceIdCalls gets all the calls that were made to GetGpuInstanceId.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetGpuInstanceIdCalls())
|
||||||
|
func (mock *VgpuInstance) GetGpuInstanceIdCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetGpuInstanceId.RLock()
|
||||||
|
calls = mock.calls.GetGpuInstanceId
|
||||||
|
mock.lockGetGpuInstanceId.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetGpuPciId calls GetGpuPciIdFunc.
|
||||||
|
func (mock *VgpuInstance) GetGpuPciId() (string, nvml.Return) {
|
||||||
|
if mock.GetGpuPciIdFunc == nil {
|
||||||
|
panic("VgpuInstance.GetGpuPciIdFunc: method is nil but VgpuInstance.GetGpuPciId was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetGpuPciId.Lock()
|
||||||
|
mock.calls.GetGpuPciId = append(mock.calls.GetGpuPciId, callInfo)
|
||||||
|
mock.lockGetGpuPciId.Unlock()
|
||||||
|
return mock.GetGpuPciIdFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetGpuPciIdCalls gets all the calls that were made to GetGpuPciId.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetGpuPciIdCalls())
|
||||||
|
func (mock *VgpuInstance) GetGpuPciIdCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetGpuPciId.RLock()
|
||||||
|
calls = mock.calls.GetGpuPciId
|
||||||
|
mock.lockGetGpuPciId.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLicenseInfo calls GetLicenseInfoFunc.
|
||||||
|
func (mock *VgpuInstance) GetLicenseInfo() (nvml.VgpuLicenseInfo, nvml.Return) {
|
||||||
|
if mock.GetLicenseInfoFunc == nil {
|
||||||
|
panic("VgpuInstance.GetLicenseInfoFunc: method is nil but VgpuInstance.GetLicenseInfo was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetLicenseInfo.Lock()
|
||||||
|
mock.calls.GetLicenseInfo = append(mock.calls.GetLicenseInfo, callInfo)
|
||||||
|
mock.lockGetLicenseInfo.Unlock()
|
||||||
|
return mock.GetLicenseInfoFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLicenseInfoCalls gets all the calls that were made to GetLicenseInfo.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetLicenseInfoCalls())
|
||||||
|
func (mock *VgpuInstance) GetLicenseInfoCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetLicenseInfo.RLock()
|
||||||
|
calls = mock.calls.GetLicenseInfo
|
||||||
|
mock.lockGetLicenseInfo.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLicenseStatus calls GetLicenseStatusFunc.
|
||||||
|
func (mock *VgpuInstance) GetLicenseStatus() (int, nvml.Return) {
|
||||||
|
if mock.GetLicenseStatusFunc == nil {
|
||||||
|
panic("VgpuInstance.GetLicenseStatusFunc: method is nil but VgpuInstance.GetLicenseStatus was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetLicenseStatus.Lock()
|
||||||
|
mock.calls.GetLicenseStatus = append(mock.calls.GetLicenseStatus, callInfo)
|
||||||
|
mock.lockGetLicenseStatus.Unlock()
|
||||||
|
return mock.GetLicenseStatusFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLicenseStatusCalls gets all the calls that were made to GetLicenseStatus.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetLicenseStatusCalls())
|
||||||
|
func (mock *VgpuInstance) GetLicenseStatusCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetLicenseStatus.RLock()
|
||||||
|
calls = mock.calls.GetLicenseStatus
|
||||||
|
mock.lockGetLicenseStatus.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMdevUUID calls GetMdevUUIDFunc.
|
||||||
|
func (mock *VgpuInstance) GetMdevUUID() (string, nvml.Return) {
|
||||||
|
if mock.GetMdevUUIDFunc == nil {
|
||||||
|
panic("VgpuInstance.GetMdevUUIDFunc: method is nil but VgpuInstance.GetMdevUUID was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetMdevUUID.Lock()
|
||||||
|
mock.calls.GetMdevUUID = append(mock.calls.GetMdevUUID, callInfo)
|
||||||
|
mock.lockGetMdevUUID.Unlock()
|
||||||
|
return mock.GetMdevUUIDFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMdevUUIDCalls gets all the calls that were made to GetMdevUUID.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetMdevUUIDCalls())
|
||||||
|
func (mock *VgpuInstance) GetMdevUUIDCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetMdevUUID.RLock()
|
||||||
|
calls = mock.calls.GetMdevUUID
|
||||||
|
mock.lockGetMdevUUID.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMetadata calls GetMetadataFunc.
|
||||||
|
func (mock *VgpuInstance) GetMetadata() (nvml.VgpuMetadata, nvml.Return) {
|
||||||
|
if mock.GetMetadataFunc == nil {
|
||||||
|
panic("VgpuInstance.GetMetadataFunc: method is nil but VgpuInstance.GetMetadata was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetMetadata.Lock()
|
||||||
|
mock.calls.GetMetadata = append(mock.calls.GetMetadata, callInfo)
|
||||||
|
mock.lockGetMetadata.Unlock()
|
||||||
|
return mock.GetMetadataFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMetadataCalls gets all the calls that were made to GetMetadata.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetMetadataCalls())
|
||||||
|
func (mock *VgpuInstance) GetMetadataCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetMetadata.RLock()
|
||||||
|
calls = mock.calls.GetMetadata
|
||||||
|
mock.lockGetMetadata.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetType calls GetTypeFunc.
|
||||||
|
func (mock *VgpuInstance) GetType() (nvml.VgpuTypeId, nvml.Return) {
|
||||||
|
if mock.GetTypeFunc == nil {
|
||||||
|
panic("VgpuInstance.GetTypeFunc: method is nil but VgpuInstance.GetType was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetType.Lock()
|
||||||
|
mock.calls.GetType = append(mock.calls.GetType, callInfo)
|
||||||
|
mock.lockGetType.Unlock()
|
||||||
|
return mock.GetTypeFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTypeCalls gets all the calls that were made to GetType.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetTypeCalls())
|
||||||
|
func (mock *VgpuInstance) GetTypeCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetType.RLock()
|
||||||
|
calls = mock.calls.GetType
|
||||||
|
mock.lockGetType.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUUID calls GetUUIDFunc.
|
||||||
|
func (mock *VgpuInstance) GetUUID() (string, nvml.Return) {
|
||||||
|
if mock.GetUUIDFunc == nil {
|
||||||
|
panic("VgpuInstance.GetUUIDFunc: method is nil but VgpuInstance.GetUUID was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetUUID.Lock()
|
||||||
|
mock.calls.GetUUID = append(mock.calls.GetUUID, callInfo)
|
||||||
|
mock.lockGetUUID.Unlock()
|
||||||
|
return mock.GetUUIDFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUUIDCalls gets all the calls that were made to GetUUID.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetUUIDCalls())
|
||||||
|
func (mock *VgpuInstance) GetUUIDCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetUUID.RLock()
|
||||||
|
calls = mock.calls.GetUUID
|
||||||
|
mock.lockGetUUID.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetVmDriverVersion calls GetVmDriverVersionFunc.
|
||||||
|
func (mock *VgpuInstance) GetVmDriverVersion() (string, nvml.Return) {
|
||||||
|
if mock.GetVmDriverVersionFunc == nil {
|
||||||
|
panic("VgpuInstance.GetVmDriverVersionFunc: method is nil but VgpuInstance.GetVmDriverVersion was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetVmDriverVersion.Lock()
|
||||||
|
mock.calls.GetVmDriverVersion = append(mock.calls.GetVmDriverVersion, callInfo)
|
||||||
|
mock.lockGetVmDriverVersion.Unlock()
|
||||||
|
return mock.GetVmDriverVersionFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetVmDriverVersionCalls gets all the calls that were made to GetVmDriverVersion.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetVmDriverVersionCalls())
|
||||||
|
func (mock *VgpuInstance) GetVmDriverVersionCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetVmDriverVersion.RLock()
|
||||||
|
calls = mock.calls.GetVmDriverVersion
|
||||||
|
mock.lockGetVmDriverVersion.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetVmID calls GetVmIDFunc.
|
||||||
|
func (mock *VgpuInstance) GetVmID() (string, nvml.VgpuVmIdType, nvml.Return) {
|
||||||
|
if mock.GetVmIDFunc == nil {
|
||||||
|
panic("VgpuInstance.GetVmIDFunc: method is nil but VgpuInstance.GetVmID was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetVmID.Lock()
|
||||||
|
mock.calls.GetVmID = append(mock.calls.GetVmID, callInfo)
|
||||||
|
mock.lockGetVmID.Unlock()
|
||||||
|
return mock.GetVmIDFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetVmIDCalls gets all the calls that were made to GetVmID.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.GetVmIDCalls())
|
||||||
|
func (mock *VgpuInstance) GetVmIDCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetVmID.RLock()
|
||||||
|
calls = mock.calls.GetVmID
|
||||||
|
mock.lockGetVmID.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetEncoderCapacity calls SetEncoderCapacityFunc.
|
||||||
|
func (mock *VgpuInstance) SetEncoderCapacity(n int) nvml.Return {
|
||||||
|
if mock.SetEncoderCapacityFunc == nil {
|
||||||
|
panic("VgpuInstance.SetEncoderCapacityFunc: method is nil but VgpuInstance.SetEncoderCapacity was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
N int
|
||||||
|
}{
|
||||||
|
N: n,
|
||||||
|
}
|
||||||
|
mock.lockSetEncoderCapacity.Lock()
|
||||||
|
mock.calls.SetEncoderCapacity = append(mock.calls.SetEncoderCapacity, callInfo)
|
||||||
|
mock.lockSetEncoderCapacity.Unlock()
|
||||||
|
return mock.SetEncoderCapacityFunc(n)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetEncoderCapacityCalls gets all the calls that were made to SetEncoderCapacity.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuInstance.SetEncoderCapacityCalls())
|
||||||
|
func (mock *VgpuInstance) SetEncoderCapacityCalls() []struct {
|
||||||
|
N int
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
N int
|
||||||
|
}
|
||||||
|
mock.lockSetEncoderCapacity.RLock()
|
||||||
|
calls = mock.calls.SetEncoderCapacity
|
||||||
|
mock.lockSetEncoderCapacity.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
496
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/vgputypeid.go
generated
vendored
Normal file
496
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/vgputypeid.go
generated
vendored
Normal file
@ -0,0 +1,496 @@
|
|||||||
|
// Code generated by moq; DO NOT EDIT.
|
||||||
|
// github.com/matryer/moq
|
||||||
|
|
||||||
|
package mock
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Ensure, that VgpuTypeId does implement nvml.VgpuTypeId.
|
||||||
|
// If this is not the case, regenerate this file with moq.
|
||||||
|
var _ nvml.VgpuTypeId = &VgpuTypeId{}
|
||||||
|
|
||||||
|
// VgpuTypeId is a mock implementation of nvml.VgpuTypeId.
|
||||||
|
//
|
||||||
|
// func TestSomethingThatUsesVgpuTypeId(t *testing.T) {
|
||||||
|
//
|
||||||
|
// // make and configure a mocked nvml.VgpuTypeId
|
||||||
|
// mockedVgpuTypeId := &VgpuTypeId{
|
||||||
|
// GetCapabilitiesFunc: func(vgpuCapability nvml.VgpuCapability) (bool, nvml.Return) {
|
||||||
|
// panic("mock out the GetCapabilities method")
|
||||||
|
// },
|
||||||
|
// GetClassFunc: func() (string, nvml.Return) {
|
||||||
|
// panic("mock out the GetClass method")
|
||||||
|
// },
|
||||||
|
// GetDeviceIDFunc: func() (uint64, uint64, nvml.Return) {
|
||||||
|
// panic("mock out the GetDeviceID method")
|
||||||
|
// },
|
||||||
|
// GetFrameRateLimitFunc: func() (uint32, nvml.Return) {
|
||||||
|
// panic("mock out the GetFrameRateLimit method")
|
||||||
|
// },
|
||||||
|
// GetFramebufferSizeFunc: func() (uint64, nvml.Return) {
|
||||||
|
// panic("mock out the GetFramebufferSize method")
|
||||||
|
// },
|
||||||
|
// GetGpuInstanceProfileIdFunc: func() (uint32, nvml.Return) {
|
||||||
|
// panic("mock out the GetGpuInstanceProfileId method")
|
||||||
|
// },
|
||||||
|
// GetLicenseFunc: func() (string, nvml.Return) {
|
||||||
|
// panic("mock out the GetLicense method")
|
||||||
|
// },
|
||||||
|
// GetMaxInstancesFunc: func(device nvml.Device) (int, nvml.Return) {
|
||||||
|
// panic("mock out the GetMaxInstances method")
|
||||||
|
// },
|
||||||
|
// GetMaxInstancesPerVmFunc: func() (int, nvml.Return) {
|
||||||
|
// panic("mock out the GetMaxInstancesPerVm method")
|
||||||
|
// },
|
||||||
|
// GetNameFunc: func() (string, nvml.Return) {
|
||||||
|
// panic("mock out the GetName method")
|
||||||
|
// },
|
||||||
|
// GetNumDisplayHeadsFunc: func() (int, nvml.Return) {
|
||||||
|
// panic("mock out the GetNumDisplayHeads method")
|
||||||
|
// },
|
||||||
|
// GetResolutionFunc: func(n int) (uint32, uint32, nvml.Return) {
|
||||||
|
// panic("mock out the GetResolution method")
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // use mockedVgpuTypeId in code that requires nvml.VgpuTypeId
|
||||||
|
// // and then make assertions.
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
type VgpuTypeId struct {
|
||||||
|
// GetCapabilitiesFunc mocks the GetCapabilities method.
|
||||||
|
GetCapabilitiesFunc func(vgpuCapability nvml.VgpuCapability) (bool, nvml.Return)
|
||||||
|
|
||||||
|
// GetClassFunc mocks the GetClass method.
|
||||||
|
GetClassFunc func() (string, nvml.Return)
|
||||||
|
|
||||||
|
// GetDeviceIDFunc mocks the GetDeviceID method.
|
||||||
|
GetDeviceIDFunc func() (uint64, uint64, nvml.Return)
|
||||||
|
|
||||||
|
// GetFrameRateLimitFunc mocks the GetFrameRateLimit method.
|
||||||
|
GetFrameRateLimitFunc func() (uint32, nvml.Return)
|
||||||
|
|
||||||
|
// GetFramebufferSizeFunc mocks the GetFramebufferSize method.
|
||||||
|
GetFramebufferSizeFunc func() (uint64, nvml.Return)
|
||||||
|
|
||||||
|
// GetGpuInstanceProfileIdFunc mocks the GetGpuInstanceProfileId method.
|
||||||
|
GetGpuInstanceProfileIdFunc func() (uint32, nvml.Return)
|
||||||
|
|
||||||
|
// GetLicenseFunc mocks the GetLicense method.
|
||||||
|
GetLicenseFunc func() (string, nvml.Return)
|
||||||
|
|
||||||
|
// GetMaxInstancesFunc mocks the GetMaxInstances method.
|
||||||
|
GetMaxInstancesFunc func(device nvml.Device) (int, nvml.Return)
|
||||||
|
|
||||||
|
// GetMaxInstancesPerVmFunc mocks the GetMaxInstancesPerVm method.
|
||||||
|
GetMaxInstancesPerVmFunc func() (int, nvml.Return)
|
||||||
|
|
||||||
|
// GetNameFunc mocks the GetName method.
|
||||||
|
GetNameFunc func() (string, nvml.Return)
|
||||||
|
|
||||||
|
// GetNumDisplayHeadsFunc mocks the GetNumDisplayHeads method.
|
||||||
|
GetNumDisplayHeadsFunc func() (int, nvml.Return)
|
||||||
|
|
||||||
|
// GetResolutionFunc mocks the GetResolution method.
|
||||||
|
GetResolutionFunc func(n int) (uint32, uint32, nvml.Return)
|
||||||
|
|
||||||
|
// calls tracks calls to the methods.
|
||||||
|
calls struct {
|
||||||
|
// GetCapabilities holds details about calls to the GetCapabilities method.
|
||||||
|
GetCapabilities []struct {
|
||||||
|
// VgpuCapability is the vgpuCapability argument value.
|
||||||
|
VgpuCapability nvml.VgpuCapability
|
||||||
|
}
|
||||||
|
// GetClass holds details about calls to the GetClass method.
|
||||||
|
GetClass []struct {
|
||||||
|
}
|
||||||
|
// GetDeviceID holds details about calls to the GetDeviceID method.
|
||||||
|
GetDeviceID []struct {
|
||||||
|
}
|
||||||
|
// GetFrameRateLimit holds details about calls to the GetFrameRateLimit method.
|
||||||
|
GetFrameRateLimit []struct {
|
||||||
|
}
|
||||||
|
// GetFramebufferSize holds details about calls to the GetFramebufferSize method.
|
||||||
|
GetFramebufferSize []struct {
|
||||||
|
}
|
||||||
|
// GetGpuInstanceProfileId holds details about calls to the GetGpuInstanceProfileId method.
|
||||||
|
GetGpuInstanceProfileId []struct {
|
||||||
|
}
|
||||||
|
// GetLicense holds details about calls to the GetLicense method.
|
||||||
|
GetLicense []struct {
|
||||||
|
}
|
||||||
|
// GetMaxInstances holds details about calls to the GetMaxInstances method.
|
||||||
|
GetMaxInstances []struct {
|
||||||
|
// Device is the device argument value.
|
||||||
|
Device nvml.Device
|
||||||
|
}
|
||||||
|
// GetMaxInstancesPerVm holds details about calls to the GetMaxInstancesPerVm method.
|
||||||
|
GetMaxInstancesPerVm []struct {
|
||||||
|
}
|
||||||
|
// GetName holds details about calls to the GetName method.
|
||||||
|
GetName []struct {
|
||||||
|
}
|
||||||
|
// GetNumDisplayHeads holds details about calls to the GetNumDisplayHeads method.
|
||||||
|
GetNumDisplayHeads []struct {
|
||||||
|
}
|
||||||
|
// GetResolution holds details about calls to the GetResolution method.
|
||||||
|
GetResolution []struct {
|
||||||
|
// N is the n argument value.
|
||||||
|
N int
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lockGetCapabilities sync.RWMutex
|
||||||
|
lockGetClass sync.RWMutex
|
||||||
|
lockGetDeviceID sync.RWMutex
|
||||||
|
lockGetFrameRateLimit sync.RWMutex
|
||||||
|
lockGetFramebufferSize sync.RWMutex
|
||||||
|
lockGetGpuInstanceProfileId sync.RWMutex
|
||||||
|
lockGetLicense sync.RWMutex
|
||||||
|
lockGetMaxInstances sync.RWMutex
|
||||||
|
lockGetMaxInstancesPerVm sync.RWMutex
|
||||||
|
lockGetName sync.RWMutex
|
||||||
|
lockGetNumDisplayHeads sync.RWMutex
|
||||||
|
lockGetResolution sync.RWMutex
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCapabilities calls GetCapabilitiesFunc.
|
||||||
|
func (mock *VgpuTypeId) GetCapabilities(vgpuCapability nvml.VgpuCapability) (bool, nvml.Return) {
|
||||||
|
if mock.GetCapabilitiesFunc == nil {
|
||||||
|
panic("VgpuTypeId.GetCapabilitiesFunc: method is nil but VgpuTypeId.GetCapabilities was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
VgpuCapability nvml.VgpuCapability
|
||||||
|
}{
|
||||||
|
VgpuCapability: vgpuCapability,
|
||||||
|
}
|
||||||
|
mock.lockGetCapabilities.Lock()
|
||||||
|
mock.calls.GetCapabilities = append(mock.calls.GetCapabilities, callInfo)
|
||||||
|
mock.lockGetCapabilities.Unlock()
|
||||||
|
return mock.GetCapabilitiesFunc(vgpuCapability)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCapabilitiesCalls gets all the calls that were made to GetCapabilities.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuTypeId.GetCapabilitiesCalls())
|
||||||
|
func (mock *VgpuTypeId) GetCapabilitiesCalls() []struct {
|
||||||
|
VgpuCapability nvml.VgpuCapability
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
VgpuCapability nvml.VgpuCapability
|
||||||
|
}
|
||||||
|
mock.lockGetCapabilities.RLock()
|
||||||
|
calls = mock.calls.GetCapabilities
|
||||||
|
mock.lockGetCapabilities.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetClass calls GetClassFunc.
|
||||||
|
func (mock *VgpuTypeId) GetClass() (string, nvml.Return) {
|
||||||
|
if mock.GetClassFunc == nil {
|
||||||
|
panic("VgpuTypeId.GetClassFunc: method is nil but VgpuTypeId.GetClass was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetClass.Lock()
|
||||||
|
mock.calls.GetClass = append(mock.calls.GetClass, callInfo)
|
||||||
|
mock.lockGetClass.Unlock()
|
||||||
|
return mock.GetClassFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetClassCalls gets all the calls that were made to GetClass.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuTypeId.GetClassCalls())
|
||||||
|
func (mock *VgpuTypeId) GetClassCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetClass.RLock()
|
||||||
|
calls = mock.calls.GetClass
|
||||||
|
mock.lockGetClass.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDeviceID calls GetDeviceIDFunc.
|
||||||
|
func (mock *VgpuTypeId) GetDeviceID() (uint64, uint64, nvml.Return) {
|
||||||
|
if mock.GetDeviceIDFunc == nil {
|
||||||
|
panic("VgpuTypeId.GetDeviceIDFunc: method is nil but VgpuTypeId.GetDeviceID was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetDeviceID.Lock()
|
||||||
|
mock.calls.GetDeviceID = append(mock.calls.GetDeviceID, callInfo)
|
||||||
|
mock.lockGetDeviceID.Unlock()
|
||||||
|
return mock.GetDeviceIDFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDeviceIDCalls gets all the calls that were made to GetDeviceID.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuTypeId.GetDeviceIDCalls())
|
||||||
|
func (mock *VgpuTypeId) GetDeviceIDCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetDeviceID.RLock()
|
||||||
|
calls = mock.calls.GetDeviceID
|
||||||
|
mock.lockGetDeviceID.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFrameRateLimit calls GetFrameRateLimitFunc.
|
||||||
|
func (mock *VgpuTypeId) GetFrameRateLimit() (uint32, nvml.Return) {
|
||||||
|
if mock.GetFrameRateLimitFunc == nil {
|
||||||
|
panic("VgpuTypeId.GetFrameRateLimitFunc: method is nil but VgpuTypeId.GetFrameRateLimit was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetFrameRateLimit.Lock()
|
||||||
|
mock.calls.GetFrameRateLimit = append(mock.calls.GetFrameRateLimit, callInfo)
|
||||||
|
mock.lockGetFrameRateLimit.Unlock()
|
||||||
|
return mock.GetFrameRateLimitFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFrameRateLimitCalls gets all the calls that were made to GetFrameRateLimit.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuTypeId.GetFrameRateLimitCalls())
|
||||||
|
func (mock *VgpuTypeId) GetFrameRateLimitCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetFrameRateLimit.RLock()
|
||||||
|
calls = mock.calls.GetFrameRateLimit
|
||||||
|
mock.lockGetFrameRateLimit.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFramebufferSize calls GetFramebufferSizeFunc.
|
||||||
|
func (mock *VgpuTypeId) GetFramebufferSize() (uint64, nvml.Return) {
|
||||||
|
if mock.GetFramebufferSizeFunc == nil {
|
||||||
|
panic("VgpuTypeId.GetFramebufferSizeFunc: method is nil but VgpuTypeId.GetFramebufferSize was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetFramebufferSize.Lock()
|
||||||
|
mock.calls.GetFramebufferSize = append(mock.calls.GetFramebufferSize, callInfo)
|
||||||
|
mock.lockGetFramebufferSize.Unlock()
|
||||||
|
return mock.GetFramebufferSizeFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFramebufferSizeCalls gets all the calls that were made to GetFramebufferSize.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuTypeId.GetFramebufferSizeCalls())
|
||||||
|
func (mock *VgpuTypeId) GetFramebufferSizeCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetFramebufferSize.RLock()
|
||||||
|
calls = mock.calls.GetFramebufferSize
|
||||||
|
mock.lockGetFramebufferSize.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetGpuInstanceProfileId calls GetGpuInstanceProfileIdFunc.
|
||||||
|
func (mock *VgpuTypeId) GetGpuInstanceProfileId() (uint32, nvml.Return) {
|
||||||
|
if mock.GetGpuInstanceProfileIdFunc == nil {
|
||||||
|
panic("VgpuTypeId.GetGpuInstanceProfileIdFunc: method is nil but VgpuTypeId.GetGpuInstanceProfileId was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetGpuInstanceProfileId.Lock()
|
||||||
|
mock.calls.GetGpuInstanceProfileId = append(mock.calls.GetGpuInstanceProfileId, callInfo)
|
||||||
|
mock.lockGetGpuInstanceProfileId.Unlock()
|
||||||
|
return mock.GetGpuInstanceProfileIdFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetGpuInstanceProfileIdCalls gets all the calls that were made to GetGpuInstanceProfileId.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuTypeId.GetGpuInstanceProfileIdCalls())
|
||||||
|
func (mock *VgpuTypeId) GetGpuInstanceProfileIdCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetGpuInstanceProfileId.RLock()
|
||||||
|
calls = mock.calls.GetGpuInstanceProfileId
|
||||||
|
mock.lockGetGpuInstanceProfileId.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLicense calls GetLicenseFunc.
|
||||||
|
func (mock *VgpuTypeId) GetLicense() (string, nvml.Return) {
|
||||||
|
if mock.GetLicenseFunc == nil {
|
||||||
|
panic("VgpuTypeId.GetLicenseFunc: method is nil but VgpuTypeId.GetLicense was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetLicense.Lock()
|
||||||
|
mock.calls.GetLicense = append(mock.calls.GetLicense, callInfo)
|
||||||
|
mock.lockGetLicense.Unlock()
|
||||||
|
return mock.GetLicenseFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLicenseCalls gets all the calls that were made to GetLicense.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuTypeId.GetLicenseCalls())
|
||||||
|
func (mock *VgpuTypeId) GetLicenseCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetLicense.RLock()
|
||||||
|
calls = mock.calls.GetLicense
|
||||||
|
mock.lockGetLicense.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMaxInstances calls GetMaxInstancesFunc.
|
||||||
|
func (mock *VgpuTypeId) GetMaxInstances(device nvml.Device) (int, nvml.Return) {
|
||||||
|
if mock.GetMaxInstancesFunc == nil {
|
||||||
|
panic("VgpuTypeId.GetMaxInstancesFunc: method is nil but VgpuTypeId.GetMaxInstances was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
Device nvml.Device
|
||||||
|
}{
|
||||||
|
Device: device,
|
||||||
|
}
|
||||||
|
mock.lockGetMaxInstances.Lock()
|
||||||
|
mock.calls.GetMaxInstances = append(mock.calls.GetMaxInstances, callInfo)
|
||||||
|
mock.lockGetMaxInstances.Unlock()
|
||||||
|
return mock.GetMaxInstancesFunc(device)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMaxInstancesCalls gets all the calls that were made to GetMaxInstances.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuTypeId.GetMaxInstancesCalls())
|
||||||
|
func (mock *VgpuTypeId) GetMaxInstancesCalls() []struct {
|
||||||
|
Device nvml.Device
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
Device nvml.Device
|
||||||
|
}
|
||||||
|
mock.lockGetMaxInstances.RLock()
|
||||||
|
calls = mock.calls.GetMaxInstances
|
||||||
|
mock.lockGetMaxInstances.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMaxInstancesPerVm calls GetMaxInstancesPerVmFunc.
|
||||||
|
func (mock *VgpuTypeId) GetMaxInstancesPerVm() (int, nvml.Return) {
|
||||||
|
if mock.GetMaxInstancesPerVmFunc == nil {
|
||||||
|
panic("VgpuTypeId.GetMaxInstancesPerVmFunc: method is nil but VgpuTypeId.GetMaxInstancesPerVm was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetMaxInstancesPerVm.Lock()
|
||||||
|
mock.calls.GetMaxInstancesPerVm = append(mock.calls.GetMaxInstancesPerVm, callInfo)
|
||||||
|
mock.lockGetMaxInstancesPerVm.Unlock()
|
||||||
|
return mock.GetMaxInstancesPerVmFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMaxInstancesPerVmCalls gets all the calls that were made to GetMaxInstancesPerVm.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuTypeId.GetMaxInstancesPerVmCalls())
|
||||||
|
func (mock *VgpuTypeId) GetMaxInstancesPerVmCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetMaxInstancesPerVm.RLock()
|
||||||
|
calls = mock.calls.GetMaxInstancesPerVm
|
||||||
|
mock.lockGetMaxInstancesPerVm.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetName calls GetNameFunc.
|
||||||
|
func (mock *VgpuTypeId) GetName() (string, nvml.Return) {
|
||||||
|
if mock.GetNameFunc == nil {
|
||||||
|
panic("VgpuTypeId.GetNameFunc: method is nil but VgpuTypeId.GetName was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetName.Lock()
|
||||||
|
mock.calls.GetName = append(mock.calls.GetName, callInfo)
|
||||||
|
mock.lockGetName.Unlock()
|
||||||
|
return mock.GetNameFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetNameCalls gets all the calls that were made to GetName.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuTypeId.GetNameCalls())
|
||||||
|
func (mock *VgpuTypeId) GetNameCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetName.RLock()
|
||||||
|
calls = mock.calls.GetName
|
||||||
|
mock.lockGetName.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetNumDisplayHeads calls GetNumDisplayHeadsFunc.
|
||||||
|
func (mock *VgpuTypeId) GetNumDisplayHeads() (int, nvml.Return) {
|
||||||
|
if mock.GetNumDisplayHeadsFunc == nil {
|
||||||
|
panic("VgpuTypeId.GetNumDisplayHeadsFunc: method is nil but VgpuTypeId.GetNumDisplayHeads was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
}{}
|
||||||
|
mock.lockGetNumDisplayHeads.Lock()
|
||||||
|
mock.calls.GetNumDisplayHeads = append(mock.calls.GetNumDisplayHeads, callInfo)
|
||||||
|
mock.lockGetNumDisplayHeads.Unlock()
|
||||||
|
return mock.GetNumDisplayHeadsFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetNumDisplayHeadsCalls gets all the calls that were made to GetNumDisplayHeads.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuTypeId.GetNumDisplayHeadsCalls())
|
||||||
|
func (mock *VgpuTypeId) GetNumDisplayHeadsCalls() []struct {
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
}
|
||||||
|
mock.lockGetNumDisplayHeads.RLock()
|
||||||
|
calls = mock.calls.GetNumDisplayHeads
|
||||||
|
mock.lockGetNumDisplayHeads.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResolution calls GetResolutionFunc.
|
||||||
|
func (mock *VgpuTypeId) GetResolution(n int) (uint32, uint32, nvml.Return) {
|
||||||
|
if mock.GetResolutionFunc == nil {
|
||||||
|
panic("VgpuTypeId.GetResolutionFunc: method is nil but VgpuTypeId.GetResolution was just called")
|
||||||
|
}
|
||||||
|
callInfo := struct {
|
||||||
|
N int
|
||||||
|
}{
|
||||||
|
N: n,
|
||||||
|
}
|
||||||
|
mock.lockGetResolution.Lock()
|
||||||
|
mock.calls.GetResolution = append(mock.calls.GetResolution, callInfo)
|
||||||
|
mock.lockGetResolution.Unlock()
|
||||||
|
return mock.GetResolutionFunc(n)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResolutionCalls gets all the calls that were made to GetResolution.
|
||||||
|
// Check the length with:
|
||||||
|
//
|
||||||
|
// len(mockedVgpuTypeId.GetResolutionCalls())
|
||||||
|
func (mock *VgpuTypeId) GetResolutionCalls() []struct {
|
||||||
|
N int
|
||||||
|
} {
|
||||||
|
var calls []struct {
|
||||||
|
N int
|
||||||
|
}
|
||||||
|
mock.lockGetResolution.RLock()
|
||||||
|
calls = mock.calls.GetResolution
|
||||||
|
mock.lockGetResolution.RUnlock()
|
||||||
|
return calls
|
||||||
|
}
|
1
vendor/modules.txt
vendored
1
vendor/modules.txt
vendored
@ -10,6 +10,7 @@ github.com/NVIDIA/go-nvlib/pkg/pciids
|
|||||||
## explicit; go 1.20
|
## explicit; go 1.20
|
||||||
github.com/NVIDIA/go-nvml/pkg/dl
|
github.com/NVIDIA/go-nvml/pkg/dl
|
||||||
github.com/NVIDIA/go-nvml/pkg/nvml
|
github.com/NVIDIA/go-nvml/pkg/nvml
|
||||||
|
github.com/NVIDIA/go-nvml/pkg/nvml/mock
|
||||||
# github.com/cpuguy83/go-md2man/v2 v2.0.2
|
# github.com/cpuguy83/go-md2man/v2 v2.0.2
|
||||||
## explicit; go 1.11
|
## explicit; go 1.11
|
||||||
github.com/cpuguy83/go-md2man/v2/md2man
|
github.com/cpuguy83/go-md2man/v2/md2man
|
||||||
|
Loading…
Reference in New Issue
Block a user