chore(build): rm pegomock experimental feature for smooth mock generation (#2886)

* disable pegomock --use-experimental-model-gen, cause random fail by segv

* make regen-mocks

* fix mock code which uses non experimental pegomock codes
This commit is contained in:
Ken Kaizu
2022-12-28 10:58:15 +09:00
committed by GitHub
parent de953fe255
commit 27b9897517
206 changed files with 3652 additions and 4787 deletions

View File

@@ -143,7 +143,7 @@ Then you've likely modified an interface and now need to update the mocks.
Each interface that is mocked has a `go:generate` command above it, e.g.
```go
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_project_command_builder.go ProjectCommandBuilder
//go:generate pegomock generate -m --package mocks -o mocks/mock_project_command_builder.go ProjectCommandBuilder
type ProjectCommandBuilder interface {
BuildAutoplanCommands(ctx *command.Context) ([]command.ProjectContext, error)

View File

@@ -37,8 +37,8 @@ func TestAPIController_Plan(t *testing.T) {
w := httptest.NewRecorder()
ac.Plan(w, req)
ResponseContains(t, w, http.StatusOK, "")
projectCommandBuilder.VerifyWasCalledOnce().BuildPlanCommands(AnyPtrToEventsCommandContext(), AnyPtrToEventsCommentCommand())
projectCommandRunner.VerifyWasCalledOnce().Plan(AnyModelsProjectCommandContext())
projectCommandBuilder.VerifyWasCalledOnce().BuildPlanCommands(AnyPtrToCommandContext(), AnyPtrToEventsCommentCommand())
projectCommandRunner.VerifyWasCalledOnce().Plan(AnyCommandProjectContext())
}
func TestAPIController_Apply(t *testing.T) {
@@ -54,9 +54,9 @@ func TestAPIController_Apply(t *testing.T) {
w := httptest.NewRecorder()
ac.Apply(w, req)
ResponseContains(t, w, http.StatusOK, "")
projectCommandBuilder.VerifyWasCalledOnce().BuildApplyCommands(AnyPtrToEventsCommandContext(), AnyPtrToEventsCommentCommand())
projectCommandRunner.VerifyWasCalledOnce().Plan(AnyModelsProjectCommandContext())
projectCommandRunner.VerifyWasCalledOnce().Apply(AnyModelsProjectCommandContext())
projectCommandBuilder.VerifyWasCalledOnce().BuildApplyCommands(AnyPtrToCommandContext(), AnyPtrToEventsCommentCommand())
projectCommandRunner.VerifyWasCalledOnce().Plan(AnyCommandProjectContext())
projectCommandRunner.VerifyWasCalledOnce().Apply(AnyCommandProjectContext())
}
func setup(t *testing.T) (controllers.APIController, *MockProjectCommandBuilder, *MockProjectCommandRunner) {
@@ -70,20 +70,20 @@ func setup(t *testing.T) (controllers.APIController, *MockProjectCommandBuilder,
Ok(t, err)
projectCommandBuilder := NewMockProjectCommandBuilder()
When(projectCommandBuilder.BuildPlanCommands(AnyPtrToEventsCommandContext(), AnyPtrToEventsCommentCommand())).
When(projectCommandBuilder.BuildPlanCommands(AnyPtrToCommandContext(), AnyPtrToEventsCommentCommand())).
ThenReturn([]command.ProjectContext{{
CommandName: command.Plan,
}}, nil)
When(projectCommandBuilder.BuildApplyCommands(AnyPtrToEventsCommandContext(), AnyPtrToEventsCommentCommand())).
When(projectCommandBuilder.BuildApplyCommands(AnyPtrToCommandContext(), AnyPtrToEventsCommentCommand())).
ThenReturn([]command.ProjectContext{{
CommandName: command.Apply,
}}, nil)
projectCommandRunner := NewMockProjectCommandRunner()
When(projectCommandRunner.Plan(AnyModelsProjectCommandContext())).ThenReturn(command.ProjectResult{
When(projectCommandRunner.Plan(AnyCommandProjectContext())).ThenReturn(command.ProjectResult{
PlanSuccess: &models.PlanSuccess{},
})
When(projectCommandRunner.Apply(AnyModelsProjectCommandContext())).ThenReturn(command.ProjectResult{
When(projectCommandRunner.Apply(AnyCommandProjectContext())).ThenReturn(command.ProjectResult{
ApplySuccess: "success",
})

View File

@@ -8,7 +8,7 @@ import (
"github.com/mcdafydd/go-azuredevops/azuredevops"
)
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_azuredevops_request_validator.go AzureDevopsRequestValidator
//go:generate pegomock generate -m --package mocks -o mocks/mock_azuredevops_request_validator.go AzureDevopsRequestValidator
// AzureDevopsRequestValidator handles checking if Azure DevOps requests
// contain a valid Basic authentication username and password.

View File

@@ -35,6 +35,7 @@ import (
"github.com/runatlantis/atlantis/server/events/models"
"github.com/runatlantis/atlantis/server/events/vcs"
vcsmocks "github.com/runatlantis/atlantis/server/events/vcs/mocks"
vcsmatchers "github.com/runatlantis/atlantis/server/events/vcs/mocks/matchers"
"github.com/runatlantis/atlantis/server/events/webhooks"
jobmocks "github.com/runatlantis/atlantis/server/jobs/mocks"
"github.com/runatlantis/atlantis/server/logging"
@@ -534,9 +535,9 @@ func TestGitHubWorkflow(t *testing.T) {
if c.ExpAutomerge {
// Verify that the merge API call was made.
vcsClient.VerifyWasCalledOnce().MergePull(matchers.AnyModelsPullRequest(), matchers.AnyModelsPullRequestOptions())
vcsClient.VerifyWasCalledOnce().MergePull(matchers.AnyModelsPullRequest(), vcsmatchers.AnyModelsPullRequestOptions())
} else {
vcsClient.VerifyWasCalled(Never()).MergePull(matchers.AnyModelsPullRequest(), matchers.AnyModelsPullRequestOptions())
vcsClient.VerifyWasCalled(Never()).MergePull(matchers.AnyModelsPullRequest(), vcsmatchers.AnyModelsPullRequestOptions())
}
})
}
@@ -932,9 +933,9 @@ func TestGitHubWorkflowWithPolicyCheck(t *testing.T) {
if c.ExpAutomerge {
// Verify that the merge API call was made.
vcsClient.VerifyWasCalledOnce().MergePull(matchers.AnyModelsPullRequest(), matchers.AnyModelsPullRequestOptions())
vcsClient.VerifyWasCalledOnce().MergePull(matchers.AnyModelsPullRequest(), vcsmatchers.AnyModelsPullRequestOptions())
} else {
vcsClient.VerifyWasCalled(Never()).MergePull(matchers.AnyModelsPullRequest(), matchers.AnyModelsPullRequestOptions())
vcsClient.VerifyWasCalled(Never()).MergePull(matchers.AnyModelsPullRequest(), vcsmatchers.AnyModelsPullRequestOptions())
}
})
}

View File

@@ -22,7 +22,7 @@ import (
"github.com/google/go-github/v48/github"
)
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_github_request_validator.go GithubRequestValidator
//go:generate pegomock generate -m --package mocks -o mocks/mock_github_request_validator.go GithubRequestValidator
// GithubRequestValidator handles checking if GitHub requests are signed
// properly by the secret.

View File

@@ -25,7 +25,7 @@ import (
const secretHeader = "X-Gitlab-Token" // #nosec
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_gitlab_request_parser_validator.go GitlabRequestParserValidator
//go:generate pegomock generate -m --package mocks -o mocks/mock_gitlab_request_parser_validator.go GitlabRequestParserValidator
// GitlabRequestParserValidator parses and validates GitLab requests.
type GitlabRequestParserValidator interface {

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
http "net/http"
)

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
)
func AnySliceOfByte() []byte {

View File

@@ -4,11 +4,10 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock"
http "net/http"
"reflect"
"time"
pegomock "github.com/petergtz/pegomock"
)
type MockAzureDevopsRequestValidator struct {
@@ -26,11 +25,11 @@ func NewMockAzureDevopsRequestValidator(options ...pegomock.Option) *MockAzureDe
func (mock *MockAzureDevopsRequestValidator) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockAzureDevopsRequestValidator) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockAzureDevopsRequestValidator) Validate(r *http.Request, user []byte, pass []byte) ([]byte, error) {
func (mock *MockAzureDevopsRequestValidator) Validate(_param0 *http.Request, _param1 []byte, _param2 []byte) ([]byte, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockAzureDevopsRequestValidator().")
}
params := []pegomock.Param{r, user, pass}
params := []pegomock.Param{_param0, _param1, _param2}
result := pegomock.GetGenericMockFrom(mock).Invoke("Validate", params, []reflect.Type{reflect.TypeOf((*[]byte)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 []byte
var ret1 error
@@ -82,8 +81,8 @@ type VerifierMockAzureDevopsRequestValidator struct {
timeout time.Duration
}
func (verifier *VerifierMockAzureDevopsRequestValidator) Validate(r *http.Request, user []byte, pass []byte) *MockAzureDevopsRequestValidator_Validate_OngoingVerification {
params := []pegomock.Param{r, user, pass}
func (verifier *VerifierMockAzureDevopsRequestValidator) Validate(_param0 *http.Request, _param1 []byte, _param2 []byte) *MockAzureDevopsRequestValidator_Validate_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Validate", params, verifier.timeout)
return &MockAzureDevopsRequestValidator_Validate_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -94,8 +93,8 @@ type MockAzureDevopsRequestValidator_Validate_OngoingVerification struct {
}
func (c *MockAzureDevopsRequestValidator_Validate_OngoingVerification) GetCapturedArguments() (*http.Request, []byte, []byte) {
r, user, pass := c.GetAllCapturedArguments()
return r[len(r)-1], user[len(user)-1], pass[len(pass)-1]
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
}
func (c *MockAzureDevopsRequestValidator_Validate_OngoingVerification) GetAllCapturedArguments() (_param0 []*http.Request, _param1 [][]byte, _param2 [][]byte) {

View File

@@ -4,11 +4,10 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock"
http "net/http"
"reflect"
"time"
pegomock "github.com/petergtz/pegomock"
)
type MockGithubRequestValidator struct {
@@ -26,11 +25,11 @@ func NewMockGithubRequestValidator(options ...pegomock.Option) *MockGithubReques
func (mock *MockGithubRequestValidator) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockGithubRequestValidator) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockGithubRequestValidator) Validate(r *http.Request, secret []byte) ([]byte, error) {
func (mock *MockGithubRequestValidator) Validate(_param0 *http.Request, _param1 []byte) ([]byte, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockGithubRequestValidator().")
}
params := []pegomock.Param{r, secret}
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("Validate", params, []reflect.Type{reflect.TypeOf((*[]byte)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 []byte
var ret1 error
@@ -82,8 +81,8 @@ type VerifierMockGithubRequestValidator struct {
timeout time.Duration
}
func (verifier *VerifierMockGithubRequestValidator) Validate(r *http.Request, secret []byte) *MockGithubRequestValidator_Validate_OngoingVerification {
params := []pegomock.Param{r, secret}
func (verifier *VerifierMockGithubRequestValidator) Validate(_param0 *http.Request, _param1 []byte) *MockGithubRequestValidator_Validate_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Validate", params, verifier.timeout)
return &MockGithubRequestValidator_Validate_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -94,8 +93,8 @@ type MockGithubRequestValidator_Validate_OngoingVerification struct {
}
func (c *MockGithubRequestValidator_Validate_OngoingVerification) GetCapturedArguments() (*http.Request, []byte) {
r, secret := c.GetAllCapturedArguments()
return r[len(r)-1], secret[len(secret)-1]
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockGithubRequestValidator_Validate_OngoingVerification) GetAllCapturedArguments() (_param0 []*http.Request, _param1 [][]byte) {

View File

@@ -4,11 +4,10 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock"
http "net/http"
"reflect"
"time"
pegomock "github.com/petergtz/pegomock"
)
type MockGitlabRequestParserValidator struct {
@@ -26,11 +25,11 @@ func NewMockGitlabRequestParserValidator(options ...pegomock.Option) *MockGitlab
func (mock *MockGitlabRequestParserValidator) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockGitlabRequestParserValidator) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockGitlabRequestParserValidator) ParseAndValidate(r *http.Request, secret []byte) (interface{}, error) {
func (mock *MockGitlabRequestParserValidator) ParseAndValidate(_param0 *http.Request, _param1 []byte) (interface{}, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockGitlabRequestParserValidator().")
}
params := []pegomock.Param{r, secret}
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("ParseAndValidate", params, []reflect.Type{reflect.TypeOf((*interface{})(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 interface{}
var ret1 error
@@ -82,8 +81,8 @@ type VerifierMockGitlabRequestParserValidator struct {
timeout time.Duration
}
func (verifier *VerifierMockGitlabRequestParserValidator) ParseAndValidate(r *http.Request, secret []byte) *MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification {
params := []pegomock.Param{r, secret}
func (verifier *VerifierMockGitlabRequestParserValidator) ParseAndValidate(_param0 *http.Request, _param1 []byte) *MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseAndValidate", params, verifier.timeout)
return &MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -94,8 +93,8 @@ type MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification struc
}
func (c *MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification) GetCapturedArguments() (*http.Request, []byte) {
r, secret := c.GetAllCapturedArguments()
return r[len(r)-1], secret[len(secret)-1]
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification) GetAllCapturedArguments() (_param0 []*http.Request, _param1 [][]byte) {

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
io "io"
)

View File

@@ -4,11 +4,10 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock"
io "io"
"reflect"
"time"
pegomock "github.com/petergtz/pegomock"
)
type MockTemplateWriter struct {
@@ -26,11 +25,11 @@ func NewMockTemplateWriter(options ...pegomock.Option) *MockTemplateWriter {
func (mock *MockTemplateWriter) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockTemplateWriter) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockTemplateWriter) Execute(wr io.Writer, data interface{}) error {
func (mock *MockTemplateWriter) Execute(_param0 io.Writer, _param1 interface{}) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockTemplateWriter().")
}
params := []pegomock.Param{wr, data}
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("Execute", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
@@ -78,8 +77,8 @@ type VerifierMockTemplateWriter struct {
timeout time.Duration
}
func (verifier *VerifierMockTemplateWriter) Execute(wr io.Writer, data interface{}) *MockTemplateWriter_Execute_OngoingVerification {
params := []pegomock.Param{wr, data}
func (verifier *VerifierMockTemplateWriter) Execute(_param0 io.Writer, _param1 interface{}) *MockTemplateWriter_Execute_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Execute", params, verifier.timeout)
return &MockTemplateWriter_Execute_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -90,8 +89,8 @@ type MockTemplateWriter_Execute_OngoingVerification struct {
}
func (c *MockTemplateWriter_Execute_OngoingVerification) GetCapturedArguments() (io.Writer, interface{}) {
wr, data := c.GetAllCapturedArguments()
return wr[len(wr)-1], data[len(data)-1]
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockTemplateWriter_Execute_OngoingVerification) GetAllCapturedArguments() (_param0 []io.Writer, _param1 []interface{}) {

View File

@@ -19,7 +19,7 @@ import (
"time"
)
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_template_writer.go TemplateWriter
//go:generate pegomock generate -m --package mocks -o mocks/mock_template_writer.go TemplateWriter
// TemplateWriter is an interface over html/template that's used to enable
// mocking.

View File

@@ -7,7 +7,7 @@ import (
"github.com/runatlantis/atlantis/server/events/command"
)
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_apply_lock_checker.go ApplyLockChecker
//go:generate pegomock generate -m --package mocks -o mocks/mock_apply_lock_checker.go ApplyLockChecker
// ApplyLockChecker is an implementation of the global apply lock retrieval.
// It returns an object that contains information about apply locks status.
@@ -15,7 +15,7 @@ type ApplyLockChecker interface {
CheckApplyLock() (ApplyCommandLock, error)
}
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_apply_locker.go ApplyLocker
//go:generate pegomock generate -m --package mocks -o mocks/mock_apply_locker.go ApplyLocker
// ApplyLocker interface that manages locks for apply command runner
type ApplyLocker interface {

View File

@@ -26,7 +26,7 @@ import (
"github.com/runatlantis/atlantis/server/events/models"
)
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_backend.go Backend
//go:generate pegomock generate -m --package mocks -o mocks/mock_backend.go Backend
// Backend is an implementation of the locking API we require.
type Backend interface {
@@ -60,7 +60,7 @@ type Client struct {
backend Backend
}
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_locker.go Locker
//go:generate pegomock generate -m --package mocks -o mocks/mock_locker.go Locker
type Locker interface {
TryLock(p models.Project, workspace string, pull models.PullRequest, user models.User) (TryLockResponse, error)

View File

@@ -196,7 +196,7 @@ func TestApplyLocker(t *testing.T) {
t.Run("backend errors", func(t *testing.T) {
backend := mocks.NewMockBackend()
When(backend.LockCommand(matchers.AnyModelsCommandName(), matchers.AnyTimeTime())).ThenReturn(nil, errExpected)
When(backend.LockCommand(matchers.AnyCommandName(), matchers.AnyTimeTime())).ThenReturn(nil, errExpected)
l := locking.NewApplyClient(backend, false)
lock, err := l.LockApply()
Equals(t, errExpected, err)
@@ -210,13 +210,13 @@ func TestApplyLocker(t *testing.T) {
_, err := l.LockApply()
ErrEquals(t, "DisableApplyFlag is set; Apply commands are locked globally until flag is unset", err)
backend.VerifyWasCalled(Never()).LockCommand(matchers.AnyModelsCommandName(), matchers.AnyTimeTime())
backend.VerifyWasCalled(Never()).LockCommand(matchers.AnyCommandName(), matchers.AnyTimeTime())
})
t.Run("succeeds", func(t *testing.T) {
backend := mocks.NewMockBackend()
When(backend.LockCommand(matchers.AnyModelsCommandName(), matchers.AnyTimeTime())).ThenReturn(applyLock, nil)
When(backend.LockCommand(matchers.AnyCommandName(), matchers.AnyTimeTime())).ThenReturn(applyLock, nil)
l := locking.NewApplyClient(backend, false)
lock, _ := l.LockApply()
Assert(t, lock.Locked, "exp lock present")
@@ -227,7 +227,7 @@ func TestApplyLocker(t *testing.T) {
t.Run("backend fails", func(t *testing.T) {
backend := mocks.NewMockBackend()
When(backend.UnlockCommand(matchers.AnyModelsCommandName())).ThenReturn(errExpected)
When(backend.UnlockCommand(matchers.AnyCommandName())).ThenReturn(errExpected)
l := locking.NewApplyClient(backend, false)
err := l.UnlockApply()
Equals(t, errExpected, err)
@@ -240,13 +240,13 @@ func TestApplyLocker(t *testing.T) {
err := l.UnlockApply()
ErrEquals(t, "apply commands are disabled until DisableApply flag is unset", err)
backend.VerifyWasCalled(Never()).UnlockCommand(matchers.AnyModelsCommandName())
backend.VerifyWasCalled(Never()).UnlockCommand(matchers.AnyCommandName())
})
t.Run("succeeds", func(t *testing.T) {
backend := mocks.NewMockBackend()
When(backend.UnlockCommand(matchers.AnyModelsCommandName())).ThenReturn(nil)
When(backend.UnlockCommand(matchers.AnyCommandName())).ThenReturn(nil)
l := locking.NewApplyClient(backend, false)
err := l.UnlockApply()
Equals(t, nil, err)
@@ -258,7 +258,7 @@ func TestApplyLocker(t *testing.T) {
t.Run("fails", func(t *testing.T) {
backend := mocks.NewMockBackend()
When(backend.CheckCommandLock(matchers.AnyModelsCommandName())).ThenReturn(nil, errExpected)
When(backend.CheckCommandLock(matchers.AnyCommandName())).ThenReturn(nil, errExpected)
l := locking.NewApplyClient(backend, false)
lock, err := l.CheckApplyLock()
Equals(t, errExpected, err)
@@ -272,13 +272,13 @@ func TestApplyLocker(t *testing.T) {
lock, err := l.CheckApplyLock()
Ok(t, err)
Equals(t, lock.Locked, true)
backend.VerifyWasCalled(Never()).CheckCommandLock(matchers.AnyModelsCommandName())
backend.VerifyWasCalled(Never()).CheckCommandLock(matchers.AnyCommandName())
})
t.Run("UnlockCommand succeeds", func(t *testing.T) {
backend := mocks.NewMockBackend()
When(backend.CheckCommandLock(matchers.AnyModelsCommandName())).ThenReturn(applyLock, nil)
When(backend.CheckCommandLock(matchers.AnyCommandName())).ThenReturn(applyLock, nil)
l := locking.NewApplyClient(backend, false)
lock, err := l.CheckApplyLock()
Equals(t, nil, err)

View File

@@ -1,21 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
locking "github.com/runatlantis/atlantis/server/core/locking"
)
func AnyLockingApplyCommandLockResponse() locking.ApplyCommandLock {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(locking.ApplyCommandLock))(nil)).Elem()))
var nullValue locking.ApplyCommandLock
return nullValue
}
func EqLockingApplyCommandLockResponse(value locking.ApplyCommandLock) locking.ApplyCommandLock {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue locking.ApplyCommandLock
return nullValue
}

View File

@@ -1,21 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
command "github.com/runatlantis/atlantis/server/events/command"
)
func AnyModelsCommandLock() command.Lock {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(command.Lock))(nil)).Elem()))
var nullValue command.Lock
return nullValue
}
func EqModelsCommandLock(value command.Lock) command.Lock {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue command.Lock
return nullValue
}

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"github.com/runatlantis/atlantis/server/events/command"
)
func AnyModelsCommandName() command.Name {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(command.Name))(nil)).Elem()))
var nullValue command.Name
return nullValue
}
func EqModelsCommandName(value command.Name) command.Name {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue command.Name
return nullValue
}
func NotEqModelsCommandName(value command.Name) command.Name {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue command.Name
return nullValue
}
func ModelsCommandNameThat(matcher pegomock.ArgumentMatcher) command.Name {
pegomock.RegisterMatcher(matcher)
var nullValue command.Name
return nullValue
}

View File

@@ -1,34 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
command "github.com/runatlantis/atlantis/server/events/command"
)
func AnyPtrToModelsCommandLock() *command.Lock {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*command.Lock))(nil)).Elem()))
var nullValue *command.Lock
return nullValue
}
func EqPtrToModelsCommandLock(value *command.Lock) *command.Lock {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue *command.Lock
return nullValue
}
func NotEqPtrToModelsCommandLock(value *command.Lock) *command.Lock {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue *command.Lock
return nullValue
}
func PtrToModelsCommandLockThat(matcher pegomock.ArgumentMatcher) *command.Lock {
pegomock.RegisterMatcher(matcher)
var nullValue *command.Lock
return nullValue
}

View File

@@ -25,6 +25,25 @@ func NewMockApplyLocker(options ...pegomock.Option) *MockApplyLocker {
func (mock *MockApplyLocker) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockApplyLocker) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockApplyLocker) CheckApplyLock() (locking.ApplyCommandLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockApplyLocker().")
}
params := []pegomock.Param{}
result := pegomock.GetGenericMockFrom(mock).Invoke("CheckApplyLock", params, []reflect.Type{reflect.TypeOf((*locking.ApplyCommandLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 locking.ApplyCommandLock
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(locking.ApplyCommandLock)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockApplyLocker) LockApply() (locking.ApplyCommandLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockApplyLocker().")
@@ -59,25 +78,6 @@ func (mock *MockApplyLocker) UnlockApply() error {
return ret0
}
func (mock *MockApplyLocker) CheckApplyLock() (locking.ApplyCommandLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockApplyLocker().")
}
params := []pegomock.Param{}
result := pegomock.GetGenericMockFrom(mock).Invoke("CheckApplyLock", params, []reflect.Type{reflect.TypeOf((*locking.ApplyCommandLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 locking.ApplyCommandLock
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(locking.ApplyCommandLock)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockApplyLocker) VerifyWasCalledOnce() *VerifierMockApplyLocker {
return &VerifierMockApplyLocker{
mock: mock,
@@ -115,6 +115,23 @@ type VerifierMockApplyLocker struct {
timeout time.Duration
}
func (verifier *VerifierMockApplyLocker) CheckApplyLock() *MockApplyLocker_CheckApplyLock_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CheckApplyLock", params, verifier.timeout)
return &MockApplyLocker_CheckApplyLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockApplyLocker_CheckApplyLock_OngoingVerification struct {
mock *MockApplyLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *MockApplyLocker_CheckApplyLock_OngoingVerification) GetCapturedArguments() {
}
func (c *MockApplyLocker_CheckApplyLock_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierMockApplyLocker) LockApply() *MockApplyLocker_LockApply_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "LockApply", params, verifier.timeout)
@@ -148,20 +165,3 @@ func (c *MockApplyLocker_UnlockApply_OngoingVerification) GetCapturedArguments()
func (c *MockApplyLocker_UnlockApply_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierMockApplyLocker) CheckApplyLock() *MockApplyLocker_CheckApplyLock_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CheckApplyLock", params, verifier.timeout)
return &MockApplyLocker_CheckApplyLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockApplyLocker_CheckApplyLock_OngoingVerification struct {
mock *MockApplyLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *MockApplyLocker_CheckApplyLock_OngoingVerification) GetCapturedArguments() {
}
func (c *MockApplyLocker_CheckApplyLock_OngoingVerification) GetAllCapturedArguments() {
}

View File

@@ -26,35 +26,46 @@ func NewMockBackend(options ...pegomock.Option) *MockBackend {
func (mock *MockBackend) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockBackend) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockBackend) TryLock(lock models.ProjectLock) (bool, models.ProjectLock, error) {
func (mock *MockBackend) CheckCommandLock(_param0 command.Name) (*command.Lock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{lock}
result := pegomock.GetGenericMockFrom(mock).Invoke("TryLock", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem(), reflect.TypeOf((*models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 bool
var ret1 models.ProjectLock
var ret2 error
params := []pegomock.Param{_param0}
result := pegomock.GetGenericMockFrom(mock).Invoke("CheckCommandLock", params, []reflect.Type{reflect.TypeOf((**command.Lock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 *command.Lock
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(bool)
ret0 = result[0].(*command.Lock)
}
if result[1] != nil {
ret1 = result[1].(models.ProjectLock)
}
if result[2] != nil {
ret2 = result[2].(error)
ret1 = result[1].(error)
}
}
return ret0, ret1, ret2
return ret0, ret1
}
func (mock *MockBackend) Unlock(project models.Project, workspace string) (*models.ProjectLock, error) {
func (mock *MockBackend) DeletePullStatus(_param0 models.PullRequest) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{project, workspace}
result := pegomock.GetGenericMockFrom(mock).Invoke("Unlock", params, []reflect.Type{reflect.TypeOf((**models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
params := []pegomock.Param{_param0}
result := pegomock.GetGenericMockFrom(mock).Invoke("DeletePullStatus", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(error)
}
}
return ret0
}
func (mock *MockBackend) GetLock(_param0 models.Project, _param1 string) (*models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("GetLock", params, []reflect.Type{reflect.TypeOf((**models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 *models.ProjectLock
var ret1 error
if len(result) != 0 {
@@ -68,6 +79,25 @@ func (mock *MockBackend) Unlock(project models.Project, workspace string) (*mode
return ret0, ret1
}
func (mock *MockBackend) GetPullStatus(_param0 models.PullRequest) (*models.PullStatus, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{_param0}
result := pegomock.GetGenericMockFrom(mock).Invoke("GetPullStatus", params, []reflect.Type{reflect.TypeOf((**models.PullStatus)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 *models.PullStatus
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(*models.PullStatus)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockBackend) List() ([]models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
@@ -87,117 +117,11 @@ func (mock *MockBackend) List() ([]models.ProjectLock, error) {
return ret0, ret1
}
func (mock *MockBackend) GetLock(project models.Project, workspace string) (*models.ProjectLock, error) {
func (mock *MockBackend) LockCommand(_param0 command.Name, _param1 time.Time) (*command.Lock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{project, workspace}
result := pegomock.GetGenericMockFrom(mock).Invoke("GetLock", params, []reflect.Type{reflect.TypeOf((**models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 *models.ProjectLock
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(*models.ProjectLock)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockBackend) UnlockByPull(repoFullName string, pullNum int) ([]models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{repoFullName, pullNum}
result := pegomock.GetGenericMockFrom(mock).Invoke("UnlockByPull", params, []reflect.Type{reflect.TypeOf((*[]models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 []models.ProjectLock
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].([]models.ProjectLock)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockBackend) UpdateProjectStatus(pull models.PullRequest, workspace string, repoRelDir string, newStatus models.ProjectPlanStatus) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{pull, workspace, repoRelDir, newStatus}
result := pegomock.GetGenericMockFrom(mock).Invoke("UpdateProjectStatus", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(error)
}
}
return ret0
}
func (mock *MockBackend) GetPullStatus(pull models.PullRequest) (*models.PullStatus, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{pull}
result := pegomock.GetGenericMockFrom(mock).Invoke("GetPullStatus", params, []reflect.Type{reflect.TypeOf((**models.PullStatus)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 *models.PullStatus
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(*models.PullStatus)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockBackend) DeletePullStatus(pull models.PullRequest) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{pull}
result := pegomock.GetGenericMockFrom(mock).Invoke("DeletePullStatus", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(error)
}
}
return ret0
}
func (mock *MockBackend) UpdatePullWithResults(pull models.PullRequest, newResults []command.ProjectResult) (models.PullStatus, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{pull, newResults}
result := pegomock.GetGenericMockFrom(mock).Invoke("UpdatePullWithResults", params, []reflect.Type{reflect.TypeOf((*models.PullStatus)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 models.PullStatus
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(models.PullStatus)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockBackend) LockCommand(cmdName command.Name, lockTime time.Time) (*command.Lock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{cmdName, lockTime}
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("LockCommand", params, []reflect.Type{reflect.TypeOf((**command.Lock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 *command.Lock
var ret1 error
@@ -212,11 +136,72 @@ func (mock *MockBackend) LockCommand(cmdName command.Name, lockTime time.Time) (
return ret0, ret1
}
func (mock *MockBackend) UnlockCommand(cmdName command.Name) error {
func (mock *MockBackend) TryLock(_param0 models.ProjectLock) (bool, models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{cmdName}
params := []pegomock.Param{_param0}
result := pegomock.GetGenericMockFrom(mock).Invoke("TryLock", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem(), reflect.TypeOf((*models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 bool
var ret1 models.ProjectLock
var ret2 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(bool)
}
if result[1] != nil {
ret1 = result[1].(models.ProjectLock)
}
if result[2] != nil {
ret2 = result[2].(error)
}
}
return ret0, ret1, ret2
}
func (mock *MockBackend) Unlock(_param0 models.Project, _param1 string) (*models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("Unlock", params, []reflect.Type{reflect.TypeOf((**models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 *models.ProjectLock
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(*models.ProjectLock)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockBackend) UnlockByPull(_param0 string, _param1 int) ([]models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("UnlockByPull", params, []reflect.Type{reflect.TypeOf((*[]models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 []models.ProjectLock
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].([]models.ProjectLock)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockBackend) UnlockCommand(_param0 command.Name) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{_param0}
result := pegomock.GetGenericMockFrom(mock).Invoke("UnlockCommand", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
@@ -227,17 +212,32 @@ func (mock *MockBackend) UnlockCommand(cmdName command.Name) error {
return ret0
}
func (mock *MockBackend) CheckCommandLock(cmdName command.Name) (*command.Lock, error) {
func (mock *MockBackend) UpdateProjectStatus(_param0 models.PullRequest, _param1 string, _param2 string, _param3 models.ProjectPlanStatus) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{cmdName}
result := pegomock.GetGenericMockFrom(mock).Invoke("CheckCommandLock", params, []reflect.Type{reflect.TypeOf((**command.Lock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 *command.Lock
params := []pegomock.Param{_param0, _param1, _param2, _param3}
result := pegomock.GetGenericMockFrom(mock).Invoke("UpdateProjectStatus", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(error)
}
}
return ret0
}
func (mock *MockBackend) UpdatePullWithResults(_param0 models.PullRequest, _param1 []command.ProjectResult) (models.PullStatus, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("UpdatePullWithResults", params, []reflect.Type{reflect.TypeOf((*models.PullStatus)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 models.PullStatus
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(*command.Lock)
ret0 = result[0].(models.PullStatus)
}
if result[1] != nil {
ret1 = result[1].(error)
@@ -283,50 +283,77 @@ type VerifierMockBackend struct {
timeout time.Duration
}
func (verifier *VerifierMockBackend) TryLock(lock models.ProjectLock) *MockBackend_TryLock_OngoingVerification {
params := []pegomock.Param{lock}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TryLock", params, verifier.timeout)
return &MockBackend_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
func (verifier *VerifierMockBackend) CheckCommandLock(_param0 command.Name) *MockBackend_CheckCommandLock_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CheckCommandLock", params, verifier.timeout)
return &MockBackend_CheckCommandLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockBackend_TryLock_OngoingVerification struct {
type MockBackend_CheckCommandLock_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *MockBackend_TryLock_OngoingVerification) GetCapturedArguments() models.ProjectLock {
lock := c.GetAllCapturedArguments()
return lock[len(lock)-1]
func (c *MockBackend_CheckCommandLock_OngoingVerification) GetCapturedArguments() command.Name {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *MockBackend_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectLock) {
func (c *MockBackend_CheckCommandLock_OngoingVerification) GetAllCapturedArguments() (_param0 []command.Name) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.ProjectLock, len(c.methodInvocations))
_param0 = make([]command.Name, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(models.ProjectLock)
_param0[u] = param.(command.Name)
}
}
return
}
func (verifier *VerifierMockBackend) Unlock(project models.Project, workspace string) *MockBackend_Unlock_OngoingVerification {
params := []pegomock.Param{project, workspace}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Unlock", params, verifier.timeout)
return &MockBackend_Unlock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
func (verifier *VerifierMockBackend) DeletePullStatus(_param0 models.PullRequest) *MockBackend_DeletePullStatus_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DeletePullStatus", params, verifier.timeout)
return &MockBackend_DeletePullStatus_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockBackend_Unlock_OngoingVerification struct {
type MockBackend_DeletePullStatus_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *MockBackend_Unlock_OngoingVerification) GetCapturedArguments() (models.Project, string) {
project, workspace := c.GetAllCapturedArguments()
return project[len(project)-1], workspace[len(workspace)-1]
func (c *MockBackend_DeletePullStatus_OngoingVerification) GetCapturedArguments() models.PullRequest {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *MockBackend_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string) {
func (c *MockBackend_DeletePullStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.PullRequest, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(models.PullRequest)
}
}
return
}
func (verifier *VerifierMockBackend) GetLock(_param0 models.Project, _param1 string) *MockBackend_GetLock_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetLock", params, verifier.timeout)
return &MockBackend_GetLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockBackend_GetLock_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *MockBackend_GetLock_OngoingVerification) GetCapturedArguments() (models.Project, string) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockBackend_GetLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Project, len(c.methodInvocations))
@@ -341,6 +368,33 @@ func (c *MockBackend_Unlock_OngoingVerification) GetAllCapturedArguments() (_par
return
}
func (verifier *VerifierMockBackend) GetPullStatus(_param0 models.PullRequest) *MockBackend_GetPullStatus_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetPullStatus", params, verifier.timeout)
return &MockBackend_GetPullStatus_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockBackend_GetPullStatus_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *MockBackend_GetPullStatus_OngoingVerification) GetCapturedArguments() models.PullRequest {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *MockBackend_GetPullStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.PullRequest, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(models.PullRequest)
}
}
return
}
func (verifier *VerifierMockBackend) List() *MockBackend_List_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "List", params, verifier.timeout)
@@ -358,23 +412,81 @@ func (c *MockBackend_List_OngoingVerification) GetCapturedArguments() {
func (c *MockBackend_List_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierMockBackend) GetLock(project models.Project, workspace string) *MockBackend_GetLock_OngoingVerification {
params := []pegomock.Param{project, workspace}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetLock", params, verifier.timeout)
return &MockBackend_GetLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
func (verifier *VerifierMockBackend) LockCommand(_param0 command.Name, _param1 time.Time) *MockBackend_LockCommand_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "LockCommand", params, verifier.timeout)
return &MockBackend_LockCommand_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockBackend_GetLock_OngoingVerification struct {
type MockBackend_LockCommand_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *MockBackend_GetLock_OngoingVerification) GetCapturedArguments() (models.Project, string) {
project, workspace := c.GetAllCapturedArguments()
return project[len(project)-1], workspace[len(workspace)-1]
func (c *MockBackend_LockCommand_OngoingVerification) GetCapturedArguments() (command.Name, time.Time) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockBackend_GetLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string) {
func (c *MockBackend_LockCommand_OngoingVerification) GetAllCapturedArguments() (_param0 []command.Name, _param1 []time.Time) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]command.Name, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(command.Name)
}
_param1 = make([]time.Time, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(time.Time)
}
}
return
}
func (verifier *VerifierMockBackend) TryLock(_param0 models.ProjectLock) *MockBackend_TryLock_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TryLock", params, verifier.timeout)
return &MockBackend_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockBackend_TryLock_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *MockBackend_TryLock_OngoingVerification) GetCapturedArguments() models.ProjectLock {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *MockBackend_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectLock) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.ProjectLock, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(models.ProjectLock)
}
}
return
}
func (verifier *VerifierMockBackend) Unlock(_param0 models.Project, _param1 string) *MockBackend_Unlock_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Unlock", params, verifier.timeout)
return &MockBackend_Unlock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockBackend_Unlock_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *MockBackend_Unlock_OngoingVerification) GetCapturedArguments() (models.Project, string) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockBackend_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Project, len(c.methodInvocations))
@@ -389,8 +501,8 @@ func (c *MockBackend_GetLock_OngoingVerification) GetAllCapturedArguments() (_pa
return
}
func (verifier *VerifierMockBackend) UnlockByPull(repoFullName string, pullNum int) *MockBackend_UnlockByPull_OngoingVerification {
params := []pegomock.Param{repoFullName, pullNum}
func (verifier *VerifierMockBackend) UnlockByPull(_param0 string, _param1 int) *MockBackend_UnlockByPull_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UnlockByPull", params, verifier.timeout)
return &MockBackend_UnlockByPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -401,8 +513,8 @@ type MockBackend_UnlockByPull_OngoingVerification struct {
}
func (c *MockBackend_UnlockByPull_OngoingVerification) GetCapturedArguments() (string, int) {
repoFullName, pullNum := c.GetAllCapturedArguments()
return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1]
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockBackend_UnlockByPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) {
@@ -420,8 +532,35 @@ func (c *MockBackend_UnlockByPull_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierMockBackend) UpdateProjectStatus(pull models.PullRequest, workspace string, repoRelDir string, newStatus models.ProjectPlanStatus) *MockBackend_UpdateProjectStatus_OngoingVerification {
params := []pegomock.Param{pull, workspace, repoRelDir, newStatus}
func (verifier *VerifierMockBackend) UnlockCommand(_param0 command.Name) *MockBackend_UnlockCommand_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UnlockCommand", params, verifier.timeout)
return &MockBackend_UnlockCommand_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockBackend_UnlockCommand_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *MockBackend_UnlockCommand_OngoingVerification) GetCapturedArguments() command.Name {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *MockBackend_UnlockCommand_OngoingVerification) GetAllCapturedArguments() (_param0 []command.Name) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]command.Name, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(command.Name)
}
}
return
}
func (verifier *VerifierMockBackend) UpdateProjectStatus(_param0 models.PullRequest, _param1 string, _param2 string, _param3 models.ProjectPlanStatus) *MockBackend_UpdateProjectStatus_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2, _param3}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdateProjectStatus", params, verifier.timeout)
return &MockBackend_UpdateProjectStatus_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -432,8 +571,8 @@ type MockBackend_UpdateProjectStatus_OngoingVerification struct {
}
func (c *MockBackend_UpdateProjectStatus_OngoingVerification) GetCapturedArguments() (models.PullRequest, string, string, models.ProjectPlanStatus) {
pull, workspace, repoRelDir, newStatus := c.GetAllCapturedArguments()
return pull[len(pull)-1], workspace[len(workspace)-1], repoRelDir[len(repoRelDir)-1], newStatus[len(newStatus)-1]
_param0, _param1, _param2, _param3 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1]
}
func (c *MockBackend_UpdateProjectStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest, _param1 []string, _param2 []string, _param3 []models.ProjectPlanStatus) {
@@ -459,62 +598,8 @@ func (c *MockBackend_UpdateProjectStatus_OngoingVerification) GetAllCapturedArgu
return
}
func (verifier *VerifierMockBackend) GetPullStatus(pull models.PullRequest) *MockBackend_GetPullStatus_OngoingVerification {
params := []pegomock.Param{pull}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetPullStatus", params, verifier.timeout)
return &MockBackend_GetPullStatus_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockBackend_GetPullStatus_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *MockBackend_GetPullStatus_OngoingVerification) GetCapturedArguments() models.PullRequest {
pull := c.GetAllCapturedArguments()
return pull[len(pull)-1]
}
func (c *MockBackend_GetPullStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.PullRequest, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(models.PullRequest)
}
}
return
}
func (verifier *VerifierMockBackend) DeletePullStatus(pull models.PullRequest) *MockBackend_DeletePullStatus_OngoingVerification {
params := []pegomock.Param{pull}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DeletePullStatus", params, verifier.timeout)
return &MockBackend_DeletePullStatus_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockBackend_DeletePullStatus_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *MockBackend_DeletePullStatus_OngoingVerification) GetCapturedArguments() models.PullRequest {
pull := c.GetAllCapturedArguments()
return pull[len(pull)-1]
}
func (c *MockBackend_DeletePullStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.PullRequest, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(models.PullRequest)
}
}
return
}
func (verifier *VerifierMockBackend) UpdatePullWithResults(pull models.PullRequest, newResults []command.ProjectResult) *MockBackend_UpdatePullWithResults_OngoingVerification {
params := []pegomock.Param{pull, newResults}
func (verifier *VerifierMockBackend) UpdatePullWithResults(_param0 models.PullRequest, _param1 []command.ProjectResult) *MockBackend_UpdatePullWithResults_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdatePullWithResults", params, verifier.timeout)
return &MockBackend_UpdatePullWithResults_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -525,8 +610,8 @@ type MockBackend_UpdatePullWithResults_OngoingVerification struct {
}
func (c *MockBackend_UpdatePullWithResults_OngoingVerification) GetCapturedArguments() (models.PullRequest, []command.ProjectResult) {
pull, newResults := c.GetAllCapturedArguments()
return pull[len(pull)-1], newResults[len(newResults)-1]
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockBackend_UpdatePullWithResults_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest, _param1 [][]command.ProjectResult) {
@@ -543,88 +628,3 @@ func (c *MockBackend_UpdatePullWithResults_OngoingVerification) GetAllCapturedAr
}
return
}
func (verifier *VerifierMockBackend) LockCommand(cmdName command.Name, lockTime time.Time) *MockBackend_LockCommand_OngoingVerification {
params := []pegomock.Param{cmdName, lockTime}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "LockCommand", params, verifier.timeout)
return &MockBackend_LockCommand_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockBackend_LockCommand_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *MockBackend_LockCommand_OngoingVerification) GetCapturedArguments() (command.Name, time.Time) {
cmdName, lockTime := c.GetAllCapturedArguments()
return cmdName[len(cmdName)-1], lockTime[len(lockTime)-1]
}
func (c *MockBackend_LockCommand_OngoingVerification) GetAllCapturedArguments() (_param0 []command.Name, _param1 []time.Time) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]command.Name, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(command.Name)
}
_param1 = make([]time.Time, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(time.Time)
}
}
return
}
func (verifier *VerifierMockBackend) UnlockCommand(cmdName command.Name) *MockBackend_UnlockCommand_OngoingVerification {
params := []pegomock.Param{cmdName}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UnlockCommand", params, verifier.timeout)
return &MockBackend_UnlockCommand_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockBackend_UnlockCommand_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *MockBackend_UnlockCommand_OngoingVerification) GetCapturedArguments() command.Name {
cmdName := c.GetAllCapturedArguments()
return cmdName[len(cmdName)-1]
}
func (c *MockBackend_UnlockCommand_OngoingVerification) GetAllCapturedArguments() (_param0 []command.Name) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]command.Name, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(command.Name)
}
}
return
}
func (verifier *VerifierMockBackend) CheckCommandLock(cmdName command.Name) *MockBackend_CheckCommandLock_OngoingVerification {
params := []pegomock.Param{cmdName}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CheckCommandLock", params, verifier.timeout)
return &MockBackend_CheckCommandLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockBackend_CheckCommandLock_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *MockBackend_CheckCommandLock_OngoingVerification) GetCapturedArguments() command.Name {
cmdName := c.GetAllCapturedArguments()
return cmdName[len(cmdName)-1]
}
func (c *MockBackend_CheckCommandLock_OngoingVerification) GetAllCapturedArguments() (_param0 []command.Name) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]command.Name, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(command.Name)
}
}
return
}

View File

@@ -26,31 +26,12 @@ func NewMockLocker(options ...pegomock.Option) *MockLocker {
func (mock *MockLocker) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockLocker) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockLocker) TryLock(p models.Project, workspace string, pull models.PullRequest, user models.User) (locking.TryLockResponse, error) {
func (mock *MockLocker) GetLock(_param0 string) (*models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockLocker().")
}
params := []pegomock.Param{p, workspace, pull, user}
result := pegomock.GetGenericMockFrom(mock).Invoke("TryLock", params, []reflect.Type{reflect.TypeOf((*locking.TryLockResponse)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 locking.TryLockResponse
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(locking.TryLockResponse)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockLocker) Unlock(key string) (*models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockLocker().")
}
params := []pegomock.Param{key}
result := pegomock.GetGenericMockFrom(mock).Invoke("Unlock", params, []reflect.Type{reflect.TypeOf((**models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
params := []pegomock.Param{_param0}
result := pegomock.GetGenericMockFrom(mock).Invoke("GetLock", params, []reflect.Type{reflect.TypeOf((**models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 *models.ProjectLock
var ret1 error
if len(result) != 0 {
@@ -83,17 +64,17 @@ func (mock *MockLocker) List() (map[string]models.ProjectLock, error) {
return ret0, ret1
}
func (mock *MockLocker) UnlockByPull(repoFullName string, pullNum int) ([]models.ProjectLock, error) {
func (mock *MockLocker) TryLock(_param0 models.Project, _param1 string, _param2 models.PullRequest, _param3 models.User) (locking.TryLockResponse, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockLocker().")
}
params := []pegomock.Param{repoFullName, pullNum}
result := pegomock.GetGenericMockFrom(mock).Invoke("UnlockByPull", params, []reflect.Type{reflect.TypeOf((*[]models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 []models.ProjectLock
params := []pegomock.Param{_param0, _param1, _param2, _param3}
result := pegomock.GetGenericMockFrom(mock).Invoke("TryLock", params, []reflect.Type{reflect.TypeOf((*locking.TryLockResponse)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 locking.TryLockResponse
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].([]models.ProjectLock)
ret0 = result[0].(locking.TryLockResponse)
}
if result[1] != nil {
ret1 = result[1].(error)
@@ -102,12 +83,12 @@ func (mock *MockLocker) UnlockByPull(repoFullName string, pullNum int) ([]models
return ret0, ret1
}
func (mock *MockLocker) GetLock(key string) (*models.ProjectLock, error) {
func (mock *MockLocker) Unlock(_param0 string) (*models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockLocker().")
}
params := []pegomock.Param{key}
result := pegomock.GetGenericMockFrom(mock).Invoke("GetLock", params, []reflect.Type{reflect.TypeOf((**models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
params := []pegomock.Param{_param0}
result := pegomock.GetGenericMockFrom(mock).Invoke("Unlock", params, []reflect.Type{reflect.TypeOf((**models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 *models.ProjectLock
var ret1 error
if len(result) != 0 {
@@ -121,6 +102,25 @@ func (mock *MockLocker) GetLock(key string) (*models.ProjectLock, error) {
return ret0, ret1
}
func (mock *MockLocker) UnlockByPull(_param0 string, _param1 int) ([]models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockLocker().")
}
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("UnlockByPull", params, []reflect.Type{reflect.TypeOf((*[]models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 []models.ProjectLock
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].([]models.ProjectLock)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockLocker) VerifyWasCalledOnce() *VerifierMockLocker {
return &VerifierMockLocker{
mock: mock,
@@ -158,62 +158,23 @@ type VerifierMockLocker struct {
timeout time.Duration
}
func (verifier *VerifierMockLocker) TryLock(p models.Project, workspace string, pull models.PullRequest, user models.User) *MockLocker_TryLock_OngoingVerification {
params := []pegomock.Param{p, workspace, pull, user}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TryLock", params, verifier.timeout)
return &MockLocker_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
func (verifier *VerifierMockLocker) GetLock(_param0 string) *MockLocker_GetLock_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetLock", params, verifier.timeout)
return &MockLocker_GetLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockLocker_TryLock_OngoingVerification struct {
type MockLocker_GetLock_OngoingVerification struct {
mock *MockLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *MockLocker_TryLock_OngoingVerification) GetCapturedArguments() (models.Project, string, models.PullRequest, models.User) {
p, workspace, pull, user := c.GetAllCapturedArguments()
return p[len(p)-1], workspace[len(workspace)-1], pull[len(pull)-1], user[len(user)-1]
func (c *MockLocker_GetLock_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *MockLocker_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string, _param2 []models.PullRequest, _param3 []models.User) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Project, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(models.Project)
}
_param1 = make([]string, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(string)
}
_param2 = make([]models.PullRequest, len(c.methodInvocations))
for u, param := range params[2] {
_param2[u] = param.(models.PullRequest)
}
_param3 = make([]models.User, len(c.methodInvocations))
for u, param := range params[3] {
_param3[u] = param.(models.User)
}
}
return
}
func (verifier *VerifierMockLocker) Unlock(key string) *MockLocker_Unlock_OngoingVerification {
params := []pegomock.Param{key}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Unlock", params, verifier.timeout)
return &MockLocker_Unlock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockLocker_Unlock_OngoingVerification struct {
mock *MockLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *MockLocker_Unlock_OngoingVerification) GetCapturedArguments() string {
key := c.GetAllCapturedArguments()
return key[len(key)-1]
}
func (c *MockLocker_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockLocker_GetLock_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(c.methodInvocations))
@@ -241,8 +202,74 @@ func (c *MockLocker_List_OngoingVerification) GetCapturedArguments() {
func (c *MockLocker_List_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierMockLocker) UnlockByPull(repoFullName string, pullNum int) *MockLocker_UnlockByPull_OngoingVerification {
params := []pegomock.Param{repoFullName, pullNum}
func (verifier *VerifierMockLocker) TryLock(_param0 models.Project, _param1 string, _param2 models.PullRequest, _param3 models.User) *MockLocker_TryLock_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2, _param3}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TryLock", params, verifier.timeout)
return &MockLocker_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockLocker_TryLock_OngoingVerification struct {
mock *MockLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *MockLocker_TryLock_OngoingVerification) GetCapturedArguments() (models.Project, string, models.PullRequest, models.User) {
_param0, _param1, _param2, _param3 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1]
}
func (c *MockLocker_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string, _param2 []models.PullRequest, _param3 []models.User) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Project, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(models.Project)
}
_param1 = make([]string, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(string)
}
_param2 = make([]models.PullRequest, len(c.methodInvocations))
for u, param := range params[2] {
_param2[u] = param.(models.PullRequest)
}
_param3 = make([]models.User, len(c.methodInvocations))
for u, param := range params[3] {
_param3[u] = param.(models.User)
}
}
return
}
func (verifier *VerifierMockLocker) Unlock(_param0 string) *MockLocker_Unlock_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Unlock", params, verifier.timeout)
return &MockLocker_Unlock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockLocker_Unlock_OngoingVerification struct {
mock *MockLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *MockLocker_Unlock_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *MockLocker_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(string)
}
}
return
}
func (verifier *VerifierMockLocker) UnlockByPull(_param0 string, _param1 int) *MockLocker_UnlockByPull_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UnlockByPull", params, verifier.timeout)
return &MockLocker_UnlockByPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -253,8 +280,8 @@ type MockLocker_UnlockByPull_OngoingVerification struct {
}
func (c *MockLocker_UnlockByPull_OngoingVerification) GetCapturedArguments() (string, int) {
repoFullName, pullNum := c.GetAllCapturedArguments()
return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1]
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockLocker_UnlockByPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) {
@@ -271,30 +298,3 @@ func (c *MockLocker_UnlockByPull_OngoingVerification) GetAllCapturedArguments()
}
return
}
func (verifier *VerifierMockLocker) GetLock(key string) *MockLocker_GetLock_OngoingVerification {
params := []pegomock.Param{key}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetLock", params, verifier.timeout)
return &MockLocker_GetLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockLocker_GetLock_OngoingVerification struct {
mock *MockLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *MockLocker_GetLock_OngoingVerification) GetCapturedArguments() string {
key := c.GetAllCapturedArguments()
return key[len(key)-1]
}
func (c *MockLocker_GetLock_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(string)
}
}
return
}

View File

@@ -66,7 +66,7 @@ func TestRun_Success(t *testing.T) {
TerraformExecutor: terraform,
}
When(terraform.RunCommandWithVersion(matchers.AnyModelsProjectCommandContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
output, err := o.Run(ctx, []string{"extra", "args"}, tmpDir, map[string]string(nil))
Ok(t, err)
@@ -98,7 +98,7 @@ func TestRun_AppliesCorrectProjectPlan(t *testing.T) {
TerraformExecutor: terraform,
}
When(terraform.RunCommandWithVersion(matchers.AnyModelsProjectCommandContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
output, err := o.Run(ctx, []string{"extra", "args"}, tmpDir, map[string]string(nil))
Ok(t, err)
@@ -130,7 +130,7 @@ func TestRun_UsesConfiguredTFVersion(t *testing.T) {
TerraformExecutor: terraform,
}
When(terraform.RunCommandWithVersion(matchers.AnyModelsProjectCommandContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
output, err := o.Run(ctx, []string{"extra", "args"}, tmpDir, map[string]string(nil))
Ok(t, err)

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
go_version "github.com/hashicorp/go-version"
)

View File

@@ -4,11 +4,10 @@
package mocks
import (
"reflect"
"time"
go_version "github.com/hashicorp/go-version"
pegomock "github.com/petergtz/pegomock"
"reflect"
"time"
)
type MockKeySerializer struct {
@@ -26,11 +25,11 @@ func NewMockKeySerializer(options ...pegomock.Option) *MockKeySerializer {
func (mock *MockKeySerializer) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockKeySerializer) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockKeySerializer) Serialize(key *go_version.Version) (string, error) {
func (mock *MockKeySerializer) Serialize(_param0 *go_version.Version) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockKeySerializer().")
}
params := []pegomock.Param{key}
params := []pegomock.Param{_param0}
result := pegomock.GetGenericMockFrom(mock).Invoke("Serialize", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 string
var ret1 error
@@ -82,8 +81,8 @@ type VerifierMockKeySerializer struct {
timeout time.Duration
}
func (verifier *VerifierMockKeySerializer) Serialize(key *go_version.Version) *MockKeySerializer_Serialize_OngoingVerification {
params := []pegomock.Param{key}
func (verifier *VerifierMockKeySerializer) Serialize(_param0 *go_version.Version) *MockKeySerializer_Serialize_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Serialize", params, verifier.timeout)
return &MockKeySerializer_Serialize_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -94,8 +93,8 @@ type MockKeySerializer_Serialize_OngoingVerification struct {
}
func (c *MockKeySerializer_Serialize_OngoingVerification) GetCapturedArguments() *go_version.Version {
key := c.GetAllCapturedArguments()
return key[len(key)-1]
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *MockKeySerializer_Serialize_OngoingVerification) GetAllCapturedArguments() (_param0 []*go_version.Version) {

View File

@@ -4,11 +4,10 @@
package mocks
import (
"reflect"
"time"
go_version "github.com/hashicorp/go-version"
pegomock "github.com/petergtz/pegomock"
"reflect"
"time"
)
type MockExecutionVersionCache struct {
@@ -26,11 +25,11 @@ func NewMockExecutionVersionCache(options ...pegomock.Option) *MockExecutionVers
func (mock *MockExecutionVersionCache) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockExecutionVersionCache) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockExecutionVersionCache) Get(key *go_version.Version) (string, error) {
func (mock *MockExecutionVersionCache) Get(_param0 *go_version.Version) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockExecutionVersionCache().")
}
params := []pegomock.Param{key}
params := []pegomock.Param{_param0}
result := pegomock.GetGenericMockFrom(mock).Invoke("Get", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 string
var ret1 error
@@ -82,8 +81,8 @@ type VerifierMockExecutionVersionCache struct {
timeout time.Duration
}
func (verifier *VerifierMockExecutionVersionCache) Get(key *go_version.Version) *MockExecutionVersionCache_Get_OngoingVerification {
params := []pegomock.Param{key}
func (verifier *VerifierMockExecutionVersionCache) Get(_param0 *go_version.Version) *MockExecutionVersionCache_Get_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Get", params, verifier.timeout)
return &MockExecutionVersionCache_Get_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -94,8 +93,8 @@ type MockExecutionVersionCache_Get_OngoingVerification struct {
}
func (c *MockExecutionVersionCache_Get_OngoingVerification) GetCapturedArguments() *go_version.Version {
key := c.GetAllCapturedArguments()
return key[len(key)-1]
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *MockExecutionVersionCache_Get_OngoingVerification) GetAllCapturedArguments() (_param0 []*go_version.Version) {

View File

@@ -9,8 +9,8 @@ import (
"github.com/runatlantis/atlantis/server/core/runtime/models"
)
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_version_path.go ExecutionVersionCache
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_key_serializer.go KeySerializer
//go:generate pegomock generate -m --package mocks -o mocks/mock_version_path.go ExecutionVersionCache
//go:generate pegomock generate -m --package mocks -o mocks/mock_key_serializer.go KeySerializer
type ExecutionVersionCache interface {
Get(key *version.Version) (string, error)

View File

@@ -6,7 +6,7 @@ import (
"github.com/runatlantis/atlantis/server/logging"
)
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_versionedexecutorworkflow.go VersionedExecutorWorkflow
//go:generate pegomock generate -m --package mocks -o mocks/mock_versionedexecutorworkflow.go VersionedExecutorWorkflow
// VersionedExecutorWorkflow defines a versioned execution for a given project context
type VersionedExecutorWorkflow interface {

View File

@@ -49,7 +49,7 @@ func TestImportStepRunner_Run_Success(t *testing.T) {
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(matchers.AnyModelsProjectCommandContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
output, err := s.Run(context, []string{}, tmpDir, map[string]string(nil))
Ok(t, err)

View File

@@ -60,7 +60,7 @@ func TestRun_UsesGetOrInitForRightVersion(t *testing.T) {
TerraformExecutor: terraform,
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(matchers.AnyModelsProjectCommandContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
output, err := iso.Run(ctx, []string{"extra", "args"}, "/path", map[string]string(nil))
@@ -83,7 +83,7 @@ func TestRun_ShowInitOutputOnError(t *testing.T) {
RegisterMockTestingT(t)
tfClient := mocks.NewMockClient()
logger := logging.NewNoopLogger(t)
When(tfClient.RunCommandWithVersion(matchers.AnyModelsProjectCommandContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(tfClient.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", errors.New("error"))
tfVersion, _ := version.NewVersion("0.11.0")
@@ -127,7 +127,7 @@ func TestRun_InitOmitsUpgradeFlagIfLockFileTracked(t *testing.T) {
TerraformExecutor: terraform,
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(matchers.AnyModelsProjectCommandContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
output, err := iso.Run(ctx, []string{"extra", "args"}, repoDir, map[string]string(nil))
@@ -156,7 +156,7 @@ func TestRun_InitKeepsUpgradeFlagIfLockFileNotPresent(t *testing.T) {
TerraformExecutor: terraform,
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(matchers.AnyModelsProjectCommandContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
output, err := iso.Run(ctx, []string{"extra", "args"}, tmpDir, map[string]string(nil))
@@ -189,7 +189,7 @@ func TestRun_InitKeepUpgradeFlagIfLockFilePresentAndTFLessThanPoint14(t *testing
TerraformExecutor: terraform,
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(matchers.AnyModelsProjectCommandContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
output, err := iso.Run(ctx, []string{"extra", "args"}, tmpDir, map[string]string(nil))
@@ -256,7 +256,7 @@ func TestRun_InitExtraArgsDeDupe(t *testing.T) {
TerraformExecutor: terraform,
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(matchers.AnyModelsProjectCommandContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
output, err := iso.Run(ctx, c.extraArgs, "/path", map[string]string(nil))
@@ -288,7 +288,7 @@ func TestRun_InitDeletesLockFileIfPresentAndNotTracked(t *testing.T) {
TerraformExecutor: terraform,
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(matchers.AnyModelsProjectCommandContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
ctx := command.ProjectContext{

View File

@@ -2,31 +2,31 @@
package matchers
import (
"github.com/petergtz/pegomock"
"reflect"
"github.com/petergtz/pegomock"
"github.com/runatlantis/atlantis/server/events/command"
command "github.com/runatlantis/atlantis/server/events/command"
)
func AnyModelsProjectCommandContext() command.ProjectContext {
func AnyCommandProjectContext() command.ProjectContext {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(command.ProjectContext))(nil)).Elem()))
var nullValue command.ProjectContext
return nullValue
}
func EqModelsProjectCommandContext(value command.ProjectContext) command.ProjectContext {
func EqCommandProjectContext(value command.ProjectContext) command.ProjectContext {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue command.ProjectContext
return nullValue
}
func NotEqModelsProjectCommandContext(value command.ProjectContext) command.ProjectContext {
func NotEqCommandProjectContext(value command.ProjectContext) command.ProjectContext {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue command.ProjectContext
return nullValue
}
func ModelsProjectCommandContextThat(matcher pegomock.ArgumentMatcher) command.ProjectContext {
func CommandProjectContextThat(matcher pegomock.ArgumentMatcher) command.ProjectContext {
pegomock.RegisterMatcher(matcher)
var nullValue command.ProjectContext
return nullValue

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
"github.com/petergtz/pegomock"
"reflect"
jobs "github.com/runatlantis/atlantis/server/jobs"
)
func AnyJobsProjectCommandOutputHandler() jobs.ProjectCommandOutputHandler {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(jobs.ProjectCommandOutputHandler))(nil)).Elem()))
var nullValue jobs.ProjectCommandOutputHandler
return nullValue
}
func EqJobsProjectCommandOutputHandler(value jobs.ProjectCommandOutputHandler) jobs.ProjectCommandOutputHandler {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue jobs.ProjectCommandOutputHandler
return nullValue
}
func NotEqJobsProjectCommandOutputHandler(value jobs.ProjectCommandOutputHandler) jobs.ProjectCommandOutputHandler {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue jobs.ProjectCommandOutputHandler
return nullValue
}
func JobsProjectCommandOutputHandlerThat(matcher pegomock.ArgumentMatcher) jobs.ProjectCommandOutputHandler {
pegomock.RegisterMatcher(matcher)
var nullValue jobs.ProjectCommandOutputHandler
return nullValue
}

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
logging "github.com/runatlantis/atlantis/server/logging"
)

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
)
func AnyMapOfStringToString() map[string]string {

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
models "github.com/runatlantis/atlantis/server/events/models"
)

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"github.com/runatlantis/atlantis/server/events/command"
)
func AnyModelsProjectCommandContext() command.ProjectContext {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(command.ProjectContext))(nil)).Elem()))
var nullValue command.ProjectContext
return nullValue
}
func EqModelsProjectCommandContext(value command.ProjectContext) command.ProjectContext {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue command.ProjectContext
return nullValue
}
func NotEqModelsProjectCommandContext(value command.ProjectContext) command.ProjectContext {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue command.ProjectContext
return nullValue
}
func ModelsProjectCommandContextThat(matcher pegomock.ArgumentMatcher) command.ProjectContext {
pegomock.RegisterMatcher(matcher)
var nullValue command.ProjectContext
return nullValue
}

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
models "github.com/runatlantis/atlantis/server/events/models"
)

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
models "github.com/runatlantis/atlantis/server/events/models"
)

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
go_version "github.com/hashicorp/go-version"
)

View File

@@ -1,21 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
logging "github.com/runatlantis/atlantis/server/logging"
)
func AnyPtrToLoggingSimpleLogger() logging.SimpleLogging {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(logging.SimpleLogging))(nil)).Elem()))
var nullValue logging.SimpleLogging
return nullValue
}
func EqPtrToLoggingSimpleLogger(value logging.SimpleLogging) logging.SimpleLogging {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue logging.SimpleLogging
return nullValue
}

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
)
func AnySliceOfString() []string {

View File

@@ -25,11 +25,11 @@ func NewMockPostWorkflowHookRunner(options ...pegomock.Option) *MockPostWorkflow
func (mock *MockPostWorkflowHookRunner) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockPostWorkflowHookRunner) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockPostWorkflowHookRunner) Run(ctx models.WorkflowHookCommandContext, command string, path string) (string, string, error) {
func (mock *MockPostWorkflowHookRunner) Run(_param0 models.WorkflowHookCommandContext, _param1 string, _param2 string) (string, string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockPostWorkflowHookRunner().")
}
params := []pegomock.Param{ctx, command, path}
params := []pegomock.Param{_param0, _param1, _param2}
result := pegomock.GetGenericMockFrom(mock).Invoke("Run", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 string
var ret1 string
@@ -85,8 +85,8 @@ type VerifierMockPostWorkflowHookRunner struct {
timeout time.Duration
}
func (verifier *VerifierMockPostWorkflowHookRunner) Run(ctx models.WorkflowHookCommandContext, command string, path string) *MockPostWorkflowHookRunner_Run_OngoingVerification {
params := []pegomock.Param{ctx, command, path}
func (verifier *VerifierMockPostWorkflowHookRunner) Run(_param0 models.WorkflowHookCommandContext, _param1 string, _param2 string) *MockPostWorkflowHookRunner_Run_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Run", params, verifier.timeout)
return &MockPostWorkflowHookRunner_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -97,8 +97,8 @@ type MockPostWorkflowHookRunner_Run_OngoingVerification struct {
}
func (c *MockPostWorkflowHookRunner_Run_OngoingVerification) GetCapturedArguments() (models.WorkflowHookCommandContext, string, string) {
ctx, command, path := c.GetAllCapturedArguments()
return ctx[len(ctx)-1], command[len(command)-1], path[len(path)-1]
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
}
func (c *MockPostWorkflowHookRunner_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []models.WorkflowHookCommandContext, _param1 []string, _param2 []string) {

View File

@@ -25,11 +25,11 @@ func NewMockPreWorkflowHookRunner(options ...pegomock.Option) *MockPreWorkflowHo
func (mock *MockPreWorkflowHookRunner) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockPreWorkflowHookRunner) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockPreWorkflowHookRunner) Run(ctx models.WorkflowHookCommandContext, command string, path string) (string, string, error) {
func (mock *MockPreWorkflowHookRunner) Run(_param0 models.WorkflowHookCommandContext, _param1 string, _param2 string) (string, string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockPreWorkflowHookRunner().")
}
params := []pegomock.Param{ctx, command, path}
params := []pegomock.Param{_param0, _param1, _param2}
result := pegomock.GetGenericMockFrom(mock).Invoke("Run", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 string
var ret1 string
@@ -85,8 +85,8 @@ type VerifierMockPreWorkflowHookRunner struct {
timeout time.Duration
}
func (verifier *VerifierMockPreWorkflowHookRunner) Run(ctx models.WorkflowHookCommandContext, command string, path string) *MockPreWorkflowHookRunner_Run_OngoingVerification {
params := []pegomock.Param{ctx, command, path}
func (verifier *VerifierMockPreWorkflowHookRunner) Run(_param0 models.WorkflowHookCommandContext, _param1 string, _param2 string) *MockPreWorkflowHookRunner_Run_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Run", params, verifier.timeout)
return &MockPreWorkflowHookRunner_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -97,8 +97,8 @@ type MockPreWorkflowHookRunner_Run_OngoingVerification struct {
}
func (c *MockPreWorkflowHookRunner_Run_OngoingVerification) GetCapturedArguments() (models.WorkflowHookCommandContext, string, string) {
ctx, command, path := c.GetAllCapturedArguments()
return ctx[len(ctx)-1], command[len(command)-1], path[len(path)-1]
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
}
func (c *MockPreWorkflowHookRunner_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []models.WorkflowHookCommandContext, _param1 []string, _param2 []string) {

View File

@@ -4,11 +4,10 @@
package mocks
import (
"reflect"
"time"
pegomock "github.com/petergtz/pegomock"
models "github.com/runatlantis/atlantis/server/events/models"
"reflect"
"time"
)
type MockPullApprovedChecker struct {
@@ -26,11 +25,11 @@ func NewMockPullApprovedChecker(options ...pegomock.Option) *MockPullApprovedChe
func (mock *MockPullApprovedChecker) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockPullApprovedChecker) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockPullApprovedChecker) PullIsApproved(baseRepo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error) {
func (mock *MockPullApprovedChecker) PullIsApproved(_param0 models.Repo, _param1 models.PullRequest) (models.ApprovalStatus, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockPullApprovedChecker().")
}
params := []pegomock.Param{baseRepo, pull}
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("PullIsApproved", params, []reflect.Type{reflect.TypeOf((*models.ApprovalStatus)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 models.ApprovalStatus
var ret1 error
@@ -82,8 +81,8 @@ type VerifierMockPullApprovedChecker struct {
timeout time.Duration
}
func (verifier *VerifierMockPullApprovedChecker) PullIsApproved(baseRepo models.Repo, pull models.PullRequest) *MockPullApprovedChecker_PullIsApproved_OngoingVerification {
params := []pegomock.Param{baseRepo, pull}
func (verifier *VerifierMockPullApprovedChecker) PullIsApproved(_param0 models.Repo, _param1 models.PullRequest) *MockPullApprovedChecker_PullIsApproved_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "PullIsApproved", params, verifier.timeout)
return &MockPullApprovedChecker_PullIsApproved_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -94,8 +93,8 @@ type MockPullApprovedChecker_PullIsApproved_OngoingVerification struct {
}
func (c *MockPullApprovedChecker_PullIsApproved_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
baseRepo, pull := c.GetAllCapturedArguments()
return baseRepo[len(baseRepo)-1], pull[len(pull)-1]
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockPullApprovedChecker_PullIsApproved_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {

View File

@@ -4,11 +4,10 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock"
command "github.com/runatlantis/atlantis/server/events/command"
"reflect"
"time"
pegomock "github.com/petergtz/pegomock"
"github.com/runatlantis/atlantis/server/events/command"
)
type MockRunner struct {
@@ -26,11 +25,11 @@ func NewMockRunner(options ...pegomock.Option) *MockRunner {
func (mock *MockRunner) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockRunner) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockRunner) Run(ctx command.ProjectContext, extraArgs []string, path string, envs map[string]string) (string, error) {
func (mock *MockRunner) Run(_param0 command.ProjectContext, _param1 []string, _param2 string, _param3 map[string]string) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockRunner().")
}
params := []pegomock.Param{ctx, extraArgs, path, envs}
params := []pegomock.Param{_param0, _param1, _param2, _param3}
result := pegomock.GetGenericMockFrom(mock).Invoke("Run", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 string
var ret1 error
@@ -82,8 +81,8 @@ type VerifierMockRunner struct {
timeout time.Duration
}
func (verifier *VerifierMockRunner) Run(ctx command.ProjectContext, extraArgs []string, path string, envs map[string]string) *MockRunner_Run_OngoingVerification {
params := []pegomock.Param{ctx, extraArgs, path, envs}
func (verifier *VerifierMockRunner) Run(_param0 command.ProjectContext, _param1 []string, _param2 string, _param3 map[string]string) *MockRunner_Run_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2, _param3}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Run", params, verifier.timeout)
return &MockRunner_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -94,8 +93,8 @@ type MockRunner_Run_OngoingVerification struct {
}
func (c *MockRunner_Run_OngoingVerification) GetCapturedArguments() (command.ProjectContext, []string, string, map[string]string) {
ctx, extraArgs, path, envs := c.GetAllCapturedArguments()
return ctx[len(ctx)-1], extraArgs[len(extraArgs)-1], path[len(path)-1], envs[len(envs)-1]
_param0, _param1, _param2, _param3 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1]
}
func (c *MockRunner_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 [][]string, _param2 []string, _param3 []map[string]string) {

View File

@@ -4,13 +4,12 @@
package mocks
import (
"reflect"
"time"
go_version "github.com/hashicorp/go-version"
pegomock "github.com/petergtz/pegomock"
"github.com/runatlantis/atlantis/server/events/command"
command "github.com/runatlantis/atlantis/server/events/command"
logging "github.com/runatlantis/atlantis/server/logging"
"reflect"
"time"
)
type MockVersionedExecutorWorkflow struct {
@@ -28,11 +27,11 @@ func NewMockVersionedExecutorWorkflow(options ...pegomock.Option) *MockVersioned
func (mock *MockVersionedExecutorWorkflow) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockVersionedExecutorWorkflow) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockVersionedExecutorWorkflow) EnsureExecutorVersion(log logging.SimpleLogging, v *go_version.Version) (string, error) {
func (mock *MockVersionedExecutorWorkflow) EnsureExecutorVersion(_param0 logging.SimpleLogging, _param1 *go_version.Version) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockVersionedExecutorWorkflow().")
}
params := []pegomock.Param{log, v}
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("EnsureExecutorVersion", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 string
var ret1 error
@@ -47,11 +46,11 @@ func (mock *MockVersionedExecutorWorkflow) EnsureExecutorVersion(log logging.Sim
return ret0, ret1
}
func (mock *MockVersionedExecutorWorkflow) Run(ctx command.ProjectContext, executablePath string, envs map[string]string, workdir string, extraArgs []string) (string, error) {
func (mock *MockVersionedExecutorWorkflow) Run(_param0 command.ProjectContext, _param1 string, _param2 map[string]string, _param3 string, _param4 []string) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockVersionedExecutorWorkflow().")
}
params := []pegomock.Param{ctx, executablePath, envs, workdir, extraArgs}
params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4}
result := pegomock.GetGenericMockFrom(mock).Invoke("Run", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 string
var ret1 error
@@ -103,8 +102,8 @@ type VerifierMockVersionedExecutorWorkflow struct {
timeout time.Duration
}
func (verifier *VerifierMockVersionedExecutorWorkflow) EnsureExecutorVersion(log logging.SimpleLogging, v *go_version.Version) *MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification {
params := []pegomock.Param{log, v}
func (verifier *VerifierMockVersionedExecutorWorkflow) EnsureExecutorVersion(_param0 logging.SimpleLogging, _param1 *go_version.Version) *MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "EnsureExecutorVersion", params, verifier.timeout)
return &MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -115,8 +114,8 @@ type MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification str
}
func (c *MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, *go_version.Version) {
log, v := c.GetAllCapturedArguments()
return log[len(log)-1], v[len(v)-1]
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []*go_version.Version) {
@@ -134,8 +133,8 @@ func (c *MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification
return
}
func (verifier *VerifierMockVersionedExecutorWorkflow) Run(ctx command.ProjectContext, executablePath string, envs map[string]string, workdir string, extraArgs []string) *MockVersionedExecutorWorkflow_Run_OngoingVerification {
params := []pegomock.Param{ctx, executablePath, envs, workdir, extraArgs}
func (verifier *VerifierMockVersionedExecutorWorkflow) Run(_param0 command.ProjectContext, _param1 string, _param2 map[string]string, _param3 string, _param4 []string) *MockVersionedExecutorWorkflow_Run_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Run", params, verifier.timeout)
return &MockVersionedExecutorWorkflow_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -146,8 +145,8 @@ type MockVersionedExecutorWorkflow_Run_OngoingVerification struct {
}
func (c *MockVersionedExecutorWorkflow_Run_OngoingVerification) GetCapturedArguments() (command.ProjectContext, string, map[string]string, string, []string) {
ctx, executablePath, envs, workdir, extraArgs := c.GetAllCapturedArguments()
return ctx[len(ctx)-1], executablePath[len(executablePath)-1], envs[len(envs)-1], workdir[len(workdir)-1], extraArgs[len(extraArgs)-1]
_param0, _param1, _param2, _param3, _param4 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1], _param4[len(_param4)-1]
}
func (c *MockVersionedExecutorWorkflow_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 []string, _param2 []map[string]string, _param3 []string, _param4 [][]string) {

View File

@@ -7,7 +7,7 @@ import (
"strings"
)
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_exec.go Exec
//go:generate pegomock generate -m --package mocks -o mocks/mock_exec.go Exec
type Exec interface {
LookPath(file string) (string, error)

View File

@@ -5,7 +5,7 @@ import (
"path/filepath"
)
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_filepath.go FilePath
//go:generate pegomock generate -m --package mocks -o mocks/mock_filepath.go FilePath
type FilePath interface {
NotExists() bool

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
)
func AnyMapOfStringToString() map[string]string {

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
models "github.com/runatlantis/atlantis/server/core/runtime/models"
)

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
)
func AnySliceOfString() []string {

View File

@@ -4,10 +4,9 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock"
"reflect"
"time"
pegomock "github.com/petergtz/pegomock"
)
type MockExec struct {
@@ -25,12 +24,12 @@ func NewMockExec(options ...pegomock.Option) *MockExec {
func (mock *MockExec) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockExec) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockExec) LookPath(file string) (string, error) {
func (mock *MockExec) CombinedOutput(_param0 []string, _param1 map[string]string, _param2 string) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockExec().")
}
params := []pegomock.Param{file}
result := pegomock.GetGenericMockFrom(mock).Invoke("LookPath", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
params := []pegomock.Param{_param0, _param1, _param2}
result := pegomock.GetGenericMockFrom(mock).Invoke("CombinedOutput", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 string
var ret1 error
if len(result) != 0 {
@@ -44,12 +43,12 @@ func (mock *MockExec) LookPath(file string) (string, error) {
return ret0, ret1
}
func (mock *MockExec) CombinedOutput(args []string, envs map[string]string, workdir string) (string, error) {
func (mock *MockExec) LookPath(_param0 string) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockExec().")
}
params := []pegomock.Param{args, envs, workdir}
result := pegomock.GetGenericMockFrom(mock).Invoke("CombinedOutput", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
params := []pegomock.Param{_param0}
result := pegomock.GetGenericMockFrom(mock).Invoke("LookPath", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 string
var ret1 error
if len(result) != 0 {
@@ -100,35 +99,8 @@ type VerifierMockExec struct {
timeout time.Duration
}
func (verifier *VerifierMockExec) LookPath(file string) *MockExec_LookPath_OngoingVerification {
params := []pegomock.Param{file}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "LookPath", params, verifier.timeout)
return &MockExec_LookPath_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockExec_LookPath_OngoingVerification struct {
mock *MockExec
methodInvocations []pegomock.MethodInvocation
}
func (c *MockExec_LookPath_OngoingVerification) GetCapturedArguments() string {
file := c.GetAllCapturedArguments()
return file[len(file)-1]
}
func (c *MockExec_LookPath_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(string)
}
}
return
}
func (verifier *VerifierMockExec) CombinedOutput(args []string, envs map[string]string, workdir string) *MockExec_CombinedOutput_OngoingVerification {
params := []pegomock.Param{args, envs, workdir}
func (verifier *VerifierMockExec) CombinedOutput(_param0 []string, _param1 map[string]string, _param2 string) *MockExec_CombinedOutput_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CombinedOutput", params, verifier.timeout)
return &MockExec_CombinedOutput_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -139,8 +111,8 @@ type MockExec_CombinedOutput_OngoingVerification struct {
}
func (c *MockExec_CombinedOutput_OngoingVerification) GetCapturedArguments() ([]string, map[string]string, string) {
args, envs, workdir := c.GetAllCapturedArguments()
return args[len(args)-1], envs[len(envs)-1], workdir[len(workdir)-1]
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
}
func (c *MockExec_CombinedOutput_OngoingVerification) GetAllCapturedArguments() (_param0 [][]string, _param1 []map[string]string, _param2 []string) {
@@ -161,3 +133,30 @@ func (c *MockExec_CombinedOutput_OngoingVerification) GetAllCapturedArguments()
}
return
}
func (verifier *VerifierMockExec) LookPath(_param0 string) *MockExec_LookPath_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "LookPath", params, verifier.timeout)
return &MockExec_LookPath_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockExec_LookPath_OngoingVerification struct {
mock *MockExec
methodInvocations []pegomock.MethodInvocation
}
func (c *MockExec_LookPath_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *MockExec_LookPath_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(string)
}
}
return
}

View File

@@ -4,11 +4,10 @@
package mocks
import (
"reflect"
"time"
pegomock "github.com/petergtz/pegomock"
models "github.com/runatlantis/atlantis/server/core/runtime/models"
"reflect"
"time"
)
type MockFilePath struct {
@@ -26,6 +25,24 @@ func NewMockFilePath(options ...pegomock.Option) *MockFilePath {
func (mock *MockFilePath) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockFilePath) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockFilePath) Join(_param0 ...string) models.FilePath {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockFilePath().")
}
params := []pegomock.Param{}
for _, param := range _param0 {
params = append(params, param)
}
result := pegomock.GetGenericMockFrom(mock).Invoke("Join", params, []reflect.Type{reflect.TypeOf((*models.FilePath)(nil)).Elem()})
var ret0 models.FilePath
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(models.FilePath)
}
}
return ret0
}
func (mock *MockFilePath) NotExists() bool {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockFilePath().")
@@ -41,43 +58,6 @@ func (mock *MockFilePath) NotExists() bool {
return ret0
}
func (mock *MockFilePath) Join(elem ...string) models.FilePath {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockFilePath().")
}
params := []pegomock.Param{}
for _, param := range elem {
params = append(params, param)
}
result := pegomock.GetGenericMockFrom(mock).Invoke("Join", params, []reflect.Type{reflect.TypeOf((*models.FilePath)(nil)).Elem()})
var ret0 models.FilePath
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(models.FilePath)
}
}
return ret0
}
func (mock *MockFilePath) Symlink(newname string) (models.FilePath, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockFilePath().")
}
params := []pegomock.Param{newname}
result := pegomock.GetGenericMockFrom(mock).Invoke("Symlink", params, []reflect.Type{reflect.TypeOf((*models.FilePath)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 models.FilePath
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(models.FilePath)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockFilePath) Resolve() string {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockFilePath().")
@@ -93,6 +73,25 @@ func (mock *MockFilePath) Resolve() string {
return ret0
}
func (mock *MockFilePath) Symlink(_param0 string) (models.FilePath, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockFilePath().")
}
params := []pegomock.Param{_param0}
result := pegomock.GetGenericMockFrom(mock).Invoke("Symlink", params, []reflect.Type{reflect.TypeOf((*models.FilePath)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 models.FilePath
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(models.FilePath)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockFilePath) VerifyWasCalledOnce() *VerifierMockFilePath {
return &VerifierMockFilePath{
mock: mock,
@@ -130,26 +129,9 @@ type VerifierMockFilePath struct {
timeout time.Duration
}
func (verifier *VerifierMockFilePath) NotExists() *MockFilePath_NotExists_OngoingVerification {
func (verifier *VerifierMockFilePath) Join(_param0 ...string) *MockFilePath_Join_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NotExists", params, verifier.timeout)
return &MockFilePath_NotExists_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockFilePath_NotExists_OngoingVerification struct {
mock *MockFilePath
methodInvocations []pegomock.MethodInvocation
}
func (c *MockFilePath_NotExists_OngoingVerification) GetCapturedArguments() {
}
func (c *MockFilePath_NotExists_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierMockFilePath) Join(elem ...string) *MockFilePath_Join_OngoingVerification {
params := []pegomock.Param{}
for _, param := range elem {
for _, param := range _param0 {
params = append(params, param)
}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Join", params, verifier.timeout)
@@ -162,8 +144,8 @@ type MockFilePath_Join_OngoingVerification struct {
}
func (c *MockFilePath_Join_OngoingVerification) GetCapturedArguments() []string {
elem := c.GetAllCapturedArguments()
return elem[len(elem)-1]
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *MockFilePath_Join_OngoingVerification) GetAllCapturedArguments() (_param0 [][]string) {
@@ -182,31 +164,21 @@ func (c *MockFilePath_Join_OngoingVerification) GetAllCapturedArguments() (_para
return
}
func (verifier *VerifierMockFilePath) Symlink(newname string) *MockFilePath_Symlink_OngoingVerification {
params := []pegomock.Param{newname}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Symlink", params, verifier.timeout)
return &MockFilePath_Symlink_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
func (verifier *VerifierMockFilePath) NotExists() *MockFilePath_NotExists_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NotExists", params, verifier.timeout)
return &MockFilePath_NotExists_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockFilePath_Symlink_OngoingVerification struct {
type MockFilePath_NotExists_OngoingVerification struct {
mock *MockFilePath
methodInvocations []pegomock.MethodInvocation
}
func (c *MockFilePath_Symlink_OngoingVerification) GetCapturedArguments() string {
newname := c.GetAllCapturedArguments()
return newname[len(newname)-1]
func (c *MockFilePath_NotExists_OngoingVerification) GetCapturedArguments() {
}
func (c *MockFilePath_Symlink_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(string)
}
}
return
func (c *MockFilePath_NotExists_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierMockFilePath) Resolve() *MockFilePath_Resolve_OngoingVerification {
@@ -225,3 +197,30 @@ func (c *MockFilePath_Resolve_OngoingVerification) GetCapturedArguments() {
func (c *MockFilePath_Resolve_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierMockFilePath) Symlink(_param0 string) *MockFilePath_Symlink_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Symlink", params, verifier.timeout)
return &MockFilePath_Symlink_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockFilePath_Symlink_OngoingVerification struct {
mock *MockFilePath
methodInvocations []pegomock.MethodInvocation
}
func (c *MockFilePath_Symlink_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *MockFilePath_Symlink_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(string)
}
}
return
}

View File

@@ -69,7 +69,7 @@ func TestShellCommandRunner_Run(t *testing.T) {
output, err = runner.Run(ctx)
Ok(t, err)
Equals(t, expectedOutput, output)
projectCmdOutputHandler.VerifyWasCalled(Never()).Send(matchers.AnyModelsProjectCommandContext(), AnyString(), EqBool(false))
projectCmdOutputHandler.VerifyWasCalled(Never()).Send(matchers.AnyCommandProjectContext(), AnyString(), EqBool(false))
})
}
}

View File

@@ -53,7 +53,7 @@ func TestRun_NoWorkspaceIn08(t *testing.T) {
TerraformExecutor: terraform,
}
When(terraform.RunCommandWithVersion(matchers.AnyModelsProjectCommandContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
output, err := s.Run(ctx, []string{"extra", "args"}, "/path", map[string]string(nil))
Ok(t, err)
@@ -118,7 +118,7 @@ func TestRun_ErrWorkspaceIn08(t *testing.T) {
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(matchers.AnyModelsProjectCommandContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
_, err := s.Run(command.ProjectContext{
Log: logger,
@@ -180,7 +180,7 @@ func TestRun_SwitchesWorkspace(t *testing.T) {
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(matchers.AnyModelsProjectCommandContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
output, err := s.Run(ctx, []string{"extra", "args"}, "/path", map[string]string(nil))
Ok(t, err)
@@ -533,7 +533,7 @@ Terraform will perform the following actions:
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(
matchers.AnyModelsProjectCommandContext(),
matchers.AnyCommandProjectContext(),
AnyString(),
AnyStringSlice(),
matchers2.AnyMapOfStringToString(),
@@ -587,7 +587,7 @@ func TestRun_OutputOnErr(t *testing.T) {
expOutput := "expected output"
expErrMsg := "error!"
When(terraform.RunCommandWithVersion(
matchers.AnyModelsProjectCommandContext(),
matchers.AnyCommandProjectContext(),
AnyString(),
AnyStringSlice(),
matchers2.AnyMapOfStringToString(),
@@ -646,7 +646,7 @@ func TestRun_NoOptionalVarsIn012(t *testing.T) {
t.Run(c.name, func(t *testing.T) {
terraform := mocks.NewMockClient()
When(terraform.RunCommandWithVersion(
matchers.AnyModelsProjectCommandContext(),
matchers.AnyCommandProjectContext(),
AnyString(),
AnyStringSlice(),
matchers2.AnyMapOfStringToString(),

View File

@@ -73,7 +73,7 @@ func (c ConftestTestCommandArgs) build() ([]string, error) {
// SourceResolver resolves the policy set to a local fs path
//
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_conftest_client.go SourceResolver
//go:generate pegomock generate -m --package mocks -o mocks/mock_conftest_client.go SourceResolver
type SourceResolver interface {
Resolve(policySet valid.PolicySet) (string, error)
}

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
valid "github.com/runatlantis/atlantis/server/core/config/valid"
)

View File

@@ -4,11 +4,10 @@
package mocks
import (
"reflect"
"time"
pegomock "github.com/petergtz/pegomock"
valid "github.com/runatlantis/atlantis/server/core/config/valid"
"reflect"
"time"
)
type MockSourceResolver struct {
@@ -26,11 +25,11 @@ func NewMockSourceResolver(options ...pegomock.Option) *MockSourceResolver {
func (mock *MockSourceResolver) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockSourceResolver) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockSourceResolver) Resolve(policySet valid.PolicySet) (string, error) {
func (mock *MockSourceResolver) Resolve(_param0 valid.PolicySet) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockSourceResolver().")
}
params := []pegomock.Param{policySet}
params := []pegomock.Param{_param0}
result := pegomock.GetGenericMockFrom(mock).Invoke("Resolve", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 string
var ret1 error
@@ -82,8 +81,8 @@ type VerifierMockSourceResolver struct {
timeout time.Duration
}
func (verifier *VerifierMockSourceResolver) Resolve(policySet valid.PolicySet) *MockSourceResolver_Resolve_OngoingVerification {
params := []pegomock.Param{policySet}
func (verifier *VerifierMockSourceResolver) Resolve(_param0 valid.PolicySet) *MockSourceResolver_Resolve_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Resolve", params, verifier.timeout)
return &MockSourceResolver_Resolve_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -94,8 +93,8 @@ type MockSourceResolver_Resolve_OngoingVerification struct {
}
func (c *MockSourceResolver_Resolve_OngoingVerification) GetCapturedArguments() valid.PolicySet {
policySet := c.GetAllCapturedArguments()
return policySet[len(policySet)-1]
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *MockSourceResolver_Resolve_OngoingVerification) GetAllCapturedArguments() (_param0 []valid.PolicySet) {

View File

@@ -11,7 +11,7 @@ import (
"github.com/runatlantis/atlantis/server/jobs"
)
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_post_workflows_hook_runner.go PostWorkflowHookRunner
//go:generate pegomock generate -m --package mocks -o mocks/mock_post_workflows_hook_runner.go PostWorkflowHookRunner
type PostWorkflowHookRunner interface {
Run(ctx models.WorkflowHookCommandContext, command string, path string) (string, string, error)
}

View File

@@ -71,7 +71,7 @@ func TestPostWorkflowHookRunner_Run(t *testing.T) {
RegisterMockTestingT(t)
terraform := mocks.NewMockClient()
When(terraform.EnsureVersion(matchers.AnyPtrToLoggingSimpleLogger(), matchers2.AnyPtrToGoVersionVersion())).
When(terraform.EnsureVersion(matchers.AnyLoggingSimpleLogging(), matchers2.AnyPtrToGoVersionVersion())).
ThenReturn(nil)
logger := logging.NewNoopLogger(t)

View File

@@ -11,7 +11,7 @@ import (
"github.com/runatlantis/atlantis/server/jobs"
)
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_pre_workflows_hook_runner.go PreWorkflowHookRunner
//go:generate pegomock generate -m --package mocks -o mocks/mock_pre_workflows_hook_runner.go PreWorkflowHookRunner
type PreWorkflowHookRunner interface {
Run(ctx models.WorkflowHookCommandContext, command string, path string) (string, string, error)
}

View File

@@ -71,7 +71,7 @@ func TestPreWorkflowHookRunner_Run(t *testing.T) {
RegisterMockTestingT(t)
terraform := mocks.NewMockClient()
When(terraform.EnsureVersion(matchers.AnyPtrToLoggingSimpleLogger(), matchers2.AnyPtrToGoVersionVersion())).
When(terraform.EnsureVersion(matchers.AnyLoggingSimpleLogging(), matchers2.AnyPtrToGoVersionVersion())).
ThenReturn(nil)
logger := logging.NewNoopLogger(t)

View File

@@ -4,7 +4,7 @@ import (
"github.com/runatlantis/atlantis/server/events/models"
)
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_pull_approved_checker.go PullApprovedChecker
//go:generate pegomock generate -m --package mocks -o mocks/mock_pull_approved_checker.go PullApprovedChecker
type PullApprovedChecker interface {
PullIsApproved(baseRepo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error)

View File

@@ -105,7 +105,7 @@ func TestRunStepRunner_Run(t *testing.T) {
RegisterMockTestingT(t)
terraform := mocks.NewMockClient()
When(terraform.EnsureVersion(matchers.AnyPtrToLoggingSimpleLogger(), matchers2.AnyPtrToGoVersionVersion())).
When(terraform.EnsureVersion(matchers.AnyLoggingSimpleLogging(), matchers2.AnyPtrToGoVersionVersion())).
ThenReturn(nil)
logger := logging.NewNoopLogger(t)

View File

@@ -52,7 +52,7 @@ type StatusUpdater interface {
// Runner mirrors events.StepRunner as a way to bring it into this package
//
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_runner.go Runner
//go:generate pegomock generate -m --package mocks -o mocks/mock_runner.go Runner
type Runner interface {
Run(ctx command.ProjectContext, extraArgs []string, path string, envs map[string]string) (string, error)
}

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
logging "github.com/runatlantis/atlantis/server/logging"
)

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
)
func AnyMapOfStringToString() map[string]string {

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
go_version "github.com/hashicorp/go-version"
)

View File

@@ -1,21 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
logging "github.com/runatlantis/atlantis/server/logging"
)
func AnyPtrToLoggingSimpleLogger() logging.SimpleLogging {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(logging.SimpleLogging))(nil)).Elem()))
var nullValue logging.SimpleLogging
return nullValue
}
func EqPtrToLoggingSimpleLogger(value logging.SimpleLogging) logging.SimpleLogging {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue logging.SimpleLogging
return nullValue
}

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
)
func AnySliceOfString() []string {

View File

@@ -24,12 +24,12 @@ func NewMockDownloader(options ...pegomock.Option) *MockDownloader {
func (mock *MockDownloader) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockDownloader) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockDownloader) GetFile(dst string, src string) error {
func (mock *MockDownloader) GetAny(_param0 string, _param1 string) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockDownloader().")
}
params := []pegomock.Param{dst, src}
result := pegomock.GetGenericMockFrom(mock).Invoke("GetFile", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("GetAny", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
if result[0] != nil {
@@ -39,12 +39,12 @@ func (mock *MockDownloader) GetFile(dst string, src string) error {
return ret0
}
func (mock *MockDownloader) GetAny(dst string, src string) error {
func (mock *MockDownloader) GetFile(_param0 string, _param1 string) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockDownloader().")
}
params := []pegomock.Param{dst, src}
result := pegomock.GetGenericMockFrom(mock).Invoke("GetAny", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("GetFile", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
if result[0] != nil {
@@ -91,39 +91,8 @@ type VerifierMockDownloader struct {
timeout time.Duration
}
func (verifier *VerifierMockDownloader) GetFile(dst string, src string) *MockDownloader_GetFile_OngoingVerification {
params := []pegomock.Param{dst, src}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetFile", params, verifier.timeout)
return &MockDownloader_GetFile_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockDownloader_GetFile_OngoingVerification struct {
mock *MockDownloader
methodInvocations []pegomock.MethodInvocation
}
func (c *MockDownloader_GetFile_OngoingVerification) GetCapturedArguments() (string, string) {
dst, src := c.GetAllCapturedArguments()
return dst[len(dst)-1], src[len(src)-1]
}
func (c *MockDownloader_GetFile_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(string)
}
_param1 = make([]string, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(string)
}
}
return
}
func (verifier *VerifierMockDownloader) GetAny(dst string, src string) *MockDownloader_GetAny_OngoingVerification {
params := []pegomock.Param{dst, src}
func (verifier *VerifierMockDownloader) GetAny(_param0 string, _param1 string) *MockDownloader_GetAny_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetAny", params, verifier.timeout)
return &MockDownloader_GetAny_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -134,8 +103,8 @@ type MockDownloader_GetAny_OngoingVerification struct {
}
func (c *MockDownloader_GetAny_OngoingVerification) GetCapturedArguments() (string, string) {
dst, src := c.GetAllCapturedArguments()
return dst[len(dst)-1], src[len(src)-1]
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockDownloader_GetAny_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string) {
@@ -152,3 +121,34 @@ func (c *MockDownloader_GetAny_OngoingVerification) GetAllCapturedArguments() (_
}
return
}
func (verifier *VerifierMockDownloader) GetFile(_param0 string, _param1 string) *MockDownloader_GetFile_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetFile", params, verifier.timeout)
return &MockDownloader_GetFile_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockDownloader_GetFile_OngoingVerification struct {
mock *MockDownloader
methodInvocations []pegomock.MethodInvocation
}
func (c *MockDownloader_GetFile_OngoingVerification) GetCapturedArguments() (string, string) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockDownloader_GetFile_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(string)
}
_param1 = make([]string, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(string)
}
}
return
}

View File

@@ -27,30 +27,26 @@ func NewMockClient(options ...pegomock.Option) *MockClient {
func (mock *MockClient) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockClient) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockClient) RunCommandWithVersion(ctx command.ProjectContext, path string, args []string, envs map[string]string, v *go_version.Version, workspace string) (string, error) {
func (mock *MockClient) DetectVersion(_param0 logging.SimpleLogging, _param1 string) *go_version.Version {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockClient().")
}
params := []pegomock.Param{ctx, path, args, envs, v, workspace}
result := pegomock.GetGenericMockFrom(mock).Invoke("RunCommandWithVersion", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 string
var ret1 error
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("DetectVersion", params, []reflect.Type{reflect.TypeOf((**go_version.Version)(nil)).Elem()})
var ret0 *go_version.Version
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(string)
}
if result[1] != nil {
ret1 = result[1].(error)
ret0 = result[0].(*go_version.Version)
}
}
return ret0, ret1
return ret0
}
func (mock *MockClient) EnsureVersion(log logging.SimpleLogging, v *go_version.Version) error {
func (mock *MockClient) EnsureVersion(_param0 logging.SimpleLogging, _param1 *go_version.Version) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockClient().")
}
params := []pegomock.Param{log, v}
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("EnsureVersion", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
@@ -61,11 +57,11 @@ func (mock *MockClient) EnsureVersion(log logging.SimpleLogging, v *go_version.V
return ret0
}
func (mock *MockClient) ListAvailableVersions(log logging.SimpleLogging) ([]string, error) {
func (mock *MockClient) ListAvailableVersions(_param0 logging.SimpleLogging) ([]string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockClient().")
}
params := []pegomock.Param{log}
params := []pegomock.Param{_param0}
result := pegomock.GetGenericMockFrom(mock).Invoke("ListAvailableVersions", params, []reflect.Type{reflect.TypeOf((*[]string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 []string
var ret1 error
@@ -80,19 +76,23 @@ func (mock *MockClient) ListAvailableVersions(log logging.SimpleLogging) ([]stri
return ret0, ret1
}
func (mock *MockClient) DetectVersion(log logging.SimpleLogging, projectDirectory string) *go_version.Version {
func (mock *MockClient) RunCommandWithVersion(_param0 command.ProjectContext, _param1 string, _param2 []string, _param3 map[string]string, _param4 *go_version.Version, _param5 string) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockClient().")
}
params := []pegomock.Param{log, projectDirectory}
result := pegomock.GetGenericMockFrom(mock).Invoke("DetectVersion", params, []reflect.Type{reflect.TypeOf((**go_version.Version)(nil)).Elem()})
var ret0 *go_version.Version
params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4, _param5}
result := pegomock.GetGenericMockFrom(mock).Invoke("RunCommandWithVersion", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 string
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(*go_version.Version)
ret0 = result[0].(string)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0
return ret0, ret1
}
func (mock *MockClient) VerifyWasCalledOnce() *VerifierMockClient {
@@ -132,8 +132,97 @@ type VerifierMockClient struct {
timeout time.Duration
}
func (verifier *VerifierMockClient) RunCommandWithVersion(ctx command.ProjectContext, path string, args []string, envs map[string]string, v *go_version.Version, workspace string) *MockClient_RunCommandWithVersion_OngoingVerification {
params := []pegomock.Param{ctx, path, args, envs, v, workspace}
func (verifier *VerifierMockClient) DetectVersion(_param0 logging.SimpleLogging, _param1 string) *MockClient_DetectVersion_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DetectVersion", params, verifier.timeout)
return &MockClient_DetectVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockClient_DetectVersion_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *MockClient_DetectVersion_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, string) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockClient_DetectVersion_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]logging.SimpleLogging, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(logging.SimpleLogging)
}
_param1 = make([]string, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(string)
}
}
return
}
func (verifier *VerifierMockClient) EnsureVersion(_param0 logging.SimpleLogging, _param1 *go_version.Version) *MockClient_EnsureVersion_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "EnsureVersion", params, verifier.timeout)
return &MockClient_EnsureVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockClient_EnsureVersion_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *MockClient_EnsureVersion_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, *go_version.Version) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockClient_EnsureVersion_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []*go_version.Version) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]logging.SimpleLogging, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(logging.SimpleLogging)
}
_param1 = make([]*go_version.Version, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(*go_version.Version)
}
}
return
}
func (verifier *VerifierMockClient) ListAvailableVersions(_param0 logging.SimpleLogging) *MockClient_ListAvailableVersions_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ListAvailableVersions", params, verifier.timeout)
return &MockClient_ListAvailableVersions_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockClient_ListAvailableVersions_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *MockClient_ListAvailableVersions_OngoingVerification) GetCapturedArguments() logging.SimpleLogging {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *MockClient_ListAvailableVersions_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]logging.SimpleLogging, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(logging.SimpleLogging)
}
}
return
}
func (verifier *VerifierMockClient) RunCommandWithVersion(_param0 command.ProjectContext, _param1 string, _param2 []string, _param3 map[string]string, _param4 *go_version.Version, _param5 string) *MockClient_RunCommandWithVersion_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4, _param5}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "RunCommandWithVersion", params, verifier.timeout)
return &MockClient_RunCommandWithVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -144,8 +233,8 @@ type MockClient_RunCommandWithVersion_OngoingVerification struct {
}
func (c *MockClient_RunCommandWithVersion_OngoingVerification) GetCapturedArguments() (command.ProjectContext, string, []string, map[string]string, *go_version.Version, string) {
ctx, path, args, envs, v, workspace := c.GetAllCapturedArguments()
return ctx[len(ctx)-1], path[len(path)-1], args[len(args)-1], envs[len(envs)-1], v[len(v)-1], workspace[len(workspace)-1]
_param0, _param1, _param2, _param3, _param4, _param5 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1], _param4[len(_param4)-1], _param5[len(_param5)-1]
}
func (c *MockClient_RunCommandWithVersion_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 []string, _param2 [][]string, _param3 []map[string]string, _param4 []*go_version.Version, _param5 []string) {
@@ -178,92 +267,3 @@ func (c *MockClient_RunCommandWithVersion_OngoingVerification) GetAllCapturedArg
}
return
}
func (verifier *VerifierMockClient) EnsureVersion(log logging.SimpleLogging, v *go_version.Version) *MockClient_EnsureVersion_OngoingVerification {
params := []pegomock.Param{log, v}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "EnsureVersion", params, verifier.timeout)
return &MockClient_EnsureVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockClient_EnsureVersion_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *MockClient_EnsureVersion_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, *go_version.Version) {
log, v := c.GetAllCapturedArguments()
return log[len(log)-1], v[len(v)-1]
}
func (c *MockClient_EnsureVersion_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []*go_version.Version) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]logging.SimpleLogging, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(logging.SimpleLogging)
}
_param1 = make([]*go_version.Version, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(*go_version.Version)
}
}
return
}
func (verifier *VerifierMockClient) ListAvailableVersions(log logging.SimpleLogging) *MockClient_ListAvailableVersions_OngoingVerification {
params := []pegomock.Param{log}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ListAvailableVersions", params, verifier.timeout)
return &MockClient_ListAvailableVersions_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockClient_ListAvailableVersions_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *MockClient_ListAvailableVersions_OngoingVerification) GetCapturedArguments() logging.SimpleLogging {
log := c.GetAllCapturedArguments()
return log[len(log)-1]
}
func (c *MockClient_ListAvailableVersions_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]logging.SimpleLogging, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(logging.SimpleLogging)
}
}
return
}
func (verifier *VerifierMockClient) DetectVersion(log logging.SimpleLogging, projectDirectory string) *MockClient_DetectVersion_OngoingVerification {
params := []pegomock.Param{log, projectDirectory}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DetectVersion", params, verifier.timeout)
return &MockClient_DetectVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockClient_DetectVersion_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *MockClient_DetectVersion_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, string) {
log, projectDirectory := c.GetAllCapturedArguments()
return log[len(log)-1], projectDirectory[len(projectDirectory)-1]
}
func (c *MockClient_DetectVersion_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]logging.SimpleLogging, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(logging.SimpleLogging)
}
_param1 = make([]string, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(string)
}
}
return
}

View File

@@ -46,7 +46,7 @@ import (
var LogStreamingValidCmds = [...]string{"init", "plan", "apply"}
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_terraform_client.go Client
//go:generate pegomock generate -m --package mocks -o mocks/mock_terraform_client.go Client
type Client interface {
// RunCommandWithVersion executes terraform with args in path. If v is nil,
@@ -93,7 +93,7 @@ type DefaultClient struct {
projectCmdOutputHandler jobs.ProjectCommandOutputHandler
}
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_downloader.go Downloader
//go:generate pegomock generate -m --package mocks -o mocks/mock_downloader.go Downloader
// Downloader is for downloading terraform versions.
type Downloader interface {

View File

@@ -35,7 +35,7 @@ const (
ShutdownComment = "Atlantis server is shutting down, please try again later."
)
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_command_runner.go CommandRunner
//go:generate pegomock generate -m --package mocks -o mocks/mock_command_runner.go CommandRunner
// CommandRunner is the first step after a command request has been parsed.
type CommandRunner interface {
@@ -46,7 +46,7 @@ type CommandRunner interface {
RunAutoplanCommand(baseRepo models.Repo, headRepo models.Repo, pull models.PullRequest, user models.User)
}
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_github_pull_getter.go GithubPullGetter
//go:generate pegomock generate -m --package mocks -o mocks/mock_github_pull_getter.go GithubPullGetter
// GithubPullGetter makes API calls to get pull requests.
type GithubPullGetter interface {
@@ -54,7 +54,7 @@ type GithubPullGetter interface {
GetPullRequest(repo models.Repo, pullNum int) (*github.PullRequest, error)
}
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_azuredevops_pull_getter.go AzureDevopsPullGetter
//go:generate pegomock generate -m --package mocks -o mocks/mock_azuredevops_pull_getter.go AzureDevopsPullGetter
// AzureDevopsPullGetter makes API calls to get pull requests.
type AzureDevopsPullGetter interface {
@@ -62,7 +62,7 @@ type AzureDevopsPullGetter interface {
GetPullRequest(repo models.Repo, pullNum int) (*azuredevops.GitPullRequest, error)
}
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_gitlab_merge_request_getter.go GitlabMergeRequestGetter
//go:generate pegomock generate -m --package mocks -o mocks/mock_gitlab_merge_request_getter.go GitlabMergeRequestGetter
// GitlabMergeRequestGetter makes API calls to get merge requests.
type GitlabMergeRequestGetter interface {

View File

@@ -36,6 +36,7 @@ import (
"github.com/runatlantis/atlantis/server/events/models"
"github.com/runatlantis/atlantis/server/events/models/fixtures"
vcsmocks "github.com/runatlantis/atlantis/server/events/vcs/mocks"
vcsmatchers "github.com/runatlantis/atlantis/server/events/vcs/mocks/matchers"
. "github.com/runatlantis/atlantis/testing"
)
@@ -199,11 +200,11 @@ func setup(t *testing.T) *vcsmocks.MockClient {
preWorkflowHooksCommandRunner = mocks.NewMockPreWorkflowHooksCommandRunner()
When(preWorkflowHooksCommandRunner.RunPreHooks(matchers.AnyPtrToEventsCommandContext(), matchers.AnyPtrToEventsCommentCommand())).ThenReturn(nil)
When(preWorkflowHooksCommandRunner.RunPreHooks(matchers.AnyPtrToCommandContext(), matchers.AnyPtrToEventsCommentCommand())).ThenReturn(nil)
postWorkflowHooksCommandRunner = mocks.NewMockPostWorkflowHooksCommandRunner()
When(postWorkflowHooksCommandRunner.RunPostHooks(matchers.AnyPtrToEventsCommandContext(), matchers.AnyPtrToEventsCommentCommand())).ThenReturn(nil)
When(postWorkflowHooksCommandRunner.RunPostHooks(matchers.AnyPtrToCommandContext(), matchers.AnyPtrToEventsCommentCommand())).ThenReturn(nil)
globalCfg := valid.NewGlobalCfgFromArgs(valid.GlobalCfgArgs{})
scope, _, _ := metrics.NewLoggingScope(logger, "atlantis")
@@ -357,7 +358,7 @@ func TestRunCommentCommandPlan_NoProjects_SilenceEnabled(t *testing.T) {
matchers.AnyModelsRepo(),
matchers.AnyModelsPullRequest(),
matchers.EqModelsCommitStatus(models.SuccessCommitStatus),
matchers.EqModelsCommandName(command.Plan),
matchers.EqCommandName(command.Plan),
EqInt(0),
EqInt(0),
)
@@ -378,7 +379,7 @@ func TestRunCommentCommandApply_NoProjects_SilenceEnabled(t *testing.T) {
matchers.AnyModelsRepo(),
matchers.AnyModelsPullRequest(),
matchers.EqModelsCommitStatus(models.SuccessCommitStatus),
matchers.EqModelsCommandName(command.Apply),
matchers.EqCommandName(command.Apply),
EqInt(0),
EqInt(0),
)
@@ -399,7 +400,7 @@ func TestRunCommentCommandApprovePolicy_NoProjects_SilenceEnabled(t *testing.T)
matchers.AnyModelsRepo(),
matchers.AnyModelsPullRequest(),
matchers.EqModelsCommitStatus(models.SuccessCommitStatus),
matchers.EqModelsCommandName(command.PolicyCheck),
matchers.EqCommandName(command.PolicyCheck),
EqInt(0),
EqInt(0),
)
@@ -440,7 +441,7 @@ func TestRunCommentCommand_DisableDisableAutoplan(t *testing.T) {
ch.DisableAutoplan = true
defer func() { ch.DisableAutoplan = false }()
When(projectCommandBuilder.BuildAutoplanCommands(matchers.AnyPtrToEventsCommandContext())).
When(projectCommandBuilder.BuildAutoplanCommands(matchers.AnyPtrToCommandContext())).
ThenReturn([]command.ProjectContext{
{
CommandName: command.Plan,
@@ -451,7 +452,7 @@ func TestRunCommentCommand_DisableDisableAutoplan(t *testing.T) {
}, nil)
ch.RunAutoplanCommand(fixtures.GithubRepo, fixtures.GithubRepo, fixtures.Pull, fixtures.User)
projectCommandBuilder.VerifyWasCalled(Never()).BuildAutoplanCommands(matchers.AnyPtrToEventsCommandContext())
projectCommandBuilder.VerifyWasCalled(Never()).BuildAutoplanCommands(matchers.AnyPtrToCommandContext())
}
func TestRunCommentCommand_ClosedPull(t *testing.T) {
@@ -549,7 +550,7 @@ func TestRunAutoplanCommand_DeletePlans(t *testing.T) {
autoMerger.GlobalAutomerge = true
defer func() { autoMerger.GlobalAutomerge = false }()
When(projectCommandBuilder.BuildAutoplanCommands(matchers.AnyPtrToEventsCommandContext())).
When(projectCommandBuilder.BuildAutoplanCommands(matchers.AnyPtrToCommandContext())).
ThenReturn([]command.ProjectContext{
{
CommandName: command.Plan,
@@ -558,7 +559,7 @@ func TestRunAutoplanCommand_DeletePlans(t *testing.T) {
CommandName: command.Plan,
},
}, nil)
When(projectCommandRunner.Plan(matchers.AnyModelsProjectCommandContext())).ThenReturn(command.ProjectResult{PlanSuccess: &models.PlanSuccess{}})
When(projectCommandRunner.Plan(matchers.AnyCommandProjectContext())).ThenReturn(command.ProjectResult{PlanSuccess: &models.PlanSuccess{}})
When(workingDir.GetPullDir(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn(tmp, nil)
fixtures.Pull.BaseRepo = fixtures.GithubRepo
ch.RunAutoplanCommand(fixtures.GithubRepo, fixtures.GithubRepo, fixtures.Pull, fixtures.User)
@@ -576,7 +577,7 @@ func TestRunGenericPlanCommand_DeletePlans(t *testing.T) {
autoMerger.GlobalAutomerge = true
defer func() { autoMerger.GlobalAutomerge = false }()
When(projectCommandRunner.Plan(matchers.AnyModelsProjectCommandContext())).ThenReturn(command.ProjectResult{PlanSuccess: &models.PlanSuccess{}})
When(projectCommandRunner.Plan(matchers.AnyCommandProjectContext())).ThenReturn(command.ProjectResult{PlanSuccess: &models.PlanSuccess{}})
When(workingDir.GetPullDir(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn(tmp, nil)
pull := &github.PullRequest{State: github.String("open")}
modelPull := models.PullRequest{BaseRepo: fixtures.GithubRepo, State: models.OpenPullState, Num: fixtures.Pull.Num}
@@ -598,7 +599,7 @@ func TestRunSpecificPlanCommandDoesnt_DeletePlans(t *testing.T) {
autoMerger.GlobalAutomerge = true
defer func() { autoMerger.GlobalAutomerge = false }()
When(projectCommandRunner.Plan(matchers.AnyModelsProjectCommandContext())).ThenReturn(command.ProjectResult{PlanSuccess: &models.PlanSuccess{}})
When(projectCommandRunner.Plan(matchers.AnyCommandProjectContext())).ThenReturn(command.ProjectResult{PlanSuccess: &models.PlanSuccess{}})
When(workingDir.GetPullDir(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn(tmp, nil)
fixtures.Pull.BaseRepo = fixtures.GithubRepo
ch.RunCommentCommand(fixtures.GithubRepo, nil, nil, fixtures.User, fixtures.Pull.Num, &events.CommentCommand{Name: command.Plan, ProjectName: "default"})
@@ -617,7 +618,7 @@ func TestRunAutoplanCommandWithError_DeletePlans(t *testing.T) {
autoMerger.GlobalAutomerge = true
defer func() { autoMerger.GlobalAutomerge = false }()
When(projectCommandBuilder.BuildAutoplanCommands(matchers.AnyPtrToEventsCommandContext())).
When(projectCommandBuilder.BuildAutoplanCommands(matchers.AnyPtrToCommandContext())).
ThenReturn([]command.ProjectContext{
{
CommandName: command.Plan,
@@ -627,7 +628,7 @@ func TestRunAutoplanCommandWithError_DeletePlans(t *testing.T) {
},
}, nil)
callCount := 0
When(projectCommandRunner.Plan(matchers.AnyModelsProjectCommandContext())).Then(func(_ []Param) ReturnValues {
When(projectCommandRunner.Plan(matchers.AnyCommandProjectContext())).Then(func(_ []Param) ReturnValues {
if callCount == 0 {
// The first call, we return a successful result.
callCount++
@@ -676,7 +677,7 @@ func TestFailedApprovalCreatesFailedStatusUpdate(t *testing.T) {
When(githubGetter.GetPullRequest(fixtures.GithubRepo, fixtures.Pull.Num)).ThenReturn(pull, nil)
When(eventParsing.ParseGithubPull(pull)).ThenReturn(modelPull, modelPull.BaseRepo, fixtures.GithubRepo, nil)
When(projectCommandBuilder.BuildApprovePoliciesCommands(matchers.AnyPtrToEventsCommandContext(), matchers.AnyPtrToEventsCommentCommand())).ThenReturn([]command.ProjectContext{
When(projectCommandBuilder.BuildApprovePoliciesCommands(matchers.AnyPtrToCommandContext(), matchers.AnyPtrToEventsCommentCommand())).ThenReturn([]command.ProjectContext{
{
CommandName: command.ApprovePolicies,
},
@@ -692,7 +693,7 @@ func TestFailedApprovalCreatesFailedStatusUpdate(t *testing.T) {
matchers.AnyModelsRepo(),
matchers.AnyModelsPullRequest(),
matchers.EqModelsCommitStatus(models.SuccessCommitStatus),
matchers.EqModelsCommandName(command.PolicyCheck),
matchers.EqCommandName(command.PolicyCheck),
EqInt(0),
EqInt(0),
)
@@ -721,7 +722,7 @@ func TestApprovedPoliciesUpdateFailedPolicyStatus(t *testing.T) {
When(githubGetter.GetPullRequest(fixtures.GithubRepo, fixtures.Pull.Num)).ThenReturn(pull, nil)
When(eventParsing.ParseGithubPull(pull)).ThenReturn(modelPull, modelPull.BaseRepo, fixtures.GithubRepo, nil)
When(projectCommandBuilder.BuildApprovePoliciesCommands(matchers.AnyPtrToEventsCommandContext(), matchers.AnyPtrToEventsCommentCommand())).ThenReturn([]command.ProjectContext{
When(projectCommandBuilder.BuildApprovePoliciesCommands(matchers.AnyPtrToCommandContext(), matchers.AnyPtrToEventsCommentCommand())).ThenReturn([]command.ProjectContext{
{
CommandName: command.ApprovePolicies,
PolicySets: valid.PolicySets{
@@ -733,7 +734,7 @@ func TestApprovedPoliciesUpdateFailedPolicyStatus(t *testing.T) {
}, nil)
When(workingDir.GetPullDir(fixtures.GithubRepo, fixtures.Pull)).ThenReturn(tmp, nil)
When(projectCommandRunner.ApprovePolicies(matchers.AnyModelsProjectCommandContext())).Then(func(_ []Param) ReturnValues {
When(projectCommandRunner.ApprovePolicies(matchers.AnyCommandProjectContext())).Then(func(_ []Param) ReturnValues {
return ReturnValues{
command.ProjectResult{
Command: command.PolicyCheck,
@@ -747,7 +748,7 @@ func TestApprovedPoliciesUpdateFailedPolicyStatus(t *testing.T) {
matchers.AnyModelsRepo(),
matchers.AnyModelsPullRequest(),
matchers.EqModelsCommitStatus(models.SuccessCommitStatus),
matchers.EqModelsCommandName(command.PolicyCheck),
matchers.EqCommandName(command.PolicyCheck),
EqInt(1),
EqInt(1),
)
@@ -788,7 +789,7 @@ func TestApplyMergeablityWhenPolicyCheckFails(t *testing.T) {
When(ch.VCSClient.PullIsMergeable(fixtures.GithubRepo, modelPull, "atlantis-test")).ThenReturn(true, nil)
When(projectCommandBuilder.BuildApplyCommands(matchers.AnyPtrToEventsCommandContext(), matchers.AnyPtrToEventsCommentCommand())).Then(func(args []Param) ReturnValues {
When(projectCommandBuilder.BuildApplyCommands(matchers.AnyPtrToCommandContext(), matchers.AnyPtrToEventsCommentCommand())).Then(func(args []Param) ReturnValues {
return ReturnValues{
[]command.ProjectContext{
{
@@ -863,7 +864,7 @@ func TestRunApply_DiscardedProjects(t *testing.T) {
ThenReturn(tmp, nil)
ch.RunCommentCommand(fixtures.GithubRepo, &fixtures.GithubRepo, &pull, fixtures.User, fixtures.Pull.Num, &events.CommentCommand{Name: command.Apply})
vcsClient.VerifyWasCalled(Never()).MergePull(matchers.AnyModelsPullRequest(), matchers.AnyModelsPullRequestOptions())
vcsClient.VerifyWasCalled(Never()).MergePull(matchers.AnyModelsPullRequest(), vcsmatchers.AnyModelsPullRequestOptions())
}
func TestRunCommentCommand_DrainOngoing(t *testing.T) {
@@ -895,8 +896,8 @@ func TestRunAutoplanCommand_DrainNotOngoing(t *testing.T) {
t.Log("if drain is not ongoing then remove ongoing operation must be called even if panic occurred")
setup(t)
fixtures.Pull.BaseRepo = fixtures.GithubRepo
When(projectCommandBuilder.BuildAutoplanCommands(matchers.AnyPtrToEventsCommandContext())).ThenPanic("panic test - if you're seeing this in a test failure this isn't the failing test")
When(projectCommandBuilder.BuildAutoplanCommands(matchers.AnyPtrToCommandContext())).ThenPanic("panic test - if you're seeing this in a test failure this isn't the failing test")
ch.RunAutoplanCommand(fixtures.GithubRepo, fixtures.GithubRepo, fixtures.Pull, fixtures.User)
projectCommandBuilder.VerifyWasCalledOnce().BuildAutoplanCommands(matchers.AnyPtrToEventsCommandContext())
projectCommandBuilder.VerifyWasCalledOnce().BuildAutoplanCommands(matchers.AnyPtrToCommandContext())
Equals(t, 0, drainer.GetStatus().InProgressOps)
}

View File

@@ -49,7 +49,7 @@ const (
// and pasting GitHub comments.
var multiLineRegex = regexp.MustCompile(`.*\r?\n[^\r\n]+`)
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_comment_parsing.go CommentParsing
//go:generate pegomock generate -m --package mocks -o mocks/mock_comment_parsing.go CommentParsing
// CommentParsing handles parsing pull request comments.
type CommentParsing interface {
@@ -58,7 +58,7 @@ type CommentParsing interface {
Parse(comment string, vcsHost models.VCSHostType) CommentParseResult
}
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_comment_building.go CommentBuilder
//go:generate pegomock generate -m --package mocks -o mocks/mock_comment_building.go CommentBuilder
// CommentBuilder builds comment commands that can be used on pull requests.
type CommentBuilder interface {

View File

@@ -23,7 +23,7 @@ import (
"golang.org/x/text/language"
)
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_commit_status_updater.go CommitStatusUpdater
//go:generate pegomock generate -m --package mocks -o mocks/mock_commit_status_updater.go CommitStatusUpdater
// CommitStatusUpdater updates the status of a commit with the VCS host. We set
// the status to signify whether the plan/apply succeeds.

View File

@@ -6,7 +6,7 @@ import (
"github.com/runatlantis/atlantis/server/logging"
)
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_delete_lock_command.go DeleteLockCommand
//go:generate pegomock generate -m --package mocks -o mocks/mock_delete_lock_command.go DeleteLockCommand
// DeleteLockCommand is the first step after a command request has been parsed.
type DeleteLockCommand interface {

View File

@@ -153,7 +153,7 @@ func NewCommentCommand(repoRelDir string, flags []string, name command.Name, ver
}
}
//go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_event_parsing.go EventParsing
//go:generate pegomock generate -m --package mocks -o mocks/mock_event_parsing.go EventParsing
// EventParsing parses webhook events from different VCS hosts into their
// respective Atlantis models.

View File

@@ -2,18 +2,10 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
logging "github.com/runatlantis/atlantis/server/logging"
)
func AnyPtrToLoggingSimpleLogger() logging.SimpleLogging {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(logging.SimpleLogging))(nil)).Elem()))
var nullValue logging.SimpleLogging
return nullValue
}
func EqPtrToLoggingSimpleLogger(value logging.SimpleLogging) logging.SimpleLogging {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue logging.SimpleLogging

View File

@@ -27,11 +27,11 @@ func NewMockWorkingDir(options ...pegomock.Option) *MockWorkingDir {
func (mock *MockWorkingDir) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockWorkingDir) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockWorkingDir) Clone(log logging.SimpleLogging, headRepo models.Repo, p models.PullRequest, workspace string) (string, bool, error) {
func (mock *MockWorkingDir) Clone(_param0 logging.SimpleLogging, _param1 models.Repo, _param2 models.PullRequest, _param3 string) (string, bool, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockWorkingDir().")
}
params := []pegomock.Param{log, headRepo, p, workspace}
params := []pegomock.Param{_param0, _param1, _param2, _param3}
result := pegomock.GetGenericMockFrom(mock).Invoke("Clone", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*bool)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 string
var ret1 bool
@@ -50,45 +50,41 @@ func (mock *MockWorkingDir) Clone(log logging.SimpleLogging, headRepo models.Rep
return ret0, ret1, ret2
}
func (mock *MockWorkingDir) GetWorkingDir(r models.Repo, p models.PullRequest, workspace string) (string, error) {
func (mock *MockWorkingDir) Delete(_param0 models.Repo, _param1 models.PullRequest) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockWorkingDir().")
}
params := []pegomock.Param{r, p, workspace}
result := pegomock.GetGenericMockFrom(mock).Invoke("GetWorkingDir", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 string
var ret1 error
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("Delete", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(string)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockWorkingDir) HasDiverged(log logging.SimpleLogging, cloneDir string) bool {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockWorkingDir().")
}
params := []pegomock.Param{log, cloneDir}
result := pegomock.GetGenericMockFrom(mock).Invoke("HasDiverged", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem()})
var ret0 bool
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(bool)
ret0 = result[0].(error)
}
}
return ret0
}
func (mock *MockWorkingDir) GetPullDir(r models.Repo, p models.PullRequest) (string, error) {
func (mock *MockWorkingDir) DeleteForWorkspace(_param0 models.Repo, _param1 models.PullRequest, _param2 string) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockWorkingDir().")
}
params := []pegomock.Param{r, p}
params := []pegomock.Param{_param0, _param1, _param2}
result := pegomock.GetGenericMockFrom(mock).Invoke("DeleteForWorkspace", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(error)
}
}
return ret0
}
func (mock *MockWorkingDir) GetPullDir(_param0 models.Repo, _param1 models.PullRequest) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockWorkingDir().")
}
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("GetPullDir", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 string
var ret1 error
@@ -103,31 +99,35 @@ func (mock *MockWorkingDir) GetPullDir(r models.Repo, p models.PullRequest) (str
return ret0, ret1
}
func (mock *MockWorkingDir) Delete(r models.Repo, p models.PullRequest) error {
func (mock *MockWorkingDir) GetWorkingDir(_param0 models.Repo, _param1 models.PullRequest, _param2 string) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockWorkingDir().")
}
params := []pegomock.Param{r, p}
result := pegomock.GetGenericMockFrom(mock).Invoke("Delete", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
params := []pegomock.Param{_param0, _param1, _param2}
result := pegomock.GetGenericMockFrom(mock).Invoke("GetWorkingDir", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 string
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(error)
ret0 = result[0].(string)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0
return ret0, ret1
}
func (mock *MockWorkingDir) DeleteForWorkspace(r models.Repo, p models.PullRequest, workspace string) error {
func (mock *MockWorkingDir) HasDiverged(_param0 logging.SimpleLogging, _param1 string) bool {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockWorkingDir().")
}
params := []pegomock.Param{r, p, workspace}
result := pegomock.GetGenericMockFrom(mock).Invoke("DeleteForWorkspace", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
params := []pegomock.Param{_param0, _param1}
result := pegomock.GetGenericMockFrom(mock).Invoke("HasDiverged", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem()})
var ret0 bool
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(error)
ret0 = result[0].(bool)
}
}
return ret0
@@ -170,8 +170,8 @@ type VerifierMockWorkingDir struct {
timeout time.Duration
}
func (verifier *VerifierMockWorkingDir) Clone(log logging.SimpleLogging, headRepo models.Repo, p models.PullRequest, workspace string) *MockWorkingDir_Clone_OngoingVerification {
params := []pegomock.Param{log, headRepo, p, workspace}
func (verifier *VerifierMockWorkingDir) Clone(_param0 logging.SimpleLogging, _param1 models.Repo, _param2 models.PullRequest, _param3 string) *MockWorkingDir_Clone_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2, _param3}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Clone", params, verifier.timeout)
return &MockWorkingDir_Clone_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -182,8 +182,8 @@ type MockWorkingDir_Clone_OngoingVerification struct {
}
func (c *MockWorkingDir_Clone_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, models.Repo, models.PullRequest, string) {
log, headRepo, p, workspace := c.GetAllCapturedArguments()
return log[len(log)-1], headRepo[len(headRepo)-1], p[len(p)-1], workspace[len(workspace)-1]
_param0, _param1, _param2, _param3 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1]
}
func (c *MockWorkingDir_Clone_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []models.Repo, _param2 []models.PullRequest, _param3 []string) {
@@ -209,8 +209,105 @@ func (c *MockWorkingDir_Clone_OngoingVerification) GetAllCapturedArguments() (_p
return
}
func (verifier *VerifierMockWorkingDir) GetWorkingDir(r models.Repo, p models.PullRequest, workspace string) *MockWorkingDir_GetWorkingDir_OngoingVerification {
params := []pegomock.Param{r, p, workspace}
func (verifier *VerifierMockWorkingDir) Delete(_param0 models.Repo, _param1 models.PullRequest) *MockWorkingDir_Delete_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Delete", params, verifier.timeout)
return &MockWorkingDir_Delete_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockWorkingDir_Delete_OngoingVerification struct {
mock *MockWorkingDir
methodInvocations []pegomock.MethodInvocation
}
func (c *MockWorkingDir_Delete_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockWorkingDir_Delete_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(models.Repo)
}
_param1 = make([]models.PullRequest, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(models.PullRequest)
}
}
return
}
func (verifier *VerifierMockWorkingDir) DeleteForWorkspace(_param0 models.Repo, _param1 models.PullRequest, _param2 string) *MockWorkingDir_DeleteForWorkspace_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DeleteForWorkspace", params, verifier.timeout)
return &MockWorkingDir_DeleteForWorkspace_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockWorkingDir_DeleteForWorkspace_OngoingVerification struct {
mock *MockWorkingDir
methodInvocations []pegomock.MethodInvocation
}
func (c *MockWorkingDir_DeleteForWorkspace_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) {
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
}
func (c *MockWorkingDir_DeleteForWorkspace_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(models.Repo)
}
_param1 = make([]models.PullRequest, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(models.PullRequest)
}
_param2 = make([]string, len(c.methodInvocations))
for u, param := range params[2] {
_param2[u] = param.(string)
}
}
return
}
func (verifier *VerifierMockWorkingDir) GetPullDir(_param0 models.Repo, _param1 models.PullRequest) *MockWorkingDir_GetPullDir_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetPullDir", params, verifier.timeout)
return &MockWorkingDir_GetPullDir_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockWorkingDir_GetPullDir_OngoingVerification struct {
mock *MockWorkingDir
methodInvocations []pegomock.MethodInvocation
}
func (c *MockWorkingDir_GetPullDir_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockWorkingDir_GetPullDir_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(models.Repo)
}
_param1 = make([]models.PullRequest, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(models.PullRequest)
}
}
return
}
func (verifier *VerifierMockWorkingDir) GetWorkingDir(_param0 models.Repo, _param1 models.PullRequest, _param2 string) *MockWorkingDir_GetWorkingDir_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetWorkingDir", params, verifier.timeout)
return &MockWorkingDir_GetWorkingDir_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -221,8 +318,8 @@ type MockWorkingDir_GetWorkingDir_OngoingVerification struct {
}
func (c *MockWorkingDir_GetWorkingDir_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) {
r, p, workspace := c.GetAllCapturedArguments()
return r[len(r)-1], p[len(p)-1], workspace[len(workspace)-1]
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
}
func (c *MockWorkingDir_GetWorkingDir_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) {
@@ -244,8 +341,8 @@ func (c *MockWorkingDir_GetWorkingDir_OngoingVerification) GetAllCapturedArgumen
return
}
func (verifier *VerifierMockWorkingDir) HasDiverged(log logging.SimpleLogging, cloneDir string) *MockWorkingDir_HasDiverged_OngoingVerification {
params := []pegomock.Param{log, cloneDir}
func (verifier *VerifierMockWorkingDir) HasDiverged(_param0 logging.SimpleLogging, _param1 string) *MockWorkingDir_HasDiverged_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "HasDiverged", params, verifier.timeout)
return &MockWorkingDir_HasDiverged_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -256,8 +353,8 @@ type MockWorkingDir_HasDiverged_OngoingVerification struct {
}
func (c *MockWorkingDir_HasDiverged_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, string) {
log, cloneDir := c.GetAllCapturedArguments()
return log[len(log)-1], cloneDir[len(cloneDir)-1]
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MockWorkingDir_HasDiverged_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []string) {
@@ -274,100 +371,3 @@ func (c *MockWorkingDir_HasDiverged_OngoingVerification) GetAllCapturedArguments
}
return
}
func (verifier *VerifierMockWorkingDir) GetPullDir(r models.Repo, p models.PullRequest) *MockWorkingDir_GetPullDir_OngoingVerification {
params := []pegomock.Param{r, p}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetPullDir", params, verifier.timeout)
return &MockWorkingDir_GetPullDir_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockWorkingDir_GetPullDir_OngoingVerification struct {
mock *MockWorkingDir
methodInvocations []pegomock.MethodInvocation
}
func (c *MockWorkingDir_GetPullDir_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
r, p := c.GetAllCapturedArguments()
return r[len(r)-1], p[len(p)-1]
}
func (c *MockWorkingDir_GetPullDir_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(models.Repo)
}
_param1 = make([]models.PullRequest, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(models.PullRequest)
}
}
return
}
func (verifier *VerifierMockWorkingDir) Delete(r models.Repo, p models.PullRequest) *MockWorkingDir_Delete_OngoingVerification {
params := []pegomock.Param{r, p}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Delete", params, verifier.timeout)
return &MockWorkingDir_Delete_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockWorkingDir_Delete_OngoingVerification struct {
mock *MockWorkingDir
methodInvocations []pegomock.MethodInvocation
}
func (c *MockWorkingDir_Delete_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
r, p := c.GetAllCapturedArguments()
return r[len(r)-1], p[len(p)-1]
}
func (c *MockWorkingDir_Delete_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(models.Repo)
}
_param1 = make([]models.PullRequest, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(models.PullRequest)
}
}
return
}
func (verifier *VerifierMockWorkingDir) DeleteForWorkspace(r models.Repo, p models.PullRequest, workspace string) *MockWorkingDir_DeleteForWorkspace_OngoingVerification {
params := []pegomock.Param{r, p, workspace}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DeleteForWorkspace", params, verifier.timeout)
return &MockWorkingDir_DeleteForWorkspace_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockWorkingDir_DeleteForWorkspace_OngoingVerification struct {
mock *MockWorkingDir
methodInvocations []pegomock.MethodInvocation
}
func (c *MockWorkingDir_DeleteForWorkspace_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) {
r, p, workspace := c.GetAllCapturedArguments()
return r[len(r)-1], p[len(p)-1], workspace[len(workspace)-1]
}
func (c *MockWorkingDir_DeleteForWorkspace_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(models.Repo)
}
_param1 = make([]models.PullRequest, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(models.PullRequest)
}
_param2 = make([]string, len(c.methodInvocations))
for u, param := range params[2] {
_param2[u] = param.(string)
}
}
return
}

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
azuredevops "github.com/mcdafydd/go-azuredevops/azuredevops"
)

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
events "github.com/runatlantis/atlantis/server/events"
)

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
go_gitlab "github.com/xanzy/go-gitlab"
)

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
go_gitlab "github.com/xanzy/go-gitlab"
)

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
jobs "github.com/runatlantis/atlantis/server/jobs"
)

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
logging "github.com/runatlantis/atlantis/server/logging"
)

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
)
func AnyMapOfStringToString() map[string]string {

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"github.com/runatlantis/atlantis/server/events/command"
)
func AnyModelsCommandName() command.Name {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(command.Name))(nil)).Elem()))
var nullValue command.Name
return nullValue
}
func EqModelsCommandName(value command.Name) command.Name {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue command.Name
return nullValue
}
func NotEqModelsCommandName(value command.Name) command.Name {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue command.Name
return nullValue
}
func ModelsCommandNameThat(matcher pegomock.ArgumentMatcher) command.Name {
pegomock.RegisterMatcher(matcher)
var nullValue command.Name
return nullValue
}

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
models "github.com/runatlantis/atlantis/server/events/models"
)

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"github.com/runatlantis/atlantis/server/events/command"
)
func AnyModelsProjectResult() command.ProjectResult {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(command.ProjectResult))(nil)).Elem()))
var nullValue command.ProjectResult
return nullValue
}
func EqModelsProjectResult(value command.ProjectResult) command.ProjectResult {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue command.ProjectResult
return nullValue
}
func NotEqModelsProjectResult(value command.ProjectResult) command.ProjectResult {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue command.ProjectResult
return nullValue
}
func ModelsProjectResultThat(matcher pegomock.ArgumentMatcher) command.ProjectResult {
pegomock.RegisterMatcher(matcher)
var nullValue command.ProjectResult
return nullValue
}

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
models "github.com/runatlantis/atlantis/server/events/models"
)

View File

@@ -1,21 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
models "github.com/runatlantis/atlantis/server/events/models"
)
func AnyModelsPullRequestOptions() models.PullRequestOptions {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.PullRequestOptions))(nil)).Elem()))
var nullValue models.PullRequestOptions
return nullValue
}
func EqModelsPullRequestOptions(value models.PullRequestOptions) models.PullRequestOptions {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue models.PullRequestOptions
return nullValue
}

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
models "github.com/runatlantis/atlantis/server/events/models"
)

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
models "github.com/runatlantis/atlantis/server/events/models"
)

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
"github.com/petergtz/pegomock"
"reflect"
models "github.com/runatlantis/atlantis/server/events/models"
)
func AnyModelsWorkflowHookCommandContext() models.WorkflowHookCommandContext {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.WorkflowHookCommandContext))(nil)).Elem()))
var nullValue models.WorkflowHookCommandContext
return nullValue
}
func EqModelsWorkflowHookCommandContext(value models.WorkflowHookCommandContext) models.WorkflowHookCommandContext {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue models.WorkflowHookCommandContext
return nullValue
}
func NotEqModelsWorkflowHookCommandContext(value models.WorkflowHookCommandContext) models.WorkflowHookCommandContext {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue models.WorkflowHookCommandContext
return nullValue
}
func ModelsWorkflowHookCommandContextThat(matcher pegomock.ArgumentMatcher) models.WorkflowHookCommandContext {
pegomock.RegisterMatcher(matcher)
var nullValue models.WorkflowHookCommandContext
return nullValue
}

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
azuredevops "github.com/mcdafydd/go-azuredevops/azuredevops"
)

View File

@@ -2,9 +2,8 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
"reflect"
azuredevops "github.com/mcdafydd/go-azuredevops/azuredevops"
)

Some files were not shown because too many files have changed in this diff Show More