mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-24 04:54:00 +00:00
978d439cf8
This change adds the internal bindings for Sandboxutils, some of which have been automatically generated with the help of c-for-go. The format followed is similar to what is used in go-nvml. These would need to be regenerated when the header file is modified and new APIs are added. Signed-off-by: Evan Lezar <elezar@nvidia.com> Signed-off-by: Huy Nguyen <huyn@nvidia.com> Signed-off-by: Sananya Majumder <sananyam@nvidia.com>
326 lines
8.9 KiB
Go
326 lines
8.9 KiB
Go
// Code generated by moq; DO NOT EDIT.
|
|
// github.com/matryer/moq
|
|
|
|
package mock
|
|
|
|
import (
|
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/nvsandboxutils"
|
|
"sync"
|
|
)
|
|
|
|
// Ensure, that Interface does implement nvsandboxutils.Interface.
|
|
// If this is not the case, regenerate this file with moq.
|
|
var _ nvsandboxutils.Interface = &Interface{}
|
|
|
|
// Interface is a mock implementation of nvsandboxutils.Interface.
|
|
//
|
|
// func TestSomethingThatUsesInterface(t *testing.T) {
|
|
//
|
|
// // make and configure a mocked nvsandboxutils.Interface
|
|
// mockedInterface := &Interface{
|
|
// ErrorStringFunc: func(ret nvsandboxutils.Ret) string {
|
|
// panic("mock out the ErrorString method")
|
|
// },
|
|
// GetDriverVersionFunc: func() (string, nvsandboxutils.Ret) {
|
|
// panic("mock out the GetDriverVersion method")
|
|
// },
|
|
// GetFileContentFunc: func(s string) (string, nvsandboxutils.Ret) {
|
|
// panic("mock out the GetFileContent method")
|
|
// },
|
|
// GetGpuResourceFunc: func(s string) ([]nvsandboxutils.GpuFileInfo, nvsandboxutils.Ret) {
|
|
// panic("mock out the GetGpuResource method")
|
|
// },
|
|
// InitFunc: func(s string) nvsandboxutils.Ret {
|
|
// panic("mock out the Init method")
|
|
// },
|
|
// LookupSymbolFunc: func(s string) error {
|
|
// panic("mock out the LookupSymbol method")
|
|
// },
|
|
// ShutdownFunc: func() nvsandboxutils.Ret {
|
|
// panic("mock out the Shutdown method")
|
|
// },
|
|
// }
|
|
//
|
|
// // use mockedInterface in code that requires nvsandboxutils.Interface
|
|
// // and then make assertions.
|
|
//
|
|
// }
|
|
type Interface struct {
|
|
// ErrorStringFunc mocks the ErrorString method.
|
|
ErrorStringFunc func(ret nvsandboxutils.Ret) string
|
|
|
|
// GetDriverVersionFunc mocks the GetDriverVersion method.
|
|
GetDriverVersionFunc func() (string, nvsandboxutils.Ret)
|
|
|
|
// GetFileContentFunc mocks the GetFileContent method.
|
|
GetFileContentFunc func(s string) (string, nvsandboxutils.Ret)
|
|
|
|
// GetGpuResourceFunc mocks the GetGpuResource method.
|
|
GetGpuResourceFunc func(s string) ([]nvsandboxutils.GpuFileInfo, nvsandboxutils.Ret)
|
|
|
|
// InitFunc mocks the Init method.
|
|
InitFunc func(s string) nvsandboxutils.Ret
|
|
|
|
// LookupSymbolFunc mocks the LookupSymbol method.
|
|
LookupSymbolFunc func(s string) error
|
|
|
|
// ShutdownFunc mocks the Shutdown method.
|
|
ShutdownFunc func() nvsandboxutils.Ret
|
|
|
|
// calls tracks calls to the methods.
|
|
calls struct {
|
|
// ErrorString holds details about calls to the ErrorString method.
|
|
ErrorString []struct {
|
|
// Ret is the ret argument value.
|
|
Ret nvsandboxutils.Ret
|
|
}
|
|
// GetDriverVersion holds details about calls to the GetDriverVersion method.
|
|
GetDriverVersion []struct {
|
|
}
|
|
// GetFileContent holds details about calls to the GetFileContent method.
|
|
GetFileContent []struct {
|
|
// S is the s argument value.
|
|
S string
|
|
}
|
|
// GetGpuResource holds details about calls to the GetGpuResource method.
|
|
GetGpuResource []struct {
|
|
// S is the s argument value.
|
|
S string
|
|
}
|
|
// Init holds details about calls to the Init method.
|
|
Init []struct {
|
|
// S is the s argument value.
|
|
S string
|
|
}
|
|
// LookupSymbol holds details about calls to the LookupSymbol method.
|
|
LookupSymbol []struct {
|
|
// S is the s argument value.
|
|
S string
|
|
}
|
|
// Shutdown holds details about calls to the Shutdown method.
|
|
Shutdown []struct {
|
|
}
|
|
}
|
|
lockErrorString sync.RWMutex
|
|
lockGetDriverVersion sync.RWMutex
|
|
lockGetFileContent sync.RWMutex
|
|
lockGetGpuResource sync.RWMutex
|
|
lockInit sync.RWMutex
|
|
lockLookupSymbol sync.RWMutex
|
|
lockShutdown sync.RWMutex
|
|
}
|
|
|
|
// ErrorString calls ErrorStringFunc.
|
|
func (mock *Interface) ErrorString(ret nvsandboxutils.Ret) string {
|
|
if mock.ErrorStringFunc == nil {
|
|
panic("Interface.ErrorStringFunc: method is nil but Interface.ErrorString was just called")
|
|
}
|
|
callInfo := struct {
|
|
Ret nvsandboxutils.Ret
|
|
}{
|
|
Ret: ret,
|
|
}
|
|
mock.lockErrorString.Lock()
|
|
mock.calls.ErrorString = append(mock.calls.ErrorString, callInfo)
|
|
mock.lockErrorString.Unlock()
|
|
return mock.ErrorStringFunc(ret)
|
|
}
|
|
|
|
// ErrorStringCalls gets all the calls that were made to ErrorString.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedInterface.ErrorStringCalls())
|
|
func (mock *Interface) ErrorStringCalls() []struct {
|
|
Ret nvsandboxutils.Ret
|
|
} {
|
|
var calls []struct {
|
|
Ret nvsandboxutils.Ret
|
|
}
|
|
mock.lockErrorString.RLock()
|
|
calls = mock.calls.ErrorString
|
|
mock.lockErrorString.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// GetDriverVersion calls GetDriverVersionFunc.
|
|
func (mock *Interface) GetDriverVersion() (string, nvsandboxutils.Ret) {
|
|
if mock.GetDriverVersionFunc == nil {
|
|
panic("Interface.GetDriverVersionFunc: method is nil but Interface.GetDriverVersion was just called")
|
|
}
|
|
callInfo := struct {
|
|
}{}
|
|
mock.lockGetDriverVersion.Lock()
|
|
mock.calls.GetDriverVersion = append(mock.calls.GetDriverVersion, callInfo)
|
|
mock.lockGetDriverVersion.Unlock()
|
|
return mock.GetDriverVersionFunc()
|
|
}
|
|
|
|
// GetDriverVersionCalls gets all the calls that were made to GetDriverVersion.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedInterface.GetDriverVersionCalls())
|
|
func (mock *Interface) GetDriverVersionCalls() []struct {
|
|
} {
|
|
var calls []struct {
|
|
}
|
|
mock.lockGetDriverVersion.RLock()
|
|
calls = mock.calls.GetDriverVersion
|
|
mock.lockGetDriverVersion.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// GetFileContent calls GetFileContentFunc.
|
|
func (mock *Interface) GetFileContent(s string) (string, nvsandboxutils.Ret) {
|
|
if mock.GetFileContentFunc == nil {
|
|
panic("Interface.GetFileContentFunc: method is nil but Interface.GetFileContent was just called")
|
|
}
|
|
callInfo := struct {
|
|
S string
|
|
}{
|
|
S: s,
|
|
}
|
|
mock.lockGetFileContent.Lock()
|
|
mock.calls.GetFileContent = append(mock.calls.GetFileContent, callInfo)
|
|
mock.lockGetFileContent.Unlock()
|
|
return mock.GetFileContentFunc(s)
|
|
}
|
|
|
|
// GetFileContentCalls gets all the calls that were made to GetFileContent.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedInterface.GetFileContentCalls())
|
|
func (mock *Interface) GetFileContentCalls() []struct {
|
|
S string
|
|
} {
|
|
var calls []struct {
|
|
S string
|
|
}
|
|
mock.lockGetFileContent.RLock()
|
|
calls = mock.calls.GetFileContent
|
|
mock.lockGetFileContent.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// GetGpuResource calls GetGpuResourceFunc.
|
|
func (mock *Interface) GetGpuResource(s string) ([]nvsandboxutils.GpuFileInfo, nvsandboxutils.Ret) {
|
|
if mock.GetGpuResourceFunc == nil {
|
|
panic("Interface.GetGpuResourceFunc: method is nil but Interface.GetGpuResource was just called")
|
|
}
|
|
callInfo := struct {
|
|
S string
|
|
}{
|
|
S: s,
|
|
}
|
|
mock.lockGetGpuResource.Lock()
|
|
mock.calls.GetGpuResource = append(mock.calls.GetGpuResource, callInfo)
|
|
mock.lockGetGpuResource.Unlock()
|
|
return mock.GetGpuResourceFunc(s)
|
|
}
|
|
|
|
// GetGpuResourceCalls gets all the calls that were made to GetGpuResource.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedInterface.GetGpuResourceCalls())
|
|
func (mock *Interface) GetGpuResourceCalls() []struct {
|
|
S string
|
|
} {
|
|
var calls []struct {
|
|
S string
|
|
}
|
|
mock.lockGetGpuResource.RLock()
|
|
calls = mock.calls.GetGpuResource
|
|
mock.lockGetGpuResource.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// Init calls InitFunc.
|
|
func (mock *Interface) Init(s string) nvsandboxutils.Ret {
|
|
if mock.InitFunc == nil {
|
|
panic("Interface.InitFunc: method is nil but Interface.Init was just called")
|
|
}
|
|
callInfo := struct {
|
|
S string
|
|
}{
|
|
S: s,
|
|
}
|
|
mock.lockInit.Lock()
|
|
mock.calls.Init = append(mock.calls.Init, callInfo)
|
|
mock.lockInit.Unlock()
|
|
return mock.InitFunc(s)
|
|
}
|
|
|
|
// InitCalls gets all the calls that were made to Init.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedInterface.InitCalls())
|
|
func (mock *Interface) InitCalls() []struct {
|
|
S string
|
|
} {
|
|
var calls []struct {
|
|
S string
|
|
}
|
|
mock.lockInit.RLock()
|
|
calls = mock.calls.Init
|
|
mock.lockInit.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// LookupSymbol calls LookupSymbolFunc.
|
|
func (mock *Interface) LookupSymbol(s string) error {
|
|
if mock.LookupSymbolFunc == nil {
|
|
panic("Interface.LookupSymbolFunc: method is nil but Interface.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(mockedInterface.LookupSymbolCalls())
|
|
func (mock *Interface) LookupSymbolCalls() []struct {
|
|
S string
|
|
} {
|
|
var calls []struct {
|
|
S string
|
|
}
|
|
mock.lockLookupSymbol.RLock()
|
|
calls = mock.calls.LookupSymbol
|
|
mock.lockLookupSymbol.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// Shutdown calls ShutdownFunc.
|
|
func (mock *Interface) Shutdown() nvsandboxutils.Ret {
|
|
if mock.ShutdownFunc == nil {
|
|
panic("Interface.ShutdownFunc: method is nil but Interface.Shutdown was just called")
|
|
}
|
|
callInfo := struct {
|
|
}{}
|
|
mock.lockShutdown.Lock()
|
|
mock.calls.Shutdown = append(mock.calls.Shutdown, callInfo)
|
|
mock.lockShutdown.Unlock()
|
|
return mock.ShutdownFunc()
|
|
}
|
|
|
|
// ShutdownCalls gets all the calls that were made to Shutdown.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedInterface.ShutdownCalls())
|
|
func (mock *Interface) ShutdownCalls() []struct {
|
|
} {
|
|
var calls []struct {
|
|
}
|
|
mock.lockShutdown.RLock()
|
|
calls = mock.calls.Shutdown
|
|
mock.lockShutdown.RUnlock()
|
|
return calls
|
|
}
|