mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-28 06:52:34 +00:00
c05f9dffc5
Signed-off-by: Evan Lezar <elezar@nvidia.com>
78 lines
1.7 KiB
Go
78 lines
1.7 KiB
Go
// Code generated by moq; DO NOT EDIT.
|
|
// github.com/matryer/moq
|
|
|
|
package modify
|
|
|
|
import (
|
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/oci"
|
|
"sync"
|
|
)
|
|
|
|
// Ensure, that ModifierMock does implement Modifier.
|
|
// If this is not the case, regenerate this file with moq.
|
|
var _ Modifier = &ModifierMock{}
|
|
|
|
// ModifierMock is a mock implementation of Modifier.
|
|
//
|
|
// func TestSomethingThatUsesModifier(t *testing.T) {
|
|
//
|
|
// // make and configure a mocked Modifier
|
|
// mockedModifier := &ModifierMock{
|
|
// ModifyFunc: func(spec oci.Spec) error {
|
|
// panic("mock out the Modify method")
|
|
// },
|
|
// }
|
|
//
|
|
// // use mockedModifier in code that requires Modifier
|
|
// // and then make assertions.
|
|
//
|
|
// }
|
|
type ModifierMock struct {
|
|
// ModifyFunc mocks the Modify method.
|
|
ModifyFunc func(spec oci.Spec) error
|
|
|
|
// calls tracks calls to the methods.
|
|
calls struct {
|
|
// Modify holds details about calls to the Modify method.
|
|
Modify []struct {
|
|
// Spec is the spec argument value.
|
|
Spec oci.Spec
|
|
}
|
|
}
|
|
lockModify sync.RWMutex
|
|
}
|
|
|
|
// Modify calls ModifyFunc.
|
|
func (mock *ModifierMock) Modify(spec oci.Spec) error {
|
|
callInfo := struct {
|
|
Spec oci.Spec
|
|
}{
|
|
Spec: spec,
|
|
}
|
|
mock.lockModify.Lock()
|
|
mock.calls.Modify = append(mock.calls.Modify, callInfo)
|
|
mock.lockModify.Unlock()
|
|
if mock.ModifyFunc == nil {
|
|
var (
|
|
errOut error
|
|
)
|
|
return errOut
|
|
}
|
|
return mock.ModifyFunc(spec)
|
|
}
|
|
|
|
// ModifyCalls gets all the calls that were made to Modify.
|
|
// Check the length with:
|
|
// len(mockedModifier.ModifyCalls())
|
|
func (mock *ModifierMock) ModifyCalls() []struct {
|
|
Spec oci.Spec
|
|
} {
|
|
var calls []struct {
|
|
Spec oci.Spec
|
|
}
|
|
mock.lockModify.RLock()
|
|
calls = mock.calls.Modify
|
|
mock.lockModify.RUnlock()
|
|
return calls
|
|
}
|