nvidia-container-toolkit/pkg/nvcdi/namer_nvml_mock.go
Evan Lezar 082ce066ed Replace go-nvlib/pkg/nvml with go-nvml/pkg/nvml
Signed-off-by: Evan Lezar <elezar@nvidia.com>
2024-04-18 14:53:37 +02:00

74 lines
1.6 KiB
Go

// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package nvcdi
import (
"sync"
"github.com/NVIDIA/go-nvml/pkg/nvml"
)
// Ensure, that nvmlUUIDerMock does implement nvmlUUIDer.
// If this is not the case, regenerate this file with moq.
var _ nvmlUUIDer = &nvmlUUIDerMock{}
// nvmlUUIDerMock is a mock implementation of nvmlUUIDer.
//
// func TestSomethingThatUsesnvmlUUIDer(t *testing.T) {
//
// // make and configure a mocked nvmlUUIDer
// mockednvmlUUIDer := &nvmlUUIDerMock{
// GetUUIDFunc: func() (string, nvml.Return) {
// panic("mock out the GetUUID method")
// },
// }
//
// // use mockednvmlUUIDer in code that requires nvmlUUIDer
// // and then make assertions.
//
// }
type nvmlUUIDerMock struct {
// GetUUIDFunc mocks the GetUUID method.
GetUUIDFunc func() (string, nvml.Return)
// calls tracks calls to the methods.
calls struct {
// GetUUID holds details about calls to the GetUUID method.
GetUUID []struct {
}
}
lockGetUUID sync.RWMutex
}
// GetUUID calls GetUUIDFunc.
func (mock *nvmlUUIDerMock) GetUUID() (string, nvml.Return) {
callInfo := struct {
}{}
mock.lockGetUUID.Lock()
mock.calls.GetUUID = append(mock.calls.GetUUID, callInfo)
mock.lockGetUUID.Unlock()
if mock.GetUUIDFunc == nil {
var (
sOut string
returnOut nvml.Return
)
return sOut, returnOut
}
return mock.GetUUIDFunc()
}
// GetUUIDCalls gets all the calls that were made to GetUUID.
// Check the length with:
//
// len(mockednvmlUUIDer.GetUUIDCalls())
func (mock *nvmlUUIDerMock) GetUUIDCalls() []struct {
} {
var calls []struct {
}
mock.lockGetUUID.RLock()
calls = mock.calls.GetUUID
mock.lockGetUUID.RUnlock()
return calls
}