Files
atlantis/server/events/mocks/mock_working_dir_locker.go
Andrew Carter dcae47bddb fix: parallel plan and apply also in a single workspace (rebased) (#5264)
Signed-off-by: Andrew Carter <andrew@emailcarter.com>
Signed-off-by: Luke Massa <lukefrederickmassa@gmail.com>
Co-authored-by: Finn Arne Gangstad <finnag@gmail.com>
Co-authored-by: Rui Chen <rui@chenrui.dev>
Co-authored-by: PePe Amengual <2208324+jamengual@users.noreply.github.com>
Co-authored-by: Luke Massa <lukefrederickmassa@gmail.com>
2025-04-22 13:57:17 -04:00

129 lines
4.5 KiB
Go

// Code generated by pegomock. DO NOT EDIT.
// Source: github.com/runatlantis/atlantis/server/events (interfaces: WorkingDirLocker)
package mocks
import (
pegomock "github.com/petergtz/pegomock/v4"
"reflect"
"time"
)
type MockWorkingDirLocker struct {
fail func(message string, callerSkip ...int)
}
func NewMockWorkingDirLocker(options ...pegomock.Option) *MockWorkingDirLocker {
mock := &MockWorkingDirLocker{}
for _, option := range options {
option.Apply(mock)
}
return mock
}
func (mock *MockWorkingDirLocker) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockWorkingDirLocker) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockWorkingDirLocker) TryLock(repoFullName string, pullNum int, workspace string, path string) (func(), error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockWorkingDirLocker().")
}
_params := []pegomock.Param{repoFullName, pullNum, workspace, path}
_result := pegomock.GetGenericMockFrom(mock).Invoke("TryLock", _params, []reflect.Type{reflect.TypeOf((*func())(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var _ret0 func()
var _ret1 error
if len(_result) != 0 {
if _result[0] != nil {
_ret0 = _result[0].(func())
}
if _result[1] != nil {
_ret1 = _result[1].(error)
}
}
return _ret0, _ret1
}
func (mock *MockWorkingDirLocker) VerifyWasCalledOnce() *VerifierMockWorkingDirLocker {
return &VerifierMockWorkingDirLocker{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockWorkingDirLocker) VerifyWasCalled(invocationCountMatcher pegomock.InvocationCountMatcher) *VerifierMockWorkingDirLocker {
return &VerifierMockWorkingDirLocker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockWorkingDirLocker) VerifyWasCalledInOrder(invocationCountMatcher pegomock.InvocationCountMatcher, inOrderContext *pegomock.InOrderContext) *VerifierMockWorkingDirLocker {
return &VerifierMockWorkingDirLocker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockWorkingDirLocker) VerifyWasCalledEventually(invocationCountMatcher pegomock.InvocationCountMatcher, timeout time.Duration) *VerifierMockWorkingDirLocker {
return &VerifierMockWorkingDirLocker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierMockWorkingDirLocker struct {
mock *MockWorkingDirLocker
invocationCountMatcher pegomock.InvocationCountMatcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierMockWorkingDirLocker) TryLock(repoFullName string, pullNum int, workspace string, path string) *MockWorkingDirLocker_TryLock_OngoingVerification {
_params := []pegomock.Param{repoFullName, pullNum, workspace, path}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TryLock", _params, verifier.timeout)
return &MockWorkingDirLocker_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockWorkingDirLocker_TryLock_OngoingVerification struct {
mock *MockWorkingDirLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *MockWorkingDirLocker_TryLock_OngoingVerification) GetCapturedArguments() (string, int, string, string) {
repoFullName, pullNum, workspace, path := c.GetAllCapturedArguments()
return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1], workspace[len(workspace)-1], path[len(path)-1]
}
func (c *MockWorkingDirLocker_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int, _param2 []string, _param3 []string) {
_params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(_params) > 0 {
if len(_params) > 0 {
_param0 = make([]string, len(c.methodInvocations))
for u, param := range _params[0] {
_param0[u] = param.(string)
}
}
if len(_params) > 1 {
_param1 = make([]int, len(c.methodInvocations))
for u, param := range _params[1] {
_param1[u] = param.(int)
}
}
if len(_params) > 2 {
_param2 = make([]string, len(c.methodInvocations))
for u, param := range _params[2] {
_param2[u] = param.(string)
}
}
if len(_params) > 3 {
_param3 = make([]string, len(c.methodInvocations))
for u, param := range _params[3] {
_param3[u] = param.(string)
}
}
}
return
}