2021-10-29 14:44:31 +00:00
|
|
|
// Code generated by moq; DO NOT EDIT.
|
|
|
|
// github.com/matryer/moq
|
2021-09-06 11:26:48 +00:00
|
|
|
|
|
|
|
package oci
|
|
|
|
|
2021-10-29 14:44:31 +00:00
|
|
|
import (
|
|
|
|
"sync"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Ensure, that RuntimeMock does implement Runtime.
|
|
|
|
// If this is not the case, regenerate this file with moq.
|
|
|
|
var _ Runtime = &RuntimeMock{}
|
2021-09-06 11:26:48 +00:00
|
|
|
|
2021-10-29 14:44:31 +00:00
|
|
|
// RuntimeMock is a mock implementation of Runtime.
|
|
|
|
//
|
|
|
|
// func TestSomethingThatUsesRuntime(t *testing.T) {
|
|
|
|
//
|
|
|
|
// // make and configure a mocked Runtime
|
|
|
|
// mockedRuntime := &RuntimeMock{
|
|
|
|
// ExecFunc: func(strings []string) error {
|
|
|
|
// panic("mock out the Exec method")
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// // use mockedRuntime in code that requires Runtime
|
|
|
|
// // and then make assertions.
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
type RuntimeMock struct {
|
|
|
|
// ExecFunc mocks the Exec method.
|
|
|
|
ExecFunc func(strings []string) error
|
|
|
|
|
|
|
|
// calls tracks calls to the methods.
|
|
|
|
calls struct {
|
|
|
|
// Exec holds details about calls to the Exec method.
|
|
|
|
Exec []struct {
|
|
|
|
// Strings is the strings argument value.
|
|
|
|
Strings []string
|
|
|
|
}
|
2021-09-06 11:26:48 +00:00
|
|
|
}
|
2021-10-29 14:44:31 +00:00
|
|
|
lockExec sync.RWMutex
|
2021-09-06 11:26:48 +00:00
|
|
|
}
|
|
|
|
|
2021-10-29 14:44:31 +00:00
|
|
|
// Exec calls ExecFunc.
|
|
|
|
func (mock *RuntimeMock) Exec(strings []string) error {
|
|
|
|
callInfo := struct {
|
|
|
|
Strings []string
|
|
|
|
}{
|
|
|
|
Strings: strings,
|
|
|
|
}
|
|
|
|
mock.lockExec.Lock()
|
|
|
|
mock.calls.Exec = append(mock.calls.Exec, callInfo)
|
|
|
|
mock.lockExec.Unlock()
|
|
|
|
if mock.ExecFunc == nil {
|
|
|
|
var (
|
|
|
|
errOut error
|
|
|
|
)
|
|
|
|
return errOut
|
|
|
|
}
|
|
|
|
return mock.ExecFunc(strings)
|
2021-09-06 11:26:48 +00:00
|
|
|
}
|
|
|
|
|
2021-10-29 14:44:31 +00:00
|
|
|
// ExecCalls gets all the calls that were made to Exec.
|
|
|
|
// Check the length with:
|
|
|
|
// len(mockedRuntime.ExecCalls())
|
|
|
|
func (mock *RuntimeMock) ExecCalls() []struct {
|
|
|
|
Strings []string
|
|
|
|
} {
|
|
|
|
var calls []struct {
|
|
|
|
Strings []string
|
|
|
|
}
|
|
|
|
mock.lockExec.RLock()
|
|
|
|
calls = mock.calls.Exec
|
|
|
|
mock.lockExec.RUnlock()
|
|
|
|
return calls
|
2021-09-06 11:26:48 +00:00
|
|
|
}
|