// 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 }