mock

package
v1.17.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

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
	// contains filtered or unexported fields
}

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.

}

func (*Interface) ErrorString

func (mock *Interface) ErrorString(ret nvsandboxutils.Ret) string

ErrorString calls ErrorStringFunc.

func (*Interface) ErrorStringCalls

func (mock *Interface) ErrorStringCalls() []struct {
	Ret nvsandboxutils.Ret
}

ErrorStringCalls gets all the calls that were made to ErrorString. Check the length with:

len(mockedInterface.ErrorStringCalls())

func (*Interface) GetDriverVersion

func (mock *Interface) GetDriverVersion() (string, nvsandboxutils.Ret)

GetDriverVersion calls GetDriverVersionFunc.

func (*Interface) GetDriverVersionCalls

func (mock *Interface) GetDriverVersionCalls() []struct {
}

GetDriverVersionCalls gets all the calls that were made to GetDriverVersion. Check the length with:

len(mockedInterface.GetDriverVersionCalls())

func (*Interface) GetFileContent

func (mock *Interface) GetFileContent(s string) (string, nvsandboxutils.Ret)

GetFileContent calls GetFileContentFunc.

func (*Interface) GetFileContentCalls

func (mock *Interface) GetFileContentCalls() []struct {
	S string
}

GetFileContentCalls gets all the calls that were made to GetFileContent. Check the length with:

len(mockedInterface.GetFileContentCalls())

func (*Interface) GetGpuResource

func (mock *Interface) GetGpuResource(s string) ([]nvsandboxutils.GpuFileInfo, nvsandboxutils.Ret)

GetGpuResource calls GetGpuResourceFunc.

func (*Interface) GetGpuResourceCalls

func (mock *Interface) GetGpuResourceCalls() []struct {
	S string
}

GetGpuResourceCalls gets all the calls that were made to GetGpuResource. Check the length with:

len(mockedInterface.GetGpuResourceCalls())

func (*Interface) Init

func (mock *Interface) Init(s string) nvsandboxutils.Ret

Init calls InitFunc.

func (*Interface) InitCalls

func (mock *Interface) InitCalls() []struct {
	S string
}

InitCalls gets all the calls that were made to Init. Check the length with:

len(mockedInterface.InitCalls())

func (*Interface) LookupSymbol

func (mock *Interface) LookupSymbol(s string) error

LookupSymbol calls LookupSymbolFunc.

func (*Interface) LookupSymbolCalls

func (mock *Interface) LookupSymbolCalls() []struct {
	S string
}

LookupSymbolCalls gets all the calls that were made to LookupSymbol. Check the length with:

len(mockedInterface.LookupSymbolCalls())

func (*Interface) Shutdown

func (mock *Interface) Shutdown() nvsandboxutils.Ret

Shutdown calls ShutdownFunc.

func (*Interface) ShutdownCalls

func (mock *Interface) ShutdownCalls() []struct {
}

ShutdownCalls gets all the calls that were made to Shutdown. Check the length with:

len(mockedInterface.ShutdownCalls())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL