fix(deps): update module github.com/petergtz/pegomock/v3 to v4 (#3534)

* fix(deps): update module github.com/petergtz/pegomock/v3 to v4 in go.mod

* remove pegomock generate m option, which is not support after v4

* make regen-mocks

* replace pegomock v4 primitive eq/matchers

* convert pegomock v4 Eq/Any matchers

* remove custom models.Repo matcher

* pegomock v4 cannot use result method args

ref https://github.com/petergtz/pegomock/issues/123

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
Ken Kaizu
2023-06-21 04:05:23 +09:00
committed by GitHub
parent 74c07bad43
commit 3954955e13
269 changed files with 1522 additions and 5156 deletions

2
go.mod
View File

@@ -28,7 +28,7 @@ require (
github.com/mitchellh/go-homedir v1.1.0
github.com/moby/patternmatcher v0.5.0
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/petergtz/pegomock/v3 v3.1.0
github.com/petergtz/pegomock/v4 v4.0.0
github.com/pkg/errors v0.9.1
github.com/redis/go-redis/v9 v9.0.5
github.com/remeh/sizedwaitgroup v1.0.0

4
go.sum
View File

@@ -342,8 +342,8 @@ github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg=
github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ=
github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4=
github.com/petergtz/pegomock/v3 v3.1.0 h1:Pkn9DXS0DXb7CsUhvDutX7JNj0NIyjvZ5qWqnDTMAAE=
github.com/petergtz/pegomock/v3 v3.1.0/go.mod h1:1+YY4LlCpraeTFFYDY6JI6g6zoWKFGny0LpgPXk6YZw=
github.com/petergtz/pegomock/v4 v4.0.0 h1:BIGMUof4NXc+xBbuFk0VBfK5Ls7DplcP+LWz4hfYWsY=
github.com/petergtz/pegomock/v4 v4.0.0/go.mod h1:Xscaw/kXYcuh9sGsns+If19FnSMMQy4Wz60YJTn3XOU=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=

View File

@@ -7,13 +7,12 @@ import (
"net/http/httptest"
"testing"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
"github.com/runatlantis/atlantis/server/controllers"
. "github.com/runatlantis/atlantis/server/core/locking/mocks"
"github.com/runatlantis/atlantis/server/events"
"github.com/runatlantis/atlantis/server/events/command"
. "github.com/runatlantis/atlantis/server/events/mocks"
. "github.com/runatlantis/atlantis/server/events/mocks/matchers"
"github.com/runatlantis/atlantis/server/events/models"
. "github.com/runatlantis/atlantis/server/events/vcs/mocks"
"github.com/runatlantis/atlantis/server/logging"
@@ -37,8 +36,8 @@ func TestAPIController_Plan(t *testing.T) {
w := httptest.NewRecorder()
ac.Plan(w, req)
ResponseContains(t, w, http.StatusOK, "")
projectCommandBuilder.VerifyWasCalledOnce().BuildPlanCommands(AnyPtrToCommandContext(), AnyPtrToEventsCommentCommand())
projectCommandRunner.VerifyWasCalledOnce().Plan(AnyCommandProjectContext())
projectCommandBuilder.VerifyWasCalledOnce().BuildPlanCommands(Any[*command.Context](), Any[*events.CommentCommand]())
projectCommandRunner.VerifyWasCalledOnce().Plan(Any[command.ProjectContext]())
}
func TestAPIController_Apply(t *testing.T) {
@@ -54,9 +53,9 @@ func TestAPIController_Apply(t *testing.T) {
w := httptest.NewRecorder()
ac.Apply(w, req)
ResponseContains(t, w, http.StatusOK, "")
projectCommandBuilder.VerifyWasCalledOnce().BuildApplyCommands(AnyPtrToCommandContext(), AnyPtrToEventsCommentCommand())
projectCommandRunner.VerifyWasCalledOnce().Plan(AnyCommandProjectContext())
projectCommandRunner.VerifyWasCalledOnce().Apply(AnyCommandProjectContext())
projectCommandBuilder.VerifyWasCalledOnce().BuildApplyCommands(Any[*command.Context](), Any[*events.CommentCommand]())
projectCommandRunner.VerifyWasCalledOnce().Plan(Any[command.ProjectContext]())
projectCommandRunner.VerifyWasCalledOnce().Apply(Any[command.ProjectContext]())
}
func setup(t *testing.T) (controllers.APIController, *MockProjectCommandBuilder, *MockProjectCommandRunner) {
@@ -70,20 +69,20 @@ func setup(t *testing.T) (controllers.APIController, *MockProjectCommandBuilder,
Ok(t, err)
projectCommandBuilder := NewMockProjectCommandBuilder()
When(projectCommandBuilder.BuildPlanCommands(AnyPtrToCommandContext(), AnyPtrToEventsCommentCommand())).
When(projectCommandBuilder.BuildPlanCommands(Any[*command.Context](), Any[*events.CommentCommand]())).
ThenReturn([]command.ProjectContext{{
CommandName: command.Plan,
}}, nil)
When(projectCommandBuilder.BuildApplyCommands(AnyPtrToCommandContext(), AnyPtrToEventsCommentCommand())).
When(projectCommandBuilder.BuildApplyCommands(Any[*command.Context](), Any[*events.CommentCommand]())).
ThenReturn([]command.ProjectContext{{
CommandName: command.Apply,
}}, nil)
projectCommandRunner := NewMockProjectCommandRunner()
When(projectCommandRunner.Plan(AnyCommandProjectContext())).ThenReturn(command.ProjectResult{
When(projectCommandRunner.Plan(Any[command.ProjectContext]())).ThenReturn(command.ProjectResult{
PlanSuccess: &models.PlanSuccess{},
})
When(projectCommandRunner.Apply(AnyCommandProjectContext())).ThenReturn(command.ProjectResult{
When(projectCommandRunner.Apply(Any[command.ProjectContext]())).ThenReturn(command.ProjectResult{
ApplySuccess: "success",
})

View File

@@ -8,7 +8,7 @@ import (
"github.com/mcdafydd/go-azuredevops/azuredevops"
)
//go:generate pegomock generate -m --package mocks -o mocks/mock_azuredevops_request_validator.go AzureDevopsRequestValidator
//go:generate pegomock generate --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

@@ -5,7 +5,7 @@ import (
"net/http"
"testing"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
"github.com/runatlantis/atlantis/server/controllers/events"
. "github.com/runatlantis/atlantis/testing"
)

View File

@@ -15,7 +15,7 @@ import (
"github.com/google/go-github/v53/github"
"github.com/hashicorp/go-version"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
"github.com/runatlantis/atlantis/server"
events_controllers "github.com/runatlantis/atlantis/server/controllers/events"
@@ -25,17 +25,14 @@ import (
"github.com/runatlantis/atlantis/server/core/locking"
"github.com/runatlantis/atlantis/server/core/runtime"
runtimemocks "github.com/runatlantis/atlantis/server/core/runtime/mocks"
runtimematchers "github.com/runatlantis/atlantis/server/core/runtime/mocks/matchers"
"github.com/runatlantis/atlantis/server/core/runtime/policy"
"github.com/runatlantis/atlantis/server/core/terraform"
"github.com/runatlantis/atlantis/server/events"
"github.com/runatlantis/atlantis/server/events/command"
"github.com/runatlantis/atlantis/server/events/mocks"
"github.com/runatlantis/atlantis/server/events/mocks/matchers"
"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"
@@ -579,8 +576,8 @@ func TestGitHubWorkflow(t *testing.T) {
// Setup test dependencies.
w := httptest.NewRecorder()
When(githubGetter.GetPullRequest(AnyRepo(), AnyInt())).ThenReturn(GitHubPullRequestParsed(headSHA), nil)
When(vcsClient.GetModifiedFiles(AnyRepo(), matchers.AnyModelsPullRequest())).ThenReturn(c.ModifiedFiles, nil)
When(githubGetter.GetPullRequest(Any[models.Repo](), Any[int]())).ThenReturn(GitHubPullRequestParsed(headSHA), nil)
When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn(c.ModifiedFiles, nil)
// First, send the open pull request event which triggers autoplan.
pullOpenedReq := GitHubPullRequestOpenedEvent(t, headSHA)
@@ -613,9 +610,9 @@ func TestGitHubWorkflow(t *testing.T) {
expNumHooks := len(c.Comments) + 1 - c.ExpParseFailedCount
// Let's verify the pre-workflow hook was called for each comment including the pull request opened event
mockPreWorkflowHookRunner.VerifyWasCalled(Times(expNumHooks)).Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString("some dummy command"), AnyString())
mockPreWorkflowHookRunner.VerifyWasCalled(Times(expNumHooks)).Run(Any[models.WorkflowHookCommandContext](), Eq("some dummy command"), Any[string]())
// Let's verify the post-workflow hook was called for each comment including the pull request opened event
mockPostWorkflowHookRunner.VerifyWasCalled(Times(expNumHooks)).Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString("some post dummy command"), AnyString())
mockPostWorkflowHookRunner.VerifyWasCalled(Times(expNumHooks)).Run(Any[models.WorkflowHookCommandContext](), Eq("some post dummy command"), Any[string]())
// Now we're ready to verify Atlantis made all the comments back (or
// replies) that we expect. We expect each plan to have 1 comment,
@@ -631,7 +628,7 @@ func TestGitHubWorkflow(t *testing.T) {
expNumReplies++
}
_, _, actReplies, _ := vcsClient.VerifyWasCalled(Times(expNumReplies)).CreateComment(AnyRepo(), AnyInt(), AnyString(), AnyString()).GetAllCapturedArguments()
_, _, actReplies, _ := vcsClient.VerifyWasCalled(Times(expNumReplies)).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()).GetAllCapturedArguments()
Assert(t, len(c.ExpReplies) == len(actReplies), "missing expected replies, got %d but expected %d", len(actReplies), len(c.ExpReplies))
for i, expReply := range c.ExpReplies {
assertCommentEquals(t, expReply, actReplies[i], c.RepoDir, c.ExpParallel)
@@ -639,9 +636,9 @@ func TestGitHubWorkflow(t *testing.T) {
if c.ExpAutomerge {
// Verify that the merge API call was made.
vcsClient.VerifyWasCalledOnce().MergePull(matchers.AnyModelsPullRequest(), vcsmatchers.AnyModelsPullRequestOptions())
vcsClient.VerifyWasCalledOnce().MergePull(Any[models.PullRequest](), Any[models.PullRequestOptions]())
} else {
vcsClient.VerifyWasCalled(Never()).MergePull(matchers.AnyModelsPullRequest(), vcsmatchers.AnyModelsPullRequestOptions())
vcsClient.VerifyWasCalled(Never()).MergePull(Any[models.PullRequest](), Any[models.PullRequestOptions]())
}
})
}
@@ -744,8 +741,8 @@ func TestSimpleWorkflow_terraformLockFile(t *testing.T) {
// Setup test dependencies.
w := httptest.NewRecorder()
When(githubGetter.GetPullRequest(AnyRepo(), AnyInt())).ThenReturn(GitHubPullRequestParsed(headSHA), nil)
When(vcsClient.GetModifiedFiles(AnyRepo(), matchers.AnyModelsPullRequest())).ThenReturn(c.ModifiedFiles, nil)
When(githubGetter.GetPullRequest(Any[models.Repo](), Any[int]())).ThenReturn(GitHubPullRequestParsed(headSHA), nil)
When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn(c.ModifiedFiles, nil)
// First, send the open pull request event which triggers autoplan.
pullOpenedReq := GitHubPullRequestOpenedEvent(t, headSHA)
@@ -797,14 +794,14 @@ func TestSimpleWorkflow_terraformLockFile(t *testing.T) {
}
// Let's verify the pre-workflow hook was called for each comment including the pull request opened event
mockPreWorkflowHookRunner.VerifyWasCalled(Times(2)).Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString("some dummy command"), AnyString())
mockPreWorkflowHookRunner.VerifyWasCalled(Times(2)).Run(Any[models.WorkflowHookCommandContext](), Eq("some dummy command"), Any[string]())
// Now we're ready to verify Atlantis made all the comments back (or
// replies) that we expect. We expect each plan to have 1 comment,
// and apply have 1 for each comment plus one for the locks deleted at the
// end.
_, _, actReplies, _ := vcsClient.VerifyWasCalled(Times(2)).CreateComment(AnyRepo(), AnyInt(), AnyString(), AnyString()).GetAllCapturedArguments()
_, _, actReplies, _ := vcsClient.VerifyWasCalled(Times(2)).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()).GetAllCapturedArguments()
Assert(t, len(c.ExpReplies) == len(actReplies), "missing expected replies, got %d but expected %d", len(actReplies), len(c.ExpReplies))
for i, expReply := range c.ExpReplies {
assertCommentEquals(t, expReply, actReplies[i], c.RepoDir, false)
@@ -1010,12 +1007,12 @@ func TestGitHubWorkflowWithPolicyCheck(t *testing.T) {
// Setup test dependencies.
w := httptest.NewRecorder()
When(vcsClient.PullIsMergeable(AnyRepo(), matchers.AnyModelsPullRequest(), EqString("atlantis-test"))).ThenReturn(true, nil)
When(vcsClient.PullIsApproved(AnyRepo(), matchers.AnyModelsPullRequest())).ThenReturn(models.ApprovalStatus{
When(vcsClient.PullIsMergeable(Any[models.Repo](), Any[models.PullRequest](), Eq("atlantis-test"))).ThenReturn(true, nil)
When(vcsClient.PullIsApproved(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn(models.ApprovalStatus{
IsApproved: true,
}, nil)
When(githubGetter.GetPullRequest(AnyRepo(), AnyInt())).ThenReturn(GitHubPullRequestParsed(headSHA), nil)
When(vcsClient.GetModifiedFiles(AnyRepo(), matchers.AnyModelsPullRequest())).ThenReturn(c.ModifiedFiles, nil)
When(githubGetter.GetPullRequest(Any[models.Repo](), Any[int]())).ThenReturn(GitHubPullRequestParsed(headSHA), nil)
When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn(c.ModifiedFiles, nil)
// First, send the open pull request event which triggers autoplan.
pullOpenedReq := GitHubPullRequestOpenedEvent(t, headSHA)
@@ -1063,7 +1060,7 @@ func TestGitHubWorkflowWithPolicyCheck(t *testing.T) {
expNumReplies--
}
_, _, actReplies, _ := vcsClient.VerifyWasCalled(Times(expNumReplies)).CreateComment(AnyRepo(), AnyInt(), AnyString(), AnyString()).GetAllCapturedArguments()
_, _, actReplies, _ := vcsClient.VerifyWasCalled(Times(expNumReplies)).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()).GetAllCapturedArguments()
Assert(t, len(c.ExpReplies) == len(actReplies), "missing expected replies, got %d but expected %d", len(actReplies), len(c.ExpReplies))
for i, expReply := range c.ExpReplies {
assertCommentEquals(t, expReply, actReplies[i], c.RepoDir, c.ExpParallel)
@@ -1071,9 +1068,9 @@ func TestGitHubWorkflowWithPolicyCheck(t *testing.T) {
if c.ExpAutomerge {
// Verify that the merge API call was made.
vcsClient.VerifyWasCalledOnce().MergePull(matchers.AnyModelsPullRequest(), vcsmatchers.AnyModelsPullRequestOptions())
vcsClient.VerifyWasCalledOnce().MergePull(Any[models.PullRequest](), Any[models.PullRequestOptions]())
} else {
vcsClient.VerifyWasCalled(Never()).MergePull(matchers.AnyModelsPullRequest(), vcsmatchers.AnyModelsPullRequestOptions())
vcsClient.VerifyWasCalled(Never()).MergePull(Any[models.PullRequest](), Any[models.PullRequestOptions]())
}
})
}

View File

@@ -22,16 +22,16 @@ import (
"net/http/httptest"
"os"
"path/filepath"
"reflect"
"strings"
"testing"
. "github.com/petergtz/pegomock/v3"
"github.com/google/go-github/v53/github"
"github.com/mcdafydd/go-azuredevops/azuredevops"
. "github.com/petergtz/pegomock/v4"
events_controllers "github.com/runatlantis/atlantis/server/controllers/events"
"github.com/runatlantis/atlantis/server/controllers/events/mocks"
"github.com/runatlantis/atlantis/server/events"
emocks "github.com/runatlantis/atlantis/server/events/mocks"
"github.com/runatlantis/atlantis/server/events/mocks/matchers"
"github.com/runatlantis/atlantis/server/events/models"
vcsmocks "github.com/runatlantis/atlantis/server/events/vcs/mocks"
"github.com/runatlantis/atlantis/server/logging"
@@ -47,11 +47,6 @@ const azuredevopsHeader = "Request-Id"
var user = []byte("user")
var secret = []byte("secret")
func AnyRepo() models.Repo {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf(models.Repo{})))
return models.Repo{}
}
func TestPost_NotGithubOrGitlab(t *testing.T) {
t.Log("when the request is not for gitlab or github a 400 is returned")
e, _, _, _, _, _, _, _, _ := setup(t)
@@ -159,7 +154,7 @@ func TestPost_GithubInvalidComment(t *testing.T) {
req.Header.Set(githubHeader, "issue_comment")
event := `{"action": "created"}`
When(v.Validate(req, secret)).ThenReturn([]byte(event), nil)
When(p.ParseGithubIssueCommentEvent(matchers.AnyPtrToGithubIssueCommentEvent())).ThenReturn(models.Repo{}, models.User{}, 1, errors.New("err"))
When(p.ParseGithubIssueCommentEvent(Any[*github.IssueCommentEvent]())).ThenReturn(models.Repo{}, models.User{}, 1, errors.New("err"))
w := httptest.NewRecorder()
e.Post(w, req)
ResponseContains(t, w, http.StatusBadRequest, "Failed parsing event")
@@ -184,7 +179,7 @@ func TestPost_GithubCommentInvalidCommand(t *testing.T) {
req.Header.Set(githubHeader, "issue_comment")
event := `{"action": "created"}`
When(v.Validate(req, secret)).ThenReturn([]byte(event), nil)
When(p.ParseGithubIssueCommentEvent(matchers.AnyPtrToGithubIssueCommentEvent())).ThenReturn(models.Repo{}, models.User{}, 1, nil)
When(p.ParseGithubIssueCommentEvent(Any[*github.IssueCommentEvent]())).ThenReturn(models.Repo{}, models.User{}, 1, nil)
When(cp.Parse("", models.Github)).ThenReturn(events.CommentParseResult{Ignore: true})
w := httptest.NewRecorder()
e.Post(w, req)
@@ -251,7 +246,7 @@ func TestPost_GitlabCommentNotAllowlistedWithSilenceErrors(t *testing.T) {
body, _ := io.ReadAll(w.Result().Body)
exp := "Repo not allowlisted"
Assert(t, strings.Contains(string(body), exp), "exp %q to be contained in %q", exp, string(body))
vcsClient.VerifyWasCalled(Never()).CreateComment(matchers.AnyModelsRepo(), AnyInt(), AnyString(), AnyString())
vcsClient.VerifyWasCalled(Never()).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]())
}
@@ -316,7 +311,7 @@ func TestPost_GithubCommentNotAllowlistedWithSilenceErrors(t *testing.T) {
body, _ := io.ReadAll(w.Result().Body)
exp := "Repo not allowlisted"
Assert(t, strings.Contains(string(body), exp), "exp %q to be contained in %q", exp, string(body))
vcsClient.VerifyWasCalled(Never()).CreateComment(matchers.AnyModelsRepo(), AnyInt(), AnyString(), AnyString())
vcsClient.VerifyWasCalled(Never()).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]())
}
func TestPost_GitlabCommentResponse(t *testing.T) {
@@ -341,7 +336,7 @@ func TestPost_GithubCommentResponse(t *testing.T) {
When(v.Validate(req, secret)).ThenReturn([]byte(event), nil)
baseRepo := models.Repo{}
user := models.User{}
When(p.ParseGithubIssueCommentEvent(matchers.AnyPtrToGithubIssueCommentEvent())).ThenReturn(baseRepo, user, 1, nil)
When(p.ParseGithubIssueCommentEvent(Any[*github.IssueCommentEvent]())).ThenReturn(baseRepo, user, 1, nil)
When(cp.Parse("", models.Github)).ThenReturn(events.CommentParseResult{CommentResponse: "a comment"})
w := httptest.NewRecorder()
@@ -373,7 +368,7 @@ func TestPost_GithubCommentSuccess(t *testing.T) {
baseRepo := models.Repo{}
user := models.User{}
cmd := events.CommentCommand{}
When(p.ParseGithubIssueCommentEvent(matchers.AnyPtrToGithubIssueCommentEvent())).ThenReturn(baseRepo, user, 1, nil)
When(p.ParseGithubIssueCommentEvent(Any[*github.IssueCommentEvent]())).ThenReturn(baseRepo, user, 1, nil)
When(cp.Parse("", models.Github)).ThenReturn(events.CommentParseResult{Command: &cmd})
w := httptest.NewRecorder()
e.Post(w, req)
@@ -392,7 +387,7 @@ func TestPost_GithubCommentReaction(t *testing.T) {
baseRepo := models.Repo{}
user := models.User{}
cmd := events.CommentCommand{}
When(p.ParseGithubIssueCommentEvent(matchers.AnyPtrToGithubIssueCommentEvent())).ThenReturn(baseRepo, user, 1, nil)
When(p.ParseGithubIssueCommentEvent(Any[*github.IssueCommentEvent]())).ThenReturn(baseRepo, user, 1, nil)
When(cp.Parse("", models.Github)).ThenReturn(events.CommentParseResult{Command: &cmd})
w := httptest.NewRecorder()
e.Post(w, req)
@@ -421,7 +416,7 @@ func TestPost_GithubPullRequestInvalid(t *testing.T) {
event := `{"action": "closed"}`
When(v.Validate(req, secret)).ThenReturn([]byte(event), nil)
When(p.ParseGithubPullEvent(matchers.AnyPtrToGithubPullRequestEvent())).ThenReturn(models.PullRequest{}, models.OpenedPullEvent, models.Repo{}, models.Repo{}, models.User{}, errors.New("err"))
When(p.ParseGithubPullEvent(Any[*github.PullRequestEvent]())).ThenReturn(models.PullRequest{}, models.OpenedPullEvent, models.Repo{}, models.Repo{}, models.User{}, errors.New("err"))
w := httptest.NewRecorder()
e.Post(w, req)
ResponseContains(t, w, http.StatusBadRequest, "Error parsing pull data: err")
@@ -693,7 +688,7 @@ func TestPost_AzureDevopsPullRequestCommentPassingIgnores(t *testing.T) {
e, _, _, ado, _, _, _, _, _ := setup(t)
repo := models.Repo{}
When(e.Parser.ParseAzureDevopsRepo(matchers.AnyPtrToAzuredevopsGitRepository())).ThenReturn(repo, nil)
When(e.Parser.ParseAzureDevopsRepo(Any[*azuredevops.GitRepository]())).ThenReturn(repo, nil)
payload := `{
"subscriptionId": "11111111-1111-1111-1111-111111111111",
@@ -739,7 +734,7 @@ func TestPost_GithubPullRequestClosedErrCleaningPull(t *testing.T) {
When(v.Validate(req, secret)).ThenReturn([]byte(event), nil)
repo := models.Repo{}
pull := models.PullRequest{State: models.ClosedPullState}
When(p.ParseGithubPullEvent(matchers.AnyPtrToGithubPullRequestEvent())).ThenReturn(pull, models.OpenedPullEvent, repo, repo, models.User{}, nil)
When(p.ParseGithubPullEvent(Any[*github.PullRequestEvent]())).ThenReturn(pull, models.OpenedPullEvent, repo, repo, models.User{}, nil)
When(c.CleanUpPull(repo, pull)).ThenReturn(errors.New("cleanup err"))
w := httptest.NewRecorder()
e.Post(w, req)
@@ -775,7 +770,7 @@ func TestPost_GithubClosedPullRequestSuccess(t *testing.T) {
When(v.Validate(req, secret)).ThenReturn([]byte(event), nil)
repo := models.Repo{}
pull := models.PullRequest{State: models.ClosedPullState}
When(p.ParseGithubPullEvent(matchers.AnyPtrToGithubPullRequestEvent())).ThenReturn(pull, models.OpenedPullEvent, repo, repo, models.User{}, nil)
When(p.ParseGithubPullEvent(Any[*github.PullRequestEvent]())).ThenReturn(pull, models.OpenedPullEvent, repo, repo, models.User{}, nil)
When(c.CleanUpPull(repo, pull)).ThenReturn(nil)
w := httptest.NewRecorder()
e.Post(w, req)
@@ -928,7 +923,7 @@ func TestPost_PullOpenedOrUpdated(t *testing.T) {
When(v.Validate(req, secret)).ThenReturn([]byte(event), nil)
repo = models.Repo{}
pullRequest = models.PullRequest{State: models.ClosedPullState}
When(p.ParseGithubPullEvent(matchers.AnyPtrToGithubPullRequestEvent())).ThenReturn(pullRequest, models.OpenedPullEvent, repo, repo, models.User{}, nil)
When(p.ParseGithubPullEvent(Any[*github.PullRequestEvent]())).ThenReturn(pullRequest, models.OpenedPullEvent, repo, repo, models.User{}, nil)
}
w := httptest.NewRecorder()

View File

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

View File

@@ -19,7 +19,7 @@ import (
"net/url"
"testing"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
"github.com/runatlantis/atlantis/server/controllers/events"
. "github.com/runatlantis/atlantis/testing"
)

View File

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

View File

@@ -19,7 +19,7 @@ import (
"reflect"
"testing"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
"github.com/runatlantis/atlantis/server/controllers/events"
. "github.com/runatlantis/atlantis/testing"
gitlab "github.com/xanzy/go-gitlab"

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
http "net/http"
)
func AnyPtrToHttpRequest() *http.Request {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*http.Request))(nil)).Elem()))
var nullValue *http.Request
return nullValue
}
func EqPtrToHttpRequest(value *http.Request) *http.Request {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue *http.Request
return nullValue
}
func NotEqPtrToHttpRequest(value *http.Request) *http.Request {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue *http.Request
return nullValue
}
func PtrToHttpRequestThat(matcher pegomock.ArgumentMatcher) *http.Request {
pegomock.RegisterMatcher(matcher)
var nullValue *http.Request
return nullValue
}

View File

@@ -1,31 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
)
func AnySliceOfByte() []byte {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]byte))(nil)).Elem()))
var nullValue []byte
return nullValue
}
func EqSliceOfByte(value []byte) []byte {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue []byte
return nullValue
}
func NotEqSliceOfByte(value []byte) []byte {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue []byte
return nullValue
}
func SliceOfByteThat(matcher pegomock.ArgumentMatcher) []byte {
pegomock.RegisterMatcher(matcher)
var nullValue []byte
return nullValue
}

View File

@@ -4,7 +4,7 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
http "net/http"
"reflect"
"time"
@@ -25,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(_param0 *http.Request, _param1 []byte, _param2 []byte) ([]byte, error) {
func (mock *MockAzureDevopsRequestValidator) Validate(r *http.Request, user []byte, pass []byte) ([]byte, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockAzureDevopsRequestValidator().")
}
params := []pegomock.Param{_param0, _param1, _param2}
params := []pegomock.Param{r, user, pass}
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
@@ -81,8 +81,8 @@ type VerifierMockAzureDevopsRequestValidator struct {
timeout time.Duration
}
func (verifier *VerifierMockAzureDevopsRequestValidator) Validate(_param0 *http.Request, _param1 []byte, _param2 []byte) *MockAzureDevopsRequestValidator_Validate_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
func (verifier *VerifierMockAzureDevopsRequestValidator) Validate(r *http.Request, user []byte, pass []byte) *MockAzureDevopsRequestValidator_Validate_OngoingVerification {
params := []pegomock.Param{r, user, pass}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Validate", params, verifier.timeout)
return &MockAzureDevopsRequestValidator_Validate_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -93,8 +93,8 @@ type MockAzureDevopsRequestValidator_Validate_OngoingVerification struct {
}
func (c *MockAzureDevopsRequestValidator_Validate_OngoingVerification) GetCapturedArguments() (*http.Request, []byte, []byte) {
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
r, user, pass := c.GetAllCapturedArguments()
return r[len(r)-1], user[len(user)-1], pass[len(pass)-1]
}
func (c *MockAzureDevopsRequestValidator_Validate_OngoingVerification) GetAllCapturedArguments() (_param0 []*http.Request, _param1 [][]byte, _param2 [][]byte) {

View File

@@ -4,7 +4,7 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
http "net/http"
"reflect"
"time"
@@ -25,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(_param0 *http.Request, _param1 []byte) ([]byte, error) {
func (mock *MockGithubRequestValidator) Validate(r *http.Request, secret []byte) ([]byte, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockGithubRequestValidator().")
}
params := []pegomock.Param{_param0, _param1}
params := []pegomock.Param{r, secret}
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
@@ -81,8 +81,8 @@ type VerifierMockGithubRequestValidator struct {
timeout time.Duration
}
func (verifier *VerifierMockGithubRequestValidator) Validate(_param0 *http.Request, _param1 []byte) *MockGithubRequestValidator_Validate_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
func (verifier *VerifierMockGithubRequestValidator) Validate(r *http.Request, secret []byte) *MockGithubRequestValidator_Validate_OngoingVerification {
params := []pegomock.Param{r, secret}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Validate", params, verifier.timeout)
return &MockGithubRequestValidator_Validate_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -93,8 +93,8 @@ type MockGithubRequestValidator_Validate_OngoingVerification struct {
}
func (c *MockGithubRequestValidator_Validate_OngoingVerification) GetCapturedArguments() (*http.Request, []byte) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
r, secret := c.GetAllCapturedArguments()
return r[len(r)-1], secret[len(secret)-1]
}
func (c *MockGithubRequestValidator_Validate_OngoingVerification) GetAllCapturedArguments() (_param0 []*http.Request, _param1 [][]byte) {

View File

@@ -4,7 +4,7 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
http "net/http"
"reflect"
"time"
@@ -25,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(_param0 *http.Request, _param1 []byte) (interface{}, error) {
func (mock *MockGitlabRequestParserValidator) ParseAndValidate(r *http.Request, secret []byte) (interface{}, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockGitlabRequestParserValidator().")
}
params := []pegomock.Param{_param0, _param1}
params := []pegomock.Param{r, secret}
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
@@ -81,8 +81,8 @@ type VerifierMockGitlabRequestParserValidator struct {
timeout time.Duration
}
func (verifier *VerifierMockGitlabRequestParserValidator) ParseAndValidate(_param0 *http.Request, _param1 []byte) *MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
func (verifier *VerifierMockGitlabRequestParserValidator) ParseAndValidate(r *http.Request, secret []byte) *MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification {
params := []pegomock.Param{r, secret}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseAndValidate", params, verifier.timeout)
return &MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -93,8 +93,8 @@ type MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification struc
}
func (c *MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification) GetCapturedArguments() (*http.Request, []byte) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
r, secret := c.GetAllCapturedArguments()
return r[len(r)-1], secret[len(secret)-1]
}
func (c *MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification) GetAllCapturedArguments() (_param0 []*http.Request, _param1 [][]byte) {

View File

@@ -7,7 +7,6 @@ import (
"net/http"
"net/http/httptest"
"net/url"
"reflect"
"testing"
"time"
@@ -18,7 +17,7 @@ import (
"github.com/runatlantis/atlantis/server/core/locking"
"github.com/gorilla/mux"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
"github.com/runatlantis/atlantis/server/events"
"github.com/runatlantis/atlantis/server/core/locking/mocks"
@@ -30,11 +29,6 @@ import (
. "github.com/runatlantis/atlantis/testing"
)
func AnyRepo() models.Repo {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf(models.Repo{})))
return models.Repo{}
}
func TestCreateApplyLock(t *testing.T) {
t.Run("Creates apply lock", func(t *testing.T) {
req, _ := http.NewRequest("GET", "", bytes.NewBuffer(nil))
@@ -272,7 +266,7 @@ func TestDeleteLock_OldFormat(t *testing.T) {
w := httptest.NewRecorder()
lc.DeleteLock(w, req)
ResponseContains(t, w, http.StatusOK, "Deleted lock id \"id\"")
cp.VerifyWasCalled(Never()).CreateComment(AnyRepo(), AnyInt(), AnyString(), AnyString())
cp.VerifyWasCalled(Never()).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]())
}
func TestDeleteLock_UpdateProjectStatus(t *testing.T) {
@@ -356,7 +350,7 @@ func TestDeleteLock_CommentFailed(t *testing.T) {
tmp := t.TempDir()
backend, err := db.New(tmp)
Ok(t, err)
When(cp.CreateComment(AnyRepo(), AnyInt(), AnyString(), AnyString())).ThenReturn(errors.New("err"))
When(cp.CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]())).ThenReturn(errors.New("err"))
lc := controllers.LocksController{
DeleteLockCommand: dlc,
Logger: logging.NewNoopLogger(t),

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
io "io"
)
func AnyIoWriter() io.Writer {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(io.Writer))(nil)).Elem()))
var nullValue io.Writer
return nullValue
}
func EqIoWriter(value io.Writer) io.Writer {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue io.Writer
return nullValue
}
func NotEqIoWriter(value io.Writer) io.Writer {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue io.Writer
return nullValue
}
func IoWriterThat(matcher pegomock.ArgumentMatcher) io.Writer {
pegomock.RegisterMatcher(matcher)
var nullValue io.Writer
return nullValue
}

View File

@@ -4,7 +4,7 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
io "io"
"reflect"
"time"
@@ -25,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(_param0 io.Writer, _param1 interface{}) error {
func (mock *MockTemplateWriter) Execute(wr io.Writer, data interface{}) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockTemplateWriter().")
}
params := []pegomock.Param{_param0, _param1}
params := []pegomock.Param{wr, data}
result := pegomock.GetGenericMockFrom(mock).Invoke("Execute", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
@@ -77,8 +77,8 @@ type VerifierMockTemplateWriter struct {
timeout time.Duration
}
func (verifier *VerifierMockTemplateWriter) Execute(_param0 io.Writer, _param1 interface{}) *MockTemplateWriter_Execute_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
func (verifier *VerifierMockTemplateWriter) Execute(wr io.Writer, data interface{}) *MockTemplateWriter_Execute_OngoingVerification {
params := []pegomock.Param{wr, data}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Execute", params, verifier.timeout)
return &MockTemplateWriter_Execute_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -89,8 +89,8 @@ type MockTemplateWriter_Execute_OngoingVerification struct {
}
func (c *MockTemplateWriter_Execute_OngoingVerification) GetCapturedArguments() (io.Writer, interface{}) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
wr, data := c.GetAllCapturedArguments()
return wr[len(wr)-1], data[len(data)-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 --package mocks -o mocks/mock_template_writer.go TemplateWriter
//go:generate pegomock generate --package mocks -o mocks/mock_template_writer.go TemplateWriter
// TemplateWriter is an interface over html/template that's used to enable
// mocking.

View File

@@ -30,16 +30,16 @@ const DefaultAbortOnExcecutionOrderFail = false
// RepoCfg is the raw schema for repo-level atlantis.yaml config.
type RepoCfg struct {
Version *int `yaml:"version,omitempty"`
Projects []Project `yaml:"projects,omitempty"`
Workflows map[string]Workflow `yaml:"workflows,omitempty"`
PolicySets PolicySets `yaml:"policies,omitempty"`
Automerge *bool `yaml:"automerge,omitempty"`
ParallelApply *bool `yaml:"parallel_apply,omitempty"`
ParallelPlan *bool `yaml:"parallel_plan,omitempty"`
DeleteSourceBranchOnMerge *bool `yaml:"delete_source_branch_on_merge,omitempty"`
EmojiReaction *string `yaml:"emoji_reaction,omitempty"`
AllowedRegexpPrefixes []string `yaml:"allowed_regexp_prefixes,omitempty"`
Version *int `yaml:"version,omitempty"`
Projects []Project `yaml:"projects,omitempty"`
Workflows map[string]Workflow `yaml:"workflows,omitempty"`
PolicySets PolicySets `yaml:"policies,omitempty"`
Automerge *bool `yaml:"automerge,omitempty"`
ParallelApply *bool `yaml:"parallel_apply,omitempty"`
ParallelPlan *bool `yaml:"parallel_plan,omitempty"`
DeleteSourceBranchOnMerge *bool `yaml:"delete_source_branch_on_merge,omitempty"`
EmojiReaction *string `yaml:"emoji_reaction,omitempty"`
AllowedRegexpPrefixes []string `yaml:"allowed_regexp_prefixes,omitempty"`
AbortOnExcecutionOrderFail *bool `yaml:"abort_on_execution_order_fail,omitempty"`
}
@@ -98,16 +98,16 @@ func (r RepoCfg) ToValid() valid.RepoCfg {
}
return valid.RepoCfg{
Version: *r.Version,
Projects: validProjects,
Workflows: validWorkflows,
Automerge: automerge,
ParallelApply: parallelApply,
ParallelPlan: parallelPlan,
ParallelPolicyCheck: parallelPlan,
DeleteSourceBranchOnMerge: r.DeleteSourceBranchOnMerge,
AllowedRegexpPrefixes: r.AllowedRegexpPrefixes,
EmojiReaction: emojiReaction,
Version: *r.Version,
Projects: validProjects,
Workflows: validWorkflows,
Automerge: automerge,
ParallelApply: parallelApply,
ParallelPlan: parallelPlan,
ParallelPolicyCheck: parallelPlan,
DeleteSourceBranchOnMerge: r.DeleteSourceBranchOnMerge,
AllowedRegexpPrefixes: r.AllowedRegexpPrefixes,
EmojiReaction: emojiReaction,
AbortOnExcecutionOrderFail: abortOnExcecutionOrderFail,
}
}

View File

@@ -14,18 +14,18 @@ import (
// RepoCfg is the atlantis.yaml config after it's been parsed and validated.
type RepoCfg struct {
// Version is the version of the atlantis YAML file.
Version int
Projects []Project
Workflows map[string]Workflow
PolicySets PolicySets
Automerge bool
ParallelApply bool
ParallelPlan bool
ParallelPolicyCheck bool
DeleteSourceBranchOnMerge *bool
RepoLocking *bool
EmojiReaction string
AllowedRegexpPrefixes []string
Version int
Projects []Project
Workflows map[string]Workflow
PolicySets PolicySets
Automerge bool
ParallelApply bool
ParallelPlan bool
ParallelPolicyCheck bool
DeleteSourceBranchOnMerge *bool
RepoLocking *bool
EmojiReaction string
AllowedRegexpPrefixes []string
AbortOnExcecutionOrderFail bool
}

View File

@@ -7,7 +7,7 @@ import (
"github.com/runatlantis/atlantis/server/events/command"
)
//go:generate pegomock generate -m --package mocks -o mocks/mock_apply_lock_checker.go ApplyLockChecker
//go:generate pegomock generate --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 --package mocks -o mocks/mock_apply_locker.go ApplyLocker
//go:generate pegomock generate --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 --package mocks -o mocks/mock_backend.go Backend
//go:generate pegomock generate --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 --package mocks -o mocks/mock_locker.go Locker
//go:generate pegomock generate --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

@@ -20,10 +20,9 @@ import (
"strings"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
"github.com/runatlantis/atlantis/server/core/locking"
"github.com/runatlantis/atlantis/server/core/locking/mocks"
"github.com/runatlantis/atlantis/server/core/locking/mocks/matchers"
"github.com/runatlantis/atlantis/server/events/command"
"github.com/runatlantis/atlantis/server/events/models"
. "github.com/runatlantis/atlantis/testing"
@@ -40,7 +39,7 @@ var pl = models.ProjectLock{Project: project, Pull: pull, User: user, Workspace:
func TestTryLock_Err(t *testing.T) {
RegisterMockTestingT(t)
backend := mocks.NewMockBackend()
When(backend.TryLock(matchers.AnyModelsProjectLock())).ThenReturn(false, models.ProjectLock{}, errExpected)
When(backend.TryLock(Any[models.ProjectLock]())).ThenReturn(false, models.ProjectLock{}, errExpected)
t.Log("when the backend returns an error, TryLock should return that error")
l := locking.NewClient(backend)
_, err := l.TryLock(project, workspace, pull, user)
@@ -51,7 +50,7 @@ func TestTryLock_Success(t *testing.T) {
RegisterMockTestingT(t)
currLock := models.ProjectLock{}
backend := mocks.NewMockBackend()
When(backend.TryLock(matchers.AnyModelsProjectLock())).ThenReturn(true, currLock, nil)
When(backend.TryLock(Any[models.ProjectLock]())).ThenReturn(true, currLock, nil)
l := locking.NewClient(backend)
r, err := l.TryLock(project, workspace, pull, user)
Ok(t, err)
@@ -71,7 +70,7 @@ func TestUnlock_InvalidKey(t *testing.T) {
func TestUnlock_Err(t *testing.T) {
RegisterMockTestingT(t)
backend := mocks.NewMockBackend()
When(backend.Unlock(matchers.AnyModelsProject(), AnyString())).ThenReturn(nil, errExpected)
When(backend.Unlock(Any[models.Project](), Any[string]())).ThenReturn(nil, errExpected)
l := locking.NewClient(backend)
_, err := l.Unlock("owner/repo/path/workspace")
Equals(t, err, err)
@@ -81,7 +80,7 @@ func TestUnlock_Err(t *testing.T) {
func TestUnlock(t *testing.T) {
RegisterMockTestingT(t)
backend := mocks.NewMockBackend()
When(backend.Unlock(matchers.AnyModelsProject(), AnyString())).ThenReturn(&pl, nil)
When(backend.Unlock(Any[models.Project](), Any[string]())).ThenReturn(&pl, nil)
l := locking.NewClient(backend)
lock, err := l.Unlock("owner/repo/path/workspace")
Ok(t, err)
@@ -196,7 +195,7 @@ func TestApplyLocker(t *testing.T) {
t.Run("backend errors", func(t *testing.T) {
backend := mocks.NewMockBackend()
When(backend.LockCommand(matchers.AnyCommandName(), matchers.AnyTimeTime())).ThenReturn(nil, errExpected)
When(backend.LockCommand(Any[command.Name](), Any[time.Time]())).ThenReturn(nil, errExpected)
l := locking.NewApplyClient(backend, false)
lock, err := l.LockApply()
Equals(t, errExpected, err)
@@ -210,13 +209,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.AnyCommandName(), matchers.AnyTimeTime())
backend.VerifyWasCalled(Never()).LockCommand(Any[command.Name](), Any[time.Time]())
})
t.Run("succeeds", func(t *testing.T) {
backend := mocks.NewMockBackend()
When(backend.LockCommand(matchers.AnyCommandName(), matchers.AnyTimeTime())).ThenReturn(applyLock, nil)
When(backend.LockCommand(Any[command.Name](), Any[time.Time]())).ThenReturn(applyLock, nil)
l := locking.NewApplyClient(backend, false)
lock, _ := l.LockApply()
Assert(t, lock.Locked, "exp lock present")
@@ -227,7 +226,7 @@ func TestApplyLocker(t *testing.T) {
t.Run("backend fails", func(t *testing.T) {
backend := mocks.NewMockBackend()
When(backend.UnlockCommand(matchers.AnyCommandName())).ThenReturn(errExpected)
When(backend.UnlockCommand(Any[command.Name]())).ThenReturn(errExpected)
l := locking.NewApplyClient(backend, false)
err := l.UnlockApply()
Equals(t, errExpected, err)
@@ -240,13 +239,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.AnyCommandName())
backend.VerifyWasCalled(Never()).UnlockCommand(Any[command.Name]())
})
t.Run("succeeds", func(t *testing.T) {
backend := mocks.NewMockBackend()
When(backend.UnlockCommand(matchers.AnyCommandName())).ThenReturn(nil)
When(backend.UnlockCommand(Any[command.Name]())).ThenReturn(nil)
l := locking.NewApplyClient(backend, false)
err := l.UnlockApply()
Equals(t, nil, err)
@@ -258,7 +257,7 @@ func TestApplyLocker(t *testing.T) {
t.Run("fails", func(t *testing.T) {
backend := mocks.NewMockBackend()
When(backend.CheckCommandLock(matchers.AnyCommandName())).ThenReturn(nil, errExpected)
When(backend.CheckCommandLock(Any[command.Name]())).ThenReturn(nil, errExpected)
l := locking.NewApplyClient(backend, false)
lock, err := l.CheckApplyLock()
Equals(t, errExpected, err)
@@ -272,13 +271,13 @@ func TestApplyLocker(t *testing.T) {
lock, err := l.CheckApplyLock()
Ok(t, err)
Equals(t, lock.Locked, true)
backend.VerifyWasCalled(Never()).CheckCommandLock(matchers.AnyCommandName())
backend.VerifyWasCalled(Never()).CheckCommandLock(Any[command.Name]())
})
t.Run("UnlockCommand succeeds", func(t *testing.T) {
backend := mocks.NewMockBackend()
When(backend.CheckCommandLock(matchers.AnyCommandName())).ThenReturn(applyLock, nil)
When(backend.CheckCommandLock(Any[command.Name]())).ThenReturn(applyLock, nil)
l := locking.NewApplyClient(backend, false)
lock, err := l.CheckApplyLock()
Equals(t, nil, err)

View File

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

View File

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

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
locking "github.com/runatlantis/atlantis/server/core/locking"
)
func AnyLockingTryLockResponse() locking.TryLockResponse {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(locking.TryLockResponse))(nil)).Elem()))
var nullValue locking.TryLockResponse
return nullValue
}
func EqLockingTryLockResponse(value locking.TryLockResponse) locking.TryLockResponse {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue locking.TryLockResponse
return nullValue
}
func NotEqLockingTryLockResponse(value locking.TryLockResponse) locking.TryLockResponse {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue locking.TryLockResponse
return nullValue
}
func LockingTryLockResponseThat(matcher pegomock.ArgumentMatcher) locking.TryLockResponse {
pegomock.RegisterMatcher(matcher)
var nullValue locking.TryLockResponse
return nullValue
}

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
models "github.com/runatlantis/atlantis/server/events/models"
)
func AnyMapOfStringToModelsProjectLock() map[string]models.ProjectLock {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(map[string]models.ProjectLock))(nil)).Elem()))
var nullValue map[string]models.ProjectLock
return nullValue
}
func EqMapOfStringToModelsProjectLock(value map[string]models.ProjectLock) map[string]models.ProjectLock {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue map[string]models.ProjectLock
return nullValue
}
func NotEqMapOfStringToModelsProjectLock(value map[string]models.ProjectLock) map[string]models.ProjectLock {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue map[string]models.ProjectLock
return nullValue
}
func MapOfStringToModelsProjectLockThat(matcher pegomock.ArgumentMatcher) map[string]models.ProjectLock {
pegomock.RegisterMatcher(matcher)
var nullValue map[string]models.ProjectLock
return nullValue
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
models "github.com/runatlantis/atlantis/server/events/models"
)
func AnySliceOfModelsProjectLock() []models.ProjectLock {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]models.ProjectLock))(nil)).Elem()))
var nullValue []models.ProjectLock
return nullValue
}
func EqSliceOfModelsProjectLock(value []models.ProjectLock) []models.ProjectLock {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue []models.ProjectLock
return nullValue
}
func NotEqSliceOfModelsProjectLock(value []models.ProjectLock) []models.ProjectLock {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue []models.ProjectLock
return nullValue
}
func SliceOfModelsProjectLockThat(matcher pegomock.ArgumentMatcher) []models.ProjectLock {
pegomock.RegisterMatcher(matcher)
var nullValue []models.ProjectLock
return nullValue
}

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
time "time"
)
func AnyTimeTime() time.Time {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(time.Time))(nil)).Elem()))
var nullValue time.Time
return nullValue
}
func EqTimeTime(value time.Time) time.Time {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue time.Time
return nullValue
}
func NotEqTimeTime(value time.Time) time.Time {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue time.Time
return nullValue
}
func TimeTimeThat(matcher pegomock.ArgumentMatcher) time.Time {
pegomock.RegisterMatcher(matcher)
var nullValue time.Time
return nullValue
}

View File

@@ -4,7 +4,7 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
locking "github.com/runatlantis/atlantis/server/core/locking"
"reflect"
"time"

View File

@@ -4,7 +4,7 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
locking "github.com/runatlantis/atlantis/server/core/locking"
"reflect"
"time"

View File

@@ -4,7 +4,7 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
command "github.com/runatlantis/atlantis/server/events/command"
models "github.com/runatlantis/atlantis/server/events/models"
"reflect"
@@ -26,11 +26,11 @@ 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) CheckCommandLock(_param0 command.Name) (*command.Lock, error) {
func (mock *MockBackend) CheckCommandLock(cmdName command.Name) (*command.Lock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{_param0}
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
var ret1 error
@@ -45,11 +45,11 @@ func (mock *MockBackend) CheckCommandLock(_param0 command.Name) (*command.Lock,
return ret0, ret1
}
func (mock *MockBackend) DeletePullStatus(_param0 models.PullRequest) error {
func (mock *MockBackend) DeletePullStatus(pull models.PullRequest) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{_param0}
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 {
@@ -60,11 +60,11 @@ func (mock *MockBackend) DeletePullStatus(_param0 models.PullRequest) error {
return ret0
}
func (mock *MockBackend) GetLock(_param0 models.Project, _param1 string) (*models.ProjectLock, error) {
func (mock *MockBackend) GetLock(project models.Project, workspace string) (*models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{_param0, _param1}
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
@@ -79,11 +79,11 @@ func (mock *MockBackend) GetLock(_param0 models.Project, _param1 string) (*model
return ret0, ret1
}
func (mock *MockBackend) GetPullStatus(_param0 models.PullRequest) (*models.PullStatus, error) {
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{_param0}
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
@@ -117,11 +117,11 @@ func (mock *MockBackend) List() ([]models.ProjectLock, error) {
return ret0, ret1
}
func (mock *MockBackend) LockCommand(_param0 command.Name, _param1 time.Time) (*command.Lock, error) {
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{_param0, _param1}
params := []pegomock.Param{cmdName, lockTime}
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
@@ -136,11 +136,11 @@ func (mock *MockBackend) LockCommand(_param0 command.Name, _param1 time.Time) (*
return ret0, ret1
}
func (mock *MockBackend) TryLock(_param0 models.ProjectLock) (bool, models.ProjectLock, error) {
func (mock *MockBackend) TryLock(lock models.ProjectLock) (bool, models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{_param0}
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
@@ -159,11 +159,11 @@ func (mock *MockBackend) TryLock(_param0 models.ProjectLock) (bool, models.Proje
return ret0, ret1, ret2
}
func (mock *MockBackend) Unlock(_param0 models.Project, _param1 string) (*models.ProjectLock, error) {
func (mock *MockBackend) Unlock(project models.Project, workspace string) (*models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{_param0, _param1}
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()})
var ret0 *models.ProjectLock
var ret1 error
@@ -178,11 +178,11 @@ func (mock *MockBackend) Unlock(_param0 models.Project, _param1 string) (*models
return ret0, ret1
}
func (mock *MockBackend) UnlockByPull(_param0 string, _param1 int) ([]models.ProjectLock, error) {
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{_param0, _param1}
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
@@ -197,11 +197,11 @@ func (mock *MockBackend) UnlockByPull(_param0 string, _param1 int) ([]models.Pro
return ret0, ret1
}
func (mock *MockBackend) UnlockCommand(_param0 command.Name) error {
func (mock *MockBackend) UnlockCommand(cmdName command.Name) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockBackend().")
}
params := []pegomock.Param{_param0}
params := []pegomock.Param{cmdName}
result := pegomock.GetGenericMockFrom(mock).Invoke("UnlockCommand", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
@@ -212,11 +212,11 @@ func (mock *MockBackend) UnlockCommand(_param0 command.Name) error {
return ret0
}
func (mock *MockBackend) UpdateProjectStatus(_param0 models.PullRequest, _param1 string, _param2 string, _param3 models.ProjectPlanStatus) error {
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{_param0, _param1, _param2, _param3}
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 {
@@ -227,11 +227,11 @@ func (mock *MockBackend) UpdateProjectStatus(_param0 models.PullRequest, _param1
return ret0
}
func (mock *MockBackend) UpdatePullWithResults(_param0 models.PullRequest, _param1 []command.ProjectResult) (models.PullStatus, error) {
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{_param0, _param1}
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
@@ -283,8 +283,8 @@ type VerifierMockBackend struct {
timeout time.Duration
}
func (verifier *VerifierMockBackend) CheckCommandLock(_param0 command.Name) *MockBackend_CheckCommandLock_OngoingVerification {
params := []pegomock.Param{_param0}
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}
}
@@ -295,8 +295,8 @@ type MockBackend_CheckCommandLock_OngoingVerification struct {
}
func (c *MockBackend_CheckCommandLock_OngoingVerification) GetCapturedArguments() command.Name {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
cmdName := c.GetAllCapturedArguments()
return cmdName[len(cmdName)-1]
}
func (c *MockBackend_CheckCommandLock_OngoingVerification) GetAllCapturedArguments() (_param0 []command.Name) {
@@ -310,8 +310,8 @@ func (c *MockBackend_CheckCommandLock_OngoingVerification) GetAllCapturedArgumen
return
}
func (verifier *VerifierMockBackend) DeletePullStatus(_param0 models.PullRequest) *MockBackend_DeletePullStatus_OngoingVerification {
params := []pegomock.Param{_param0}
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}
}
@@ -322,8 +322,8 @@ type MockBackend_DeletePullStatus_OngoingVerification struct {
}
func (c *MockBackend_DeletePullStatus_OngoingVerification) GetCapturedArguments() models.PullRequest {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
pull := c.GetAllCapturedArguments()
return pull[len(pull)-1]
}
func (c *MockBackend_DeletePullStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest) {
@@ -337,8 +337,8 @@ func (c *MockBackend_DeletePullStatus_OngoingVerification) GetAllCapturedArgumen
return
}
func (verifier *VerifierMockBackend) GetLock(_param0 models.Project, _param1 string) *MockBackend_GetLock_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
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}
}
@@ -349,8 +349,8 @@ type MockBackend_GetLock_OngoingVerification struct {
}
func (c *MockBackend_GetLock_OngoingVerification) GetCapturedArguments() (models.Project, string) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
project, workspace := c.GetAllCapturedArguments()
return project[len(project)-1], workspace[len(workspace)-1]
}
func (c *MockBackend_GetLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string) {
@@ -368,8 +368,8 @@ func (c *MockBackend_GetLock_OngoingVerification) GetAllCapturedArguments() (_pa
return
}
func (verifier *VerifierMockBackend) GetPullStatus(_param0 models.PullRequest) *MockBackend_GetPullStatus_OngoingVerification {
params := []pegomock.Param{_param0}
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}
}
@@ -380,8 +380,8 @@ type MockBackend_GetPullStatus_OngoingVerification struct {
}
func (c *MockBackend_GetPullStatus_OngoingVerification) GetCapturedArguments() models.PullRequest {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
pull := c.GetAllCapturedArguments()
return pull[len(pull)-1]
}
func (c *MockBackend_GetPullStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest) {
@@ -412,8 +412,8 @@ func (c *MockBackend_List_OngoingVerification) GetCapturedArguments() {
func (c *MockBackend_List_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierMockBackend) LockCommand(_param0 command.Name, _param1 time.Time) *MockBackend_LockCommand_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
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}
}
@@ -424,8 +424,8 @@ type MockBackend_LockCommand_OngoingVerification struct {
}
func (c *MockBackend_LockCommand_OngoingVerification) GetCapturedArguments() (command.Name, time.Time) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
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) {
@@ -443,8 +443,8 @@ func (c *MockBackend_LockCommand_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierMockBackend) TryLock(_param0 models.ProjectLock) *MockBackend_TryLock_OngoingVerification {
params := []pegomock.Param{_param0}
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}
}
@@ -455,8 +455,8 @@ type MockBackend_TryLock_OngoingVerification struct {
}
func (c *MockBackend_TryLock_OngoingVerification) GetCapturedArguments() models.ProjectLock {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
lock := c.GetAllCapturedArguments()
return lock[len(lock)-1]
}
func (c *MockBackend_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectLock) {
@@ -470,8 +470,8 @@ func (c *MockBackend_TryLock_OngoingVerification) GetAllCapturedArguments() (_pa
return
}
func (verifier *VerifierMockBackend) Unlock(_param0 models.Project, _param1 string) *MockBackend_Unlock_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
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}
}
@@ -482,8 +482,8 @@ type MockBackend_Unlock_OngoingVerification struct {
}
func (c *MockBackend_Unlock_OngoingVerification) GetCapturedArguments() (models.Project, string) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
project, workspace := c.GetAllCapturedArguments()
return project[len(project)-1], workspace[len(workspace)-1]
}
func (c *MockBackend_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string) {
@@ -501,8 +501,8 @@ func (c *MockBackend_Unlock_OngoingVerification) GetAllCapturedArguments() (_par
return
}
func (verifier *VerifierMockBackend) UnlockByPull(_param0 string, _param1 int) *MockBackend_UnlockByPull_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
func (verifier *VerifierMockBackend) UnlockByPull(repoFullName string, pullNum int) *MockBackend_UnlockByPull_OngoingVerification {
params := []pegomock.Param{repoFullName, pullNum}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UnlockByPull", params, verifier.timeout)
return &MockBackend_UnlockByPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -513,8 +513,8 @@ type MockBackend_UnlockByPull_OngoingVerification struct {
}
func (c *MockBackend_UnlockByPull_OngoingVerification) GetCapturedArguments() (string, int) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
repoFullName, pullNum := c.GetAllCapturedArguments()
return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1]
}
func (c *MockBackend_UnlockByPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) {
@@ -532,8 +532,8 @@ func (c *MockBackend_UnlockByPull_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierMockBackend) UnlockCommand(_param0 command.Name) *MockBackend_UnlockCommand_OngoingVerification {
params := []pegomock.Param{_param0}
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}
}
@@ -544,8 +544,8 @@ type MockBackend_UnlockCommand_OngoingVerification struct {
}
func (c *MockBackend_UnlockCommand_OngoingVerification) GetCapturedArguments() command.Name {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
cmdName := c.GetAllCapturedArguments()
return cmdName[len(cmdName)-1]
}
func (c *MockBackend_UnlockCommand_OngoingVerification) GetAllCapturedArguments() (_param0 []command.Name) {
@@ -559,8 +559,8 @@ func (c *MockBackend_UnlockCommand_OngoingVerification) GetAllCapturedArguments(
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}
func (verifier *VerifierMockBackend) UpdateProjectStatus(pull models.PullRequest, workspace string, repoRelDir string, newStatus models.ProjectPlanStatus) *MockBackend_UpdateProjectStatus_OngoingVerification {
params := []pegomock.Param{pull, workspace, repoRelDir, newStatus}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdateProjectStatus", params, verifier.timeout)
return &MockBackend_UpdateProjectStatus_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -571,8 +571,8 @@ type MockBackend_UpdateProjectStatus_OngoingVerification struct {
}
func (c *MockBackend_UpdateProjectStatus_OngoingVerification) GetCapturedArguments() (models.PullRequest, string, string, models.ProjectPlanStatus) {
_param0, _param1, _param2, _param3 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1]
pull, workspace, repoRelDir, newStatus := c.GetAllCapturedArguments()
return pull[len(pull)-1], workspace[len(workspace)-1], repoRelDir[len(repoRelDir)-1], newStatus[len(newStatus)-1]
}
func (c *MockBackend_UpdateProjectStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest, _param1 []string, _param2 []string, _param3 []models.ProjectPlanStatus) {
@@ -598,8 +598,8 @@ func (c *MockBackend_UpdateProjectStatus_OngoingVerification) GetAllCapturedArgu
return
}
func (verifier *VerifierMockBackend) UpdatePullWithResults(_param0 models.PullRequest, _param1 []command.ProjectResult) *MockBackend_UpdatePullWithResults_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
func (verifier *VerifierMockBackend) UpdatePullWithResults(pull models.PullRequest, newResults []command.ProjectResult) *MockBackend_UpdatePullWithResults_OngoingVerification {
params := []pegomock.Param{pull, newResults}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdatePullWithResults", params, verifier.timeout)
return &MockBackend_UpdatePullWithResults_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -610,8 +610,8 @@ type MockBackend_UpdatePullWithResults_OngoingVerification struct {
}
func (c *MockBackend_UpdatePullWithResults_OngoingVerification) GetCapturedArguments() (models.PullRequest, []command.ProjectResult) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
pull, newResults := c.GetAllCapturedArguments()
return pull[len(pull)-1], newResults[len(newResults)-1]
}
func (c *MockBackend_UpdatePullWithResults_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest, _param1 [][]command.ProjectResult) {

View File

@@ -4,7 +4,7 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
locking "github.com/runatlantis/atlantis/server/core/locking"
models "github.com/runatlantis/atlantis/server/events/models"
"reflect"
@@ -26,11 +26,11 @@ 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) GetLock(_param0 string) (*models.ProjectLock, error) {
func (mock *MockLocker) GetLock(key string) (*models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockLocker().")
}
params := []pegomock.Param{_param0}
params := []pegomock.Param{key}
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
@@ -64,11 +64,11 @@ func (mock *MockLocker) List() (map[string]models.ProjectLock, error) {
return ret0, ret1
}
func (mock *MockLocker) TryLock(_param0 models.Project, _param1 string, _param2 models.PullRequest, _param3 models.User) (locking.TryLockResponse, error) {
func (mock *MockLocker) TryLock(p models.Project, workspace string, pull models.PullRequest, user models.User) (locking.TryLockResponse, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockLocker().")
}
params := []pegomock.Param{_param0, _param1, _param2, _param3}
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
@@ -83,11 +83,11 @@ func (mock *MockLocker) TryLock(_param0 models.Project, _param1 string, _param2
return ret0, ret1
}
func (mock *MockLocker) Unlock(_param0 string) (*models.ProjectLock, error) {
func (mock *MockLocker) Unlock(key string) (*models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockLocker().")
}
params := []pegomock.Param{_param0}
params := []pegomock.Param{key}
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
@@ -102,11 +102,11 @@ func (mock *MockLocker) Unlock(_param0 string) (*models.ProjectLock, error) {
return ret0, ret1
}
func (mock *MockLocker) UnlockByPull(_param0 string, _param1 int) ([]models.ProjectLock, error) {
func (mock *MockLocker) UnlockByPull(repoFullName string, pullNum int) ([]models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockLocker().")
}
params := []pegomock.Param{_param0, _param1}
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
@@ -158,8 +158,8 @@ type VerifierMockLocker struct {
timeout time.Duration
}
func (verifier *VerifierMockLocker) GetLock(_param0 string) *MockLocker_GetLock_OngoingVerification {
params := []pegomock.Param{_param0}
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}
}
@@ -170,8 +170,8 @@ type MockLocker_GetLock_OngoingVerification struct {
}
func (c *MockLocker_GetLock_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
key := c.GetAllCapturedArguments()
return key[len(key)-1]
}
func (c *MockLocker_GetLock_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
@@ -202,8 +202,8 @@ func (c *MockLocker_List_OngoingVerification) GetCapturedArguments() {
func (c *MockLocker_List_OngoingVerification) GetAllCapturedArguments() {
}
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}
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}
}
@@ -214,8 +214,8 @@ type MockLocker_TryLock_OngoingVerification struct {
}
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]
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_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string, _param2 []models.PullRequest, _param3 []models.User) {
@@ -241,8 +241,8 @@ func (c *MockLocker_TryLock_OngoingVerification) GetAllCapturedArguments() (_par
return
}
func (verifier *VerifierMockLocker) Unlock(_param0 string) *MockLocker_Unlock_OngoingVerification {
params := []pegomock.Param{_param0}
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}
}
@@ -253,8 +253,8 @@ type MockLocker_Unlock_OngoingVerification struct {
}
func (c *MockLocker_Unlock_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
key := c.GetAllCapturedArguments()
return key[len(key)-1]
}
func (c *MockLocker_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
@@ -268,8 +268,8 @@ func (c *MockLocker_Unlock_OngoingVerification) GetAllCapturedArguments() (_para
return
}
func (verifier *VerifierMockLocker) UnlockByPull(_param0 string, _param1 int) *MockLocker_UnlockByPull_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
func (verifier *VerifierMockLocker) UnlockByPull(repoFullName string, pullNum int) *MockLocker_UnlockByPull_OngoingVerification {
params := []pegomock.Param{repoFullName, pullNum}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UnlockByPull", params, verifier.timeout)
return &MockLocker_UnlockByPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -280,8 +280,8 @@ type MockLocker_UnlockByPull_OngoingVerification struct {
}
func (c *MockLocker_UnlockByPull_OngoingVerification) GetCapturedArguments() (string, int) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
repoFullName, pullNum := c.GetAllCapturedArguments()
return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1]
}
func (c *MockLocker_UnlockByPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) {

View File

@@ -9,15 +9,13 @@ import (
"testing"
version "github.com/hashicorp/go-version"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
"github.com/pkg/errors"
"github.com/runatlantis/atlantis/server/core/runtime"
runtimemocks "github.com/runatlantis/atlantis/server/core/runtime/mocks"
runtimemodels "github.com/runatlantis/atlantis/server/core/runtime/models"
"github.com/runatlantis/atlantis/server/core/terraform/mocks"
matchers2 "github.com/runatlantis/atlantis/server/core/terraform/mocks/matchers"
"github.com/runatlantis/atlantis/server/events/command"
"github.com/runatlantis/atlantis/server/events/mocks/matchers"
"github.com/runatlantis/atlantis/server/events/models"
"github.com/runatlantis/atlantis/server/logging"
@@ -66,7 +64,7 @@ func TestRun_Success(t *testing.T) {
TerraformExecutor: terraform,
}
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())).
ThenReturn("output", nil)
output, err := o.Run(ctx, []string{"extra", "args"}, tmpDir, map[string]string(nil))
Ok(t, err)
@@ -98,7 +96,7 @@ func TestRun_AppliesCorrectProjectPlan(t *testing.T) {
TerraformExecutor: terraform,
}
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())).
ThenReturn("output", nil)
output, err := o.Run(ctx, []string{"extra", "args"}, tmpDir, map[string]string(nil))
Ok(t, err)
@@ -130,7 +128,7 @@ func TestRun_UsesConfiguredTFVersion(t *testing.T) {
TerraformExecutor: terraform,
}
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())).
ThenReturn("output", nil)
output, err := o.Run(ctx, []string{"extra", "args"}, tmpDir, map[string]string(nil))
Ok(t, err)

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
go_version "github.com/hashicorp/go-version"
)
func AnyPtrToGoVersionVersion() *go_version.Version {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*go_version.Version))(nil)).Elem()))
var nullValue *go_version.Version
return nullValue
}
func EqPtrToGoVersionVersion(value *go_version.Version) *go_version.Version {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue *go_version.Version
return nullValue
}
func NotEqPtrToGoVersionVersion(value *go_version.Version) *go_version.Version {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue *go_version.Version
return nullValue
}
func PtrToGoVersionVersionThat(matcher pegomock.ArgumentMatcher) *go_version.Version {
pegomock.RegisterMatcher(matcher)
var nullValue *go_version.Version
return nullValue
}

View File

@@ -5,7 +5,7 @@ package mocks
import (
go_version "github.com/hashicorp/go-version"
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
"reflect"
"time"
)
@@ -25,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(_param0 *go_version.Version) (string, error) {
func (mock *MockKeySerializer) Serialize(key *go_version.Version) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockKeySerializer().")
}
params := []pegomock.Param{_param0}
params := []pegomock.Param{key}
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
@@ -81,8 +81,8 @@ type VerifierMockKeySerializer struct {
timeout time.Duration
}
func (verifier *VerifierMockKeySerializer) Serialize(_param0 *go_version.Version) *MockKeySerializer_Serialize_OngoingVerification {
params := []pegomock.Param{_param0}
func (verifier *VerifierMockKeySerializer) Serialize(key *go_version.Version) *MockKeySerializer_Serialize_OngoingVerification {
params := []pegomock.Param{key}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Serialize", params, verifier.timeout)
return &MockKeySerializer_Serialize_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -93,8 +93,8 @@ type MockKeySerializer_Serialize_OngoingVerification struct {
}
func (c *MockKeySerializer_Serialize_OngoingVerification) GetCapturedArguments() *go_version.Version {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
key := c.GetAllCapturedArguments()
return key[len(key)-1]
}
func (c *MockKeySerializer_Serialize_OngoingVerification) GetAllCapturedArguments() (_param0 []*go_version.Version) {

View File

@@ -5,7 +5,7 @@ package mocks
import (
go_version "github.com/hashicorp/go-version"
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
"reflect"
"time"
)
@@ -25,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(_param0 *go_version.Version) (string, error) {
func (mock *MockExecutionVersionCache) Get(key *go_version.Version) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockExecutionVersionCache().")
}
params := []pegomock.Param{_param0}
params := []pegomock.Param{key}
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
@@ -81,8 +81,8 @@ type VerifierMockExecutionVersionCache struct {
timeout time.Duration
}
func (verifier *VerifierMockExecutionVersionCache) Get(_param0 *go_version.Version) *MockExecutionVersionCache_Get_OngoingVerification {
params := []pegomock.Param{_param0}
func (verifier *VerifierMockExecutionVersionCache) Get(key *go_version.Version) *MockExecutionVersionCache_Get_OngoingVerification {
params := []pegomock.Param{key}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Get", params, verifier.timeout)
return &MockExecutionVersionCache_Get_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -93,8 +93,8 @@ type MockExecutionVersionCache_Get_OngoingVerification struct {
}
func (c *MockExecutionVersionCache_Get_OngoingVerification) GetCapturedArguments() *go_version.Version {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
key := c.GetAllCapturedArguments()
return key[len(key)-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 --package mocks -o mocks/mock_version_path.go ExecutionVersionCache
//go:generate pegomock generate -m --package mocks -o mocks/mock_key_serializer.go KeySerializer
//go:generate pegomock generate --package mocks -o mocks/mock_version_path.go ExecutionVersionCache
//go:generate pegomock generate --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 (
"testing"
"github.com/hashicorp/go-version"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
cache_mocks "github.com/runatlantis/atlantis/server/core/runtime/cache/mocks"
"github.com/runatlantis/atlantis/server/core/runtime/models"
models_mocks "github.com/runatlantis/atlantis/server/core/runtime/models/mocks"
@@ -50,10 +50,10 @@ func TestExecutionVersionDiskLayer(t *testing.T) {
Assert(t, err != nil, "err is expected")
mockFilePath.VerifyWasCalled(Never()).Join(AnyString())
mockFilePath.VerifyWasCalled(Never()).Join(Any[string]())
mockFilePath.VerifyWasCalled(Never()).NotExists()
mockFilePath.VerifyWasCalled(Never()).Resolve()
mockExec.VerifyWasCalled(Never()).LookPath(AnyString())
mockExec.VerifyWasCalled(Never()).LookPath(Any[string]())
})
t.Run("finds in path", func(t *testing.T) {
@@ -77,7 +77,7 @@ func TestExecutionVersionDiskLayer(t *testing.T) {
Assert(t, resultPath == expectedPath, "path is expected")
mockFilePath.VerifyWasCalled(Never()).Join(AnyString())
mockFilePath.VerifyWasCalled(Never()).Join(Any[string]())
mockFilePath.VerifyWasCalled(Never()).Resolve()
mockFilePath.VerifyWasCalled(Never()).NotExists()
})

View File

@@ -11,7 +11,7 @@ import (
jobmocks "github.com/runatlantis/atlantis/server/jobs/mocks"
"github.com/runatlantis/atlantis/server/logging"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
. "github.com/runatlantis/atlantis/testing"
)

View File

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

View File

@@ -7,10 +7,8 @@ import (
"testing"
"github.com/hashicorp/go-version"
. "github.com/petergtz/pegomock/v3"
runtimematchers "github.com/runatlantis/atlantis/server/core/runtime/mocks/matchers"
. "github.com/petergtz/pegomock/v4"
"github.com/runatlantis/atlantis/server/core/terraform/mocks"
tfmatchers "github.com/runatlantis/atlantis/server/core/terraform/mocks/matchers"
"github.com/runatlantis/atlantis/server/events/command"
"github.com/runatlantis/atlantis/server/logging"
. "github.com/runatlantis/atlantis/testing"
@@ -35,7 +33,7 @@ func TestImportStepRunner_Run_Success(t *testing.T) {
tfVersion, _ := version.NewVersion("0.15.0")
s := NewImportStepRunner(terraform, tfVersion)
When(terraform.RunCommandWithVersion(runtimematchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), tfmatchers.AnyMapOfStringToString(), tfmatchers.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())).
ThenReturn("output", nil)
output, err := s.Run(context, []string{}, tmpDir, map[string]string(nil))
Ok(t, err)
@@ -65,7 +63,7 @@ func TestImportStepRunner_Run_Workspace(t *testing.T) {
tfVersion, _ := version.NewVersion("0.15.0")
s := NewImportStepRunner(terraform, tfVersion)
When(terraform.RunCommandWithVersion(runtimematchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), runtimematchers.AnyMapOfStringToString(), runtimematchers.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())).
ThenReturn("output", nil)
output, err := s.Run(context, []string{}, tmpDir, map[string]string(nil))
Ok(t, err)

View File

@@ -8,14 +8,12 @@ import (
"testing"
version "github.com/hashicorp/go-version"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
"github.com/pkg/errors"
"github.com/runatlantis/atlantis/server/core/runtime"
"github.com/runatlantis/atlantis/server/core/terraform/mocks"
matchers2 "github.com/runatlantis/atlantis/server/core/terraform/mocks/matchers"
"github.com/runatlantis/atlantis/server/events/command"
"github.com/runatlantis/atlantis/server/events/mocks/matchers"
"github.com/runatlantis/atlantis/server/logging"
. "github.com/runatlantis/atlantis/testing"
)
@@ -60,7 +58,7 @@ func TestRun_UsesGetOrInitForRightVersion(t *testing.T) {
TerraformExecutor: terraform,
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())).
ThenReturn("output", nil)
output, err := iso.Run(ctx, []string{"extra", "args"}, "/path", map[string]string(nil))
@@ -83,7 +81,7 @@ func TestRun_ShowInitOutputOnError(t *testing.T) {
RegisterMockTestingT(t)
tfClient := mocks.NewMockClient()
logger := logging.NewNoopLogger(t)
When(tfClient.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(tfClient.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())).
ThenReturn("output", errors.New("error"))
tfVersion, _ := version.NewVersion("0.11.0")
@@ -127,7 +125,7 @@ func TestRun_InitOmitsUpgradeFlagIfLockFileTracked(t *testing.T) {
TerraformExecutor: terraform,
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())).
ThenReturn("output", nil)
output, err := iso.Run(ctx, []string{"extra", "args"}, repoDir, map[string]string(nil))
@@ -156,7 +154,7 @@ func TestRun_InitKeepsUpgradeFlagIfLockFileNotPresent(t *testing.T) {
TerraformExecutor: terraform,
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())).
ThenReturn("output", nil)
output, err := iso.Run(ctx, []string{"extra", "args"}, tmpDir, map[string]string(nil))
@@ -189,7 +187,7 @@ func TestRun_InitKeepUpgradeFlagIfLockFilePresentAndTFLessThanPoint14(t *testing
TerraformExecutor: terraform,
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())).
ThenReturn("output", nil)
output, err := iso.Run(ctx, []string{"extra", "args"}, tmpDir, map[string]string(nil))
@@ -256,7 +254,7 @@ func TestRun_InitExtraArgsDeDupe(t *testing.T) {
TerraformExecutor: terraform,
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())).
ThenReturn("output", nil)
output, err := iso.Run(ctx, c.extraArgs, "/path", map[string]string(nil))
@@ -288,7 +286,7 @@ func TestRun_InitDeletesLockFileIfPresentAndNotTracked(t *testing.T) {
TerraformExecutor: terraform,
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())).
ThenReturn("output", nil)
ctx := command.ProjectContext{

View File

@@ -4,7 +4,7 @@ import (
"testing"
"github.com/hashicorp/go-version"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
"github.com/runatlantis/atlantis/server/core/runtime/mocks"
"github.com/runatlantis/atlantis/server/events/command"
. "github.com/runatlantis/atlantis/testing"

View File

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

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
command "github.com/runatlantis/atlantis/server/events/command"
)
func AnyCommandProjectContext() command.ProjectContext {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(command.ProjectContext))(nil)).Elem()))
var nullValue command.ProjectContext
return nullValue
}
func EqCommandProjectContext(value command.ProjectContext) command.ProjectContext {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue command.ProjectContext
return nullValue
}
func NotEqCommandProjectContext(value command.ProjectContext) command.ProjectContext {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue command.ProjectContext
return nullValue
}
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 (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
logging "github.com/runatlantis/atlantis/server/logging"
)
func AnyLoggingSimpleLogging() logging.SimpleLogging {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(logging.SimpleLogging))(nil)).Elem()))
var nullValue logging.SimpleLogging
return nullValue
}
func EqLoggingSimpleLogging(value logging.SimpleLogging) logging.SimpleLogging {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue logging.SimpleLogging
return nullValue
}
func NotEqLoggingSimpleLogging(value logging.SimpleLogging) logging.SimpleLogging {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue logging.SimpleLogging
return nullValue
}
func LoggingSimpleLoggingThat(matcher pegomock.ArgumentMatcher) logging.SimpleLogging {
pegomock.RegisterMatcher(matcher)
var nullValue logging.SimpleLogging
return nullValue
}

View File

@@ -1,31 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
)
func AnyMapOfStringToString() map[string]string {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(map[string]string))(nil)).Elem()))
var nullValue map[string]string
return nullValue
}
func EqMapOfStringToString(value map[string]string) map[string]string {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue map[string]string
return nullValue
}
func NotEqMapOfStringToString(value map[string]string) map[string]string {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue map[string]string
return nullValue
}
func MapOfStringToStringThat(matcher pegomock.ArgumentMatcher) map[string]string {
pegomock.RegisterMatcher(matcher)
var nullValue map[string]string
return nullValue
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"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

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

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
go_version "github.com/hashicorp/go-version"
)
func AnyPtrToGoVersionVersion() *go_version.Version {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*go_version.Version))(nil)).Elem()))
var nullValue *go_version.Version
return nullValue
}
func EqPtrToGoVersionVersion(value *go_version.Version) *go_version.Version {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue *go_version.Version
return nullValue
}
func NotEqPtrToGoVersionVersion(value *go_version.Version) *go_version.Version {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue *go_version.Version
return nullValue
}
func PtrToGoVersionVersionThat(matcher pegomock.ArgumentMatcher) *go_version.Version {
pegomock.RegisterMatcher(matcher)
var nullValue *go_version.Version
return nullValue
}

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
models "github.com/runatlantis/atlantis/server/core/runtime/models"
)
func AnyRecvChanOfModelsLine() <-chan models.Line {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(<-chan models.Line))(nil)).Elem()))
var nullValue <-chan models.Line
return nullValue
}
func EqRecvChanOfModelsLine(value <-chan models.Line) <-chan models.Line {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue <-chan models.Line
return nullValue
}
func NotEqRecvChanOfModelsLine(value <-chan models.Line) <-chan models.Line {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue <-chan models.Line
return nullValue
}
func RecvChanOfModelsLineThat(matcher pegomock.ArgumentMatcher) <-chan models.Line {
pegomock.RegisterMatcher(matcher)
var nullValue <-chan models.Line
return nullValue
}

View File

@@ -1,31 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
)
func AnySendChanOfString() chan<- string {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(chan<- string))(nil)).Elem()))
var nullValue chan<- string
return nullValue
}
func EqSendChanOfString(value chan<- string) chan<- string {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue chan<- string
return nullValue
}
func NotEqSendChanOfString(value chan<- string) chan<- string {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue chan<- string
return nullValue
}
func SendChanOfStringThat(matcher pegomock.ArgumentMatcher) chan<- string {
pegomock.RegisterMatcher(matcher)
var nullValue chan<- string
return nullValue
}

View File

@@ -1,31 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
)
func AnySliceOfString() []string {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]string))(nil)).Elem()))
var nullValue []string
return nullValue
}
func EqSliceOfString(value []string) []string {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue []string
return nullValue
}
func NotEqSliceOfString(value []string) []string {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue []string
return nullValue
}
func SliceOfStringThat(matcher pegomock.ArgumentMatcher) []string {
pegomock.RegisterMatcher(matcher)
var nullValue []string
return nullValue
}

View File

@@ -5,7 +5,7 @@ package mocks
import (
go_version "github.com/hashicorp/go-version"
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
models "github.com/runatlantis/atlantis/server/core/runtime/models"
command "github.com/runatlantis/atlantis/server/events/command"
"reflect"
@@ -27,11 +27,11 @@ func NewMockAsyncTFExec(options ...pegomock.Option) *MockAsyncTFExec {
func (mock *MockAsyncTFExec) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockAsyncTFExec) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockAsyncTFExec) RunCommandAsync(_param0 command.ProjectContext, _param1 string, _param2 []string, _param3 map[string]string, _param4 *go_version.Version, _param5 string) (chan<- string, <-chan models.Line) {
func (mock *MockAsyncTFExec) RunCommandAsync(ctx command.ProjectContext, path string, args []string, envs map[string]string, v *go_version.Version, workspace string) (chan<- string, <-chan models.Line) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockAsyncTFExec().")
}
params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4, _param5}
params := []pegomock.Param{ctx, path, args, envs, v, workspace}
result := pegomock.GetGenericMockFrom(mock).Invoke("RunCommandAsync", params, []reflect.Type{reflect.TypeOf((*chan<- string)(nil)).Elem(), reflect.TypeOf((*<-chan models.Line)(nil)).Elem()})
var ret0 chan<- string
var ret1 <-chan models.Line
@@ -91,8 +91,8 @@ type VerifierMockAsyncTFExec struct {
timeout time.Duration
}
func (verifier *VerifierMockAsyncTFExec) RunCommandAsync(_param0 command.ProjectContext, _param1 string, _param2 []string, _param3 map[string]string, _param4 *go_version.Version, _param5 string) *MockAsyncTFExec_RunCommandAsync_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4, _param5}
func (verifier *VerifierMockAsyncTFExec) RunCommandAsync(ctx command.ProjectContext, path string, args []string, envs map[string]string, v *go_version.Version, workspace string) *MockAsyncTFExec_RunCommandAsync_OngoingVerification {
params := []pegomock.Param{ctx, path, args, envs, v, workspace}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "RunCommandAsync", params, verifier.timeout)
return &MockAsyncTFExec_RunCommandAsync_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -103,8 +103,8 @@ type MockAsyncTFExec_RunCommandAsync_OngoingVerification struct {
}
func (c *MockAsyncTFExec_RunCommandAsync_OngoingVerification) GetCapturedArguments() (command.ProjectContext, string, []string, map[string]string, *go_version.Version, string) {
_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]
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]
}
func (c *MockAsyncTFExec_RunCommandAsync_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 []string, _param2 [][]string, _param3 []map[string]string, _param4 []*go_version.Version, _param5 []string) {

View File

@@ -4,7 +4,7 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
models "github.com/runatlantis/atlantis/server/events/models"
"reflect"
"time"
@@ -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(_param0 models.WorkflowHookCommandContext, _param1 string, _param2 string) (string, string, error) {
func (mock *MockPostWorkflowHookRunner) Run(ctx models.WorkflowHookCommandContext, command string, path string) (string, string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockPostWorkflowHookRunner().")
}
params := []pegomock.Param{_param0, _param1, _param2}
params := []pegomock.Param{ctx, command, path}
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(_param0 models.WorkflowHookCommandContext, _param1 string, _param2 string) *MockPostWorkflowHookRunner_Run_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
func (verifier *VerifierMockPostWorkflowHookRunner) Run(ctx models.WorkflowHookCommandContext, command string, path string) *MockPostWorkflowHookRunner_Run_OngoingVerification {
params := []pegomock.Param{ctx, command, path}
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) {
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
ctx, command, path := c.GetAllCapturedArguments()
return ctx[len(ctx)-1], command[len(command)-1], path[len(path)-1]
}
func (c *MockPostWorkflowHookRunner_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []models.WorkflowHookCommandContext, _param1 []string, _param2 []string) {

View File

@@ -4,7 +4,7 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
models "github.com/runatlantis/atlantis/server/events/models"
"reflect"
"time"
@@ -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(_param0 models.WorkflowHookCommandContext, _param1 string, _param2 string) (string, string, error) {
func (mock *MockPreWorkflowHookRunner) Run(ctx models.WorkflowHookCommandContext, command string, path string) (string, string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockPreWorkflowHookRunner().")
}
params := []pegomock.Param{_param0, _param1, _param2}
params := []pegomock.Param{ctx, command, path}
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(_param0 models.WorkflowHookCommandContext, _param1 string, _param2 string) *MockPreWorkflowHookRunner_Run_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
func (verifier *VerifierMockPreWorkflowHookRunner) Run(ctx models.WorkflowHookCommandContext, command string, path string) *MockPreWorkflowHookRunner_Run_OngoingVerification {
params := []pegomock.Param{ctx, command, path}
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) {
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
ctx, command, path := c.GetAllCapturedArguments()
return ctx[len(ctx)-1], command[len(command)-1], path[len(path)-1]
}
func (c *MockPreWorkflowHookRunner_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []models.WorkflowHookCommandContext, _param1 []string, _param2 []string) {

View File

@@ -4,7 +4,7 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
models "github.com/runatlantis/atlantis/server/events/models"
"reflect"
"time"
@@ -25,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(_param0 models.Repo, _param1 models.PullRequest) (models.ApprovalStatus, error) {
func (mock *MockPullApprovedChecker) PullIsApproved(baseRepo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockPullApprovedChecker().")
}
params := []pegomock.Param{_param0, _param1}
params := []pegomock.Param{baseRepo, pull}
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
@@ -81,8 +81,8 @@ type VerifierMockPullApprovedChecker struct {
timeout time.Duration
}
func (verifier *VerifierMockPullApprovedChecker) PullIsApproved(_param0 models.Repo, _param1 models.PullRequest) *MockPullApprovedChecker_PullIsApproved_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
func (verifier *VerifierMockPullApprovedChecker) PullIsApproved(baseRepo models.Repo, pull models.PullRequest) *MockPullApprovedChecker_PullIsApproved_OngoingVerification {
params := []pegomock.Param{baseRepo, pull}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "PullIsApproved", params, verifier.timeout)
return &MockPullApprovedChecker_PullIsApproved_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -93,8 +93,8 @@ type MockPullApprovedChecker_PullIsApproved_OngoingVerification struct {
}
func (c *MockPullApprovedChecker_PullIsApproved_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
baseRepo, pull := c.GetAllCapturedArguments()
return baseRepo[len(baseRepo)-1], pull[len(pull)-1]
}
func (c *MockPullApprovedChecker_PullIsApproved_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {

View File

@@ -4,7 +4,7 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
command "github.com/runatlantis/atlantis/server/events/command"
"reflect"
"time"
@@ -25,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(_param0 command.ProjectContext, _param1 []string, _param2 string, _param3 map[string]string) (string, error) {
func (mock *MockRunner) Run(ctx command.ProjectContext, extraArgs []string, path string, envs map[string]string) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockRunner().")
}
params := []pegomock.Param{_param0, _param1, _param2, _param3}
params := []pegomock.Param{ctx, extraArgs, path, envs}
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
@@ -81,8 +81,8 @@ type VerifierMockRunner struct {
timeout time.Duration
}
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}
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}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Run", params, verifier.timeout)
return &MockRunner_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -93,8 +93,8 @@ type MockRunner_Run_OngoingVerification struct {
}
func (c *MockRunner_Run_OngoingVerification) GetCapturedArguments() (command.ProjectContext, []string, string, map[string]string) {
_param0, _param1, _param2, _param3 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1]
ctx, extraArgs, path, envs := c.GetAllCapturedArguments()
return ctx[len(ctx)-1], extraArgs[len(extraArgs)-1], path[len(path)-1], envs[len(envs)-1]
}
func (c *MockRunner_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 [][]string, _param2 []string, _param3 []map[string]string) {

View File

@@ -4,7 +4,7 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
command "github.com/runatlantis/atlantis/server/events/command"
models "github.com/runatlantis/atlantis/server/events/models"
"reflect"
@@ -26,16 +26,16 @@ func NewMockStatusUpdater(options ...pegomock.Option) *MockStatusUpdater {
func (mock *MockStatusUpdater) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockStatusUpdater) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockStatusUpdater) UpdateProject(_param0 command.ProjectContext, _param1 command.Name, _param2 models.CommitStatus, _param3 string, _param4 *command.ProjectResult) error {
func (mock *MockStatusUpdater) UpdateProject(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, url string, result *command.ProjectResult) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockStatusUpdater().")
}
params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4}
result := pegomock.GetGenericMockFrom(mock).Invoke("UpdateProject", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
params := []pegomock.Param{ctx, cmdName, status, url, result}
pegomockResult := pegomock.GetGenericMockFrom(mock).Invoke("UpdateProject", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(error)
if len(pegomockResult) != 0 {
if pegomockResult[0] != nil {
ret0 = pegomockResult[0].(error)
}
}
return ret0
@@ -78,8 +78,8 @@ type VerifierMockStatusUpdater struct {
timeout time.Duration
}
func (verifier *VerifierMockStatusUpdater) UpdateProject(_param0 command.ProjectContext, _param1 command.Name, _param2 models.CommitStatus, _param3 string, _param4 *command.ProjectResult) *MockStatusUpdater_UpdateProject_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4}
func (verifier *VerifierMockStatusUpdater) UpdateProject(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, url string, result *command.ProjectResult) *MockStatusUpdater_UpdateProject_OngoingVerification {
params := []pegomock.Param{ctx, cmdName, status, url, result}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdateProject", params, verifier.timeout)
return &MockStatusUpdater_UpdateProject_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -90,8 +90,8 @@ type MockStatusUpdater_UpdateProject_OngoingVerification struct {
}
func (c *MockStatusUpdater_UpdateProject_OngoingVerification) GetCapturedArguments() (command.ProjectContext, command.Name, models.CommitStatus, string, *command.ProjectResult) {
_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]
ctx, cmdName, status, url, result := c.GetAllCapturedArguments()
return ctx[len(ctx)-1], cmdName[len(cmdName)-1], status[len(status)-1], url[len(url)-1], result[len(result)-1]
}
func (c *MockStatusUpdater_UpdateProject_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 []command.Name, _param2 []models.CommitStatus, _param3 []string, _param4 []*command.ProjectResult) {

View File

@@ -5,7 +5,7 @@ package mocks
import (
go_version "github.com/hashicorp/go-version"
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
command "github.com/runatlantis/atlantis/server/events/command"
logging "github.com/runatlantis/atlantis/server/logging"
"reflect"
@@ -27,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(_param0 logging.SimpleLogging, _param1 *go_version.Version) (string, error) {
func (mock *MockVersionedExecutorWorkflow) EnsureExecutorVersion(log logging.SimpleLogging, v *go_version.Version) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockVersionedExecutorWorkflow().")
}
params := []pegomock.Param{_param0, _param1}
params := []pegomock.Param{log, v}
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
@@ -46,11 +46,11 @@ func (mock *MockVersionedExecutorWorkflow) EnsureExecutorVersion(_param0 logging
return ret0, ret1
}
func (mock *MockVersionedExecutorWorkflow) Run(_param0 command.ProjectContext, _param1 string, _param2 map[string]string, _param3 string, _param4 []string) (string, error) {
func (mock *MockVersionedExecutorWorkflow) Run(ctx command.ProjectContext, executablePath string, envs map[string]string, workdir string, extraArgs []string) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockVersionedExecutorWorkflow().")
}
params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4}
params := []pegomock.Param{ctx, executablePath, envs, workdir, extraArgs}
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
@@ -102,8 +102,8 @@ type VerifierMockVersionedExecutorWorkflow struct {
timeout time.Duration
}
func (verifier *VerifierMockVersionedExecutorWorkflow) EnsureExecutorVersion(_param0 logging.SimpleLogging, _param1 *go_version.Version) *MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
func (verifier *VerifierMockVersionedExecutorWorkflow) EnsureExecutorVersion(log logging.SimpleLogging, v *go_version.Version) *MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification {
params := []pegomock.Param{log, v}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "EnsureExecutorVersion", params, verifier.timeout)
return &MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -114,8 +114,8 @@ type MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification str
}
func (c *MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, *go_version.Version) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
log, v := c.GetAllCapturedArguments()
return log[len(log)-1], v[len(v)-1]
}
func (c *MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []*go_version.Version) {
@@ -133,8 +133,8 @@ func (c *MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification
return
}
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}
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}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Run", params, verifier.timeout)
return &MockVersionedExecutorWorkflow_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -145,8 +145,8 @@ type MockVersionedExecutorWorkflow_Run_OngoingVerification struct {
}
func (c *MockVersionedExecutorWorkflow_Run_OngoingVerification) GetCapturedArguments() (command.ProjectContext, string, map[string]string, string, []string) {
_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]
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]
}
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 --package mocks -o mocks/mock_exec.go Exec
//go:generate pegomock generate --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 --package mocks -o mocks/mock_filepath.go FilePath
//go:generate pegomock generate --package mocks -o mocks/mock_filepath.go FilePath
type FilePath interface {
NotExists() bool

View File

@@ -1,31 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
)
func AnyMapOfStringToString() map[string]string {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(map[string]string))(nil)).Elem()))
var nullValue map[string]string
return nullValue
}
func EqMapOfStringToString(value map[string]string) map[string]string {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue map[string]string
return nullValue
}
func NotEqMapOfStringToString(value map[string]string) map[string]string {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue map[string]string
return nullValue
}
func MapOfStringToStringThat(matcher pegomock.ArgumentMatcher) map[string]string {
pegomock.RegisterMatcher(matcher)
var nullValue map[string]string
return nullValue
}

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
models "github.com/runatlantis/atlantis/server/core/runtime/models"
)
func AnyModelsFilePath() models.FilePath {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.FilePath))(nil)).Elem()))
var nullValue models.FilePath
return nullValue
}
func EqModelsFilePath(value models.FilePath) models.FilePath {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue models.FilePath
return nullValue
}
func NotEqModelsFilePath(value models.FilePath) models.FilePath {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue models.FilePath
return nullValue
}
func ModelsFilePathThat(matcher pegomock.ArgumentMatcher) models.FilePath {
pegomock.RegisterMatcher(matcher)
var nullValue models.FilePath
return nullValue
}

View File

@@ -1,31 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
)
func AnySliceOfString() []string {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]string))(nil)).Elem()))
var nullValue []string
return nullValue
}
func EqSliceOfString(value []string) []string {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue []string
return nullValue
}
func NotEqSliceOfString(value []string) []string {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue []string
return nullValue
}
func SliceOfStringThat(matcher pegomock.ArgumentMatcher) []string {
pegomock.RegisterMatcher(matcher)
var nullValue []string
return nullValue
}

View File

@@ -4,7 +4,7 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
"reflect"
"time"
)
@@ -24,11 +24,11 @@ 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) CombinedOutput(_param0 []string, _param1 map[string]string, _param2 string) (string, error) {
func (mock *MockExec) CombinedOutput(args []string, envs map[string]string, workdir string) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockExec().")
}
params := []pegomock.Param{_param0, _param1, _param2}
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()})
var ret0 string
var ret1 error
@@ -43,11 +43,11 @@ func (mock *MockExec) CombinedOutput(_param0 []string, _param1 map[string]string
return ret0, ret1
}
func (mock *MockExec) LookPath(_param0 string) (string, error) {
func (mock *MockExec) LookPath(file string) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockExec().")
}
params := []pegomock.Param{_param0}
params := []pegomock.Param{file}
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
@@ -99,8 +99,8 @@ type VerifierMockExec struct {
timeout time.Duration
}
func (verifier *VerifierMockExec) CombinedOutput(_param0 []string, _param1 map[string]string, _param2 string) *MockExec_CombinedOutput_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
func (verifier *VerifierMockExec) CombinedOutput(args []string, envs map[string]string, workdir string) *MockExec_CombinedOutput_OngoingVerification {
params := []pegomock.Param{args, envs, workdir}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CombinedOutput", params, verifier.timeout)
return &MockExec_CombinedOutput_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -111,8 +111,8 @@ type MockExec_CombinedOutput_OngoingVerification struct {
}
func (c *MockExec_CombinedOutput_OngoingVerification) GetCapturedArguments() ([]string, map[string]string, string) {
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
args, envs, workdir := c.GetAllCapturedArguments()
return args[len(args)-1], envs[len(envs)-1], workdir[len(workdir)-1]
}
func (c *MockExec_CombinedOutput_OngoingVerification) GetAllCapturedArguments() (_param0 [][]string, _param1 []map[string]string, _param2 []string) {
@@ -134,8 +134,8 @@ func (c *MockExec_CombinedOutput_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierMockExec) LookPath(_param0 string) *MockExec_LookPath_OngoingVerification {
params := []pegomock.Param{_param0}
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}
}
@@ -146,8 +146,8 @@ type MockExec_LookPath_OngoingVerification struct {
}
func (c *MockExec_LookPath_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
file := c.GetAllCapturedArguments()
return file[len(file)-1]
}
func (c *MockExec_LookPath_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {

View File

@@ -4,7 +4,7 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
models "github.com/runatlantis/atlantis/server/core/runtime/models"
"reflect"
"time"
@@ -25,12 +25,12 @@ 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 {
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 _param0 {
for _, param := range elem {
params = append(params, param)
}
result := pegomock.GetGenericMockFrom(mock).Invoke("Join", params, []reflect.Type{reflect.TypeOf((*models.FilePath)(nil)).Elem()})
@@ -73,11 +73,11 @@ func (mock *MockFilePath) Resolve() string {
return ret0
}
func (mock *MockFilePath) Symlink(_param0 string) (models.FilePath, error) {
func (mock *MockFilePath) Symlink(newname string) (models.FilePath, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockFilePath().")
}
params := []pegomock.Param{_param0}
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
@@ -129,9 +129,9 @@ type VerifierMockFilePath struct {
timeout time.Duration
}
func (verifier *VerifierMockFilePath) Join(_param0 ...string) *MockFilePath_Join_OngoingVerification {
func (verifier *VerifierMockFilePath) Join(elem ...string) *MockFilePath_Join_OngoingVerification {
params := []pegomock.Param{}
for _, param := range _param0 {
for _, param := range elem {
params = append(params, param)
}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Join", params, verifier.timeout)
@@ -144,8 +144,8 @@ type MockFilePath_Join_OngoingVerification struct {
}
func (c *MockFilePath_Join_OngoingVerification) GetCapturedArguments() []string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
elem := c.GetAllCapturedArguments()
return elem[len(elem)-1]
}
func (c *MockFilePath_Join_OngoingVerification) GetAllCapturedArguments() (_param0 [][]string) {
@@ -198,8 +198,8 @@ 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}
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}
}
@@ -210,8 +210,8 @@ type MockFilePath_Symlink_OngoingVerification struct {
}
func (c *MockFilePath_Symlink_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
newname := c.GetAllCapturedArguments()
return newname[len(newname)-1]
}
func (c *MockFilePath_Symlink_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {

View File

@@ -6,8 +6,7 @@ import (
"strings"
"testing"
. "github.com/petergtz/pegomock/v3"
"github.com/runatlantis/atlantis/server/core/runtime/mocks/matchers"
. "github.com/petergtz/pegomock/v4"
"github.com/runatlantis/atlantis/server/core/runtime/models"
"github.com/runatlantis/atlantis/server/events/command"
"github.com/runatlantis/atlantis/server/jobs/mocks"
@@ -38,7 +37,7 @@ func TestShellCommandRunner_Run(t *testing.T) {
t.Run(c.Command, func(t *testing.T) {
RegisterMockTestingT(t)
log := logmocks.NewMockSimpleLogging()
When(log.With(AnyString(), AnyInterface())).ThenReturn(log)
When(log.With(Any[string](), Any[interface{}]())).ThenReturn(log)
ctx := command.ProjectContext{
Log: log,
Workspace: "default",
@@ -63,7 +62,7 @@ func TestShellCommandRunner_Run(t *testing.T) {
projectCmdOutputHandler.VerifyWasCalledOnce().Send(ctx, line, false)
}
log.VerifyWasCalledOnce().With(EqString("duration"), AnyInterface())
log.VerifyWasCalledOnce().With(Eq("duration"), Any[interface{}]())
// And again with streaming disabled. Everything should be the same except the
// command output handler should not have received anything
@@ -73,9 +72,9 @@ func TestShellCommandRunner_Run(t *testing.T) {
output, err = runner.Run(ctx)
Ok(t, err)
Equals(t, expectedOutput, output)
projectCmdOutputHandler.VerifyWasCalled(Never()).Send(matchers.AnyCommandProjectContext(), AnyString(), EqBool(false))
projectCmdOutputHandler.VerifyWasCalled(Never()).Send(Any[command.ProjectContext](), Any[string](), Eq(false))
log.VerifyWasCalled(Twice()).With(EqString("duration"), AnyInterface())
log.VerifyWasCalled(Twice()).With(Eq("duration"), Any[interface{}]())
})
}
}

View File

@@ -4,7 +4,7 @@ import (
"testing"
version "github.com/hashicorp/go-version"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
"github.com/runatlantis/atlantis/server/core/runtime"
"github.com/runatlantis/atlantis/server/core/terraform/mocks"
"github.com/runatlantis/atlantis/server/events/command"

View File

@@ -8,15 +8,13 @@ import (
"testing"
"github.com/hashicorp/go-version"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
"github.com/pkg/errors"
"github.com/runatlantis/atlantis/server/core/runtime"
runtimemocks "github.com/runatlantis/atlantis/server/core/runtime/mocks"
runtimemodels "github.com/runatlantis/atlantis/server/core/runtime/models"
"github.com/runatlantis/atlantis/server/core/terraform/mocks"
matchers2 "github.com/runatlantis/atlantis/server/core/terraform/mocks/matchers"
"github.com/runatlantis/atlantis/server/events/command"
"github.com/runatlantis/atlantis/server/events/mocks/matchers"
"github.com/runatlantis/atlantis/server/events/models"
"github.com/runatlantis/atlantis/server/logging"
@@ -181,12 +179,12 @@ Terraform will perform the following actions:
tfVersion, _ := version.NewVersion("0.10.0")
s := runtime.NewPlanStepRunner(terraform, tfVersion, commitStatusUpdater, asyncTfExec)
When(terraform.RunCommandWithVersion(
matchers.AnyCommandProjectContext(),
AnyString(),
AnyStringSlice(),
matchers2.AnyMapOfStringToString(),
matchers2.AnyPtrToGoVersionVersion(),
AnyString())).
Any[command.ProjectContext](),
Any[string](),
Any[[]string](),
Any[map[string]string](),
Any[*version.Version](),
Any[string]())).
Then(func(params []Param) ReturnValues {
// This code allows us to return different values depending on the
// tf command being run while still using the wildcard matchers above.
@@ -234,12 +232,12 @@ func TestRun_OutputOnErr(t *testing.T) {
expOutput := "expected output"
expErrMsg := "error!"
When(terraform.RunCommandWithVersion(
matchers.AnyCommandProjectContext(),
AnyString(),
AnyStringSlice(),
matchers2.AnyMapOfStringToString(),
matchers2.AnyPtrToGoVersionVersion(),
AnyString())).
Any[command.ProjectContext](),
Any[string](),
Any[[]string](),
Any[map[string]string](),
Any[*version.Version](),
Any[string]())).
Then(func(params []Param) ReturnValues {
// This code allows us to return different values depending on the
// tf command being run while still using the wildcard matchers above.
@@ -295,12 +293,12 @@ func TestRun_NoOptionalVarsIn012(t *testing.T) {
commitStatusUpdater := runtimemocks.NewMockStatusUpdater()
asyncTfExec := runtimemocks.NewMockAsyncTFExec()
When(terraform.RunCommandWithVersion(
matchers.AnyCommandProjectContext(),
AnyString(),
AnyStringSlice(),
matchers2.AnyMapOfStringToString(),
matchers2.AnyPtrToGoVersionVersion(),
AnyString())).ThenReturn("output", nil)
Any[command.ProjectContext](),
Any[string](),
Any[[]string](),
Any[map[string]string](),
Any[*version.Version](),
Any[string]())).ThenReturn("output", nil)
tfVersion, _ := version.NewVersion(c.tfVersion)
s := runtime.NewPlanStepRunner(terraform, tfVersion, commitStatusUpdater, asyncTfExec)

View File

@@ -7,7 +7,7 @@ import (
"testing"
"github.com/hashicorp/go-version"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
. "github.com/runatlantis/atlantis/testing"
"github.com/runatlantis/atlantis/server/core/runtime/mocks"

View File

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

View File

@@ -8,7 +8,7 @@ import (
"testing"
"github.com/hashicorp/go-version"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
"github.com/runatlantis/atlantis/server/core/config/valid"
"github.com/runatlantis/atlantis/server/core/runtime/cache/mocks"
models_mocks "github.com/runatlantis/atlantis/server/core/runtime/models/mocks"
@@ -37,10 +37,10 @@ func TestConfTestVersionDownloader(t *testing.T) {
t.Run("success", func(t *testing.T) {
When(mockDownloader.GetFile(EqString(destPath), EqString(fullURL))).ThenReturn(nil)
When(mockDownloader.GetFile(Eq(destPath), Eq(fullURL))).ThenReturn(nil)
binPath, err := subject.downloadConfTestVersion(version, destPath)
mockDownloader.VerifyWasCalledOnce().GetAny(EqString(destPath), EqString(fullURL))
mockDownloader.VerifyWasCalledOnce().GetAny(Eq(destPath), Eq(fullURL))
Ok(t, err)
@@ -49,7 +49,7 @@ func TestConfTestVersionDownloader(t *testing.T) {
t.Run("error", func(t *testing.T) {
When(mockDownloader.GetAny(EqString(destPath), EqString(fullURL))).ThenReturn(errors.New("err"))
When(mockDownloader.GetAny(Eq(destPath), Eq(fullURL))).ThenReturn(errors.New("err"))
_, err := subject.downloadConfTestVersion(version, destPath)
Assert(t, err != nil, "err is expected")
@@ -73,7 +73,7 @@ func TestEnsureExecutorVersion(t *testing.T) {
Exec: mockExec,
}
When(mockExec.LookPath(AnyString())).ThenReturn("", errors.New("not found"))
When(mockExec.LookPath(Any[string]())).ThenReturn("", errors.New("not found"))
_, err := subject.EnsureExecutorVersion(log, nil)
Assert(t, err != nil, "expected error finding version")
@@ -84,7 +84,7 @@ func TestEnsureExecutorVersion(t *testing.T) {
VersionCache: mockCache,
Exec: mockExec,
}
When(mockExec.LookPath(AnyString())).ThenReturn(expectedPath, nil)
When(mockExec.LookPath(Any[string]())).ThenReturn(expectedPath, nil)
path, err := subject.EnsureExecutorVersion(log, nil)
Ok(t, err)
Assert(t, path == expectedPath, "path is expected")

View File

@@ -1,33 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
pegomock "github.com/petergtz/pegomock/v3"
"reflect"
valid "github.com/runatlantis/atlantis/server/core/config/valid"
)
func AnyValidPolicySet() valid.PolicySet {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(valid.PolicySet))(nil)).Elem()))
var nullValue valid.PolicySet
return nullValue
}
func EqValidPolicySet(value valid.PolicySet) valid.PolicySet {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue valid.PolicySet
return nullValue
}
func NotEqValidPolicySet(value valid.PolicySet) valid.PolicySet {
pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value})
var nullValue valid.PolicySet
return nullValue
}
func ValidPolicySetThat(matcher pegomock.ArgumentMatcher) valid.PolicySet {
pegomock.RegisterMatcher(matcher)
var nullValue valid.PolicySet
return nullValue
}

View File

@@ -4,7 +4,7 @@
package mocks
import (
pegomock "github.com/petergtz/pegomock/v3"
pegomock "github.com/petergtz/pegomock/v4"
valid "github.com/runatlantis/atlantis/server/core/config/valid"
"reflect"
"time"
@@ -25,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(_param0 valid.PolicySet) (string, error) {
func (mock *MockSourceResolver) Resolve(policySet valid.PolicySet) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockSourceResolver().")
}
params := []pegomock.Param{_param0}
params := []pegomock.Param{policySet}
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
@@ -81,8 +81,8 @@ type VerifierMockSourceResolver struct {
timeout time.Duration
}
func (verifier *VerifierMockSourceResolver) Resolve(_param0 valid.PolicySet) *MockSourceResolver_Resolve_OngoingVerification {
params := []pegomock.Param{_param0}
func (verifier *VerifierMockSourceResolver) Resolve(policySet valid.PolicySet) *MockSourceResolver_Resolve_OngoingVerification {
params := []pegomock.Param{policySet}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Resolve", params, verifier.timeout)
return &MockSourceResolver_Resolve_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
@@ -93,8 +93,8 @@ type MockSourceResolver_Resolve_OngoingVerification struct {
}
func (c *MockSourceResolver_Resolve_OngoingVerification) GetCapturedArguments() valid.PolicySet {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
policySet := c.GetAllCapturedArguments()
return policySet[len(policySet)-1]
}
func (c *MockSourceResolver_Resolve_OngoingVerification) GetAllCapturedArguments() (_param0 []valid.PolicySet) {

View File

@@ -5,7 +5,7 @@ import (
"testing"
"github.com/hashicorp/go-version"
. "github.com/petergtz/pegomock/v3"
. "github.com/petergtz/pegomock/v4"
"github.com/runatlantis/atlantis/server/core/config/valid"
"github.com/runatlantis/atlantis/server/core/runtime/mocks"
"github.com/runatlantis/atlantis/server/events/command"

View File

@@ -11,7 +11,7 @@ import (
"github.com/runatlantis/atlantis/server/jobs"
)
//go:generate pegomock generate -m --package mocks -o mocks/mock_post_workflows_hook_runner.go PostWorkflowHookRunner
//go:generate pegomock generate --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

@@ -4,12 +4,10 @@ import (
"strings"
"testing"
. "github.com/petergtz/pegomock/v3"
"github.com/hashicorp/go-version"
. "github.com/petergtz/pegomock/v4"
"github.com/runatlantis/atlantis/server/core/runtime"
runtimematchers "github.com/runatlantis/atlantis/server/core/runtime/mocks/matchers"
"github.com/runatlantis/atlantis/server/core/terraform/mocks"
matchers2 "github.com/runatlantis/atlantis/server/core/terraform/mocks/matchers"
"github.com/runatlantis/atlantis/server/events/mocks/matchers"
"github.com/runatlantis/atlantis/server/events/models"
jobmocks "github.com/runatlantis/atlantis/server/jobs/mocks"
"github.com/runatlantis/atlantis/server/logging"
@@ -92,7 +90,7 @@ func TestPostWorkflowHookRunner_Run(t *testing.T) {
RegisterMockTestingT(t)
terraform := mocks.NewMockClient()
When(terraform.EnsureVersion(matchers.AnyLoggingSimpleLogging(), matchers2.AnyPtrToGoVersionVersion())).
When(terraform.EnsureVersion(Any[logging.SimpleLogging](), Any[*version.Version]())).
ThenReturn(nil)
logger := logging.NewNoopLogger(t)
@@ -137,7 +135,7 @@ func TestPostWorkflowHookRunner_Run(t *testing.T) {
Equals(t, c.ExpDescription, desc)
expOut := strings.Replace(c.ExpOut, "$DIR", tmpDir, -1)
projectCmdOutputHandler.VerifyWasCalledOnce().SendWorkflowHook(
runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString(expOut), EqBool(false))
Any[models.WorkflowHookCommandContext](), Eq(expOut), Eq(false))
})
}
}

View File

@@ -11,7 +11,7 @@ import (
"github.com/runatlantis/atlantis/server/jobs"
)
//go:generate pegomock generate -m --package mocks -o mocks/mock_pre_workflows_hook_runner.go PreWorkflowHookRunner
//go:generate pegomock generate --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

@@ -4,12 +4,10 @@ import (
"strings"
"testing"
. "github.com/petergtz/pegomock/v3"
"github.com/hashicorp/go-version"
. "github.com/petergtz/pegomock/v4"
"github.com/runatlantis/atlantis/server/core/runtime"
runtimematchers "github.com/runatlantis/atlantis/server/core/runtime/mocks/matchers"
"github.com/runatlantis/atlantis/server/core/terraform/mocks"
matchers2 "github.com/runatlantis/atlantis/server/core/terraform/mocks/matchers"
"github.com/runatlantis/atlantis/server/events/mocks/matchers"
"github.com/runatlantis/atlantis/server/events/models"
jobmocks "github.com/runatlantis/atlantis/server/jobs/mocks"
"github.com/runatlantis/atlantis/server/logging"
@@ -92,7 +90,7 @@ func TestPreWorkflowHookRunner_Run(t *testing.T) {
RegisterMockTestingT(t)
terraform := mocks.NewMockClient()
When(terraform.EnsureVersion(matchers.AnyLoggingSimpleLogging(), matchers2.AnyPtrToGoVersionVersion())).
When(terraform.EnsureVersion(Any[logging.SimpleLogging](), Any[*version.Version]())).
ThenReturn(nil)
logger := logging.NewNoopLogger(t)
@@ -137,7 +135,7 @@ func TestPreWorkflowHookRunner_Run(t *testing.T) {
Equals(t, c.ExpDescription, desc)
expOut := strings.Replace(c.ExpOut, "$DIR", tmpDir, -1)
projectCmdOutputHandler.VerifyWasCalledOnce().SendWorkflowHook(
runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString(expOut), EqBool(false))
Any[models.WorkflowHookCommandContext](), Eq(expOut), Eq(false))
})
}
}

View File

@@ -4,7 +4,7 @@ import (
"github.com/runatlantis/atlantis/server/events/models"
)
//go:generate pegomock generate -m --package mocks -o mocks/mock_pull_approved_checker.go PullApprovedChecker
//go:generate pegomock generate --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

@@ -6,13 +6,11 @@ import (
"strings"
"testing"
version "github.com/hashicorp/go-version"
. "github.com/petergtz/pegomock/v3"
"github.com/hashicorp/go-version"
. "github.com/petergtz/pegomock/v4"
"github.com/runatlantis/atlantis/server/core/runtime"
"github.com/runatlantis/atlantis/server/core/terraform/mocks"
matchers2 "github.com/runatlantis/atlantis/server/core/terraform/mocks/matchers"
"github.com/runatlantis/atlantis/server/events/command"
"github.com/runatlantis/atlantis/server/events/mocks/matchers"
"github.com/runatlantis/atlantis/server/events/models"
jobmocks "github.com/runatlantis/atlantis/server/jobs/mocks"
"github.com/runatlantis/atlantis/server/logging"
@@ -105,7 +103,7 @@ func TestRunStepRunner_Run(t *testing.T) {
RegisterMockTestingT(t)
terraform := mocks.NewMockClient()
When(terraform.EnsureVersion(matchers.AnyLoggingSimpleLogging(), matchers2.AnyPtrToGoVersionVersion())).
When(terraform.EnsureVersion(Any[logging.SimpleLogging](), Any[*version.Version]())).
ThenReturn(nil)
logger := logging.NewNoopLogger(t)

View File

@@ -35,7 +35,7 @@ type TerraformExec interface {
// It's split from TerraformExec because due to a bug in pegomock with channels,
// we can't generate a mock for it so we hand-write it for this specific method.
//
//go:generate pegomock generate -m --package mocks -o mocks/mock_async_tfexec.go AsyncTFExec
//go:generate pegomock generate --package mocks -o mocks/mock_async_tfexec.go AsyncTFExec
type AsyncTFExec interface {
// RunCommandAsync runs terraform with args. It immediately returns an
// input and output channel. Callers can use the output channel to
@@ -49,14 +49,14 @@ type AsyncTFExec interface {
// StatusUpdater brings the interface from CommitStatusUpdater into this package
// without causing circular imports.
//
//go:generate pegomock generate -m --package mocks -o mocks/mock_status_updater.go StatusUpdater
//go:generate pegomock generate --package mocks -o mocks/mock_status_updater.go StatusUpdater
type StatusUpdater interface {
UpdateProject(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, url string, result *command.ProjectResult) error
}
// Runner mirrors events.StepRunner as a way to bring it into this package
//
//go:generate pegomock generate -m --package mocks -o mocks/mock_runner.go Runner
//go:generate pegomock generate --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)
}

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