mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-08-04 04:38:38 +00:00
* Adding policy_check support into yaml config * Added policy check model and runtime structs * Adding BuildPolicyCheckCommand to ProjectCommandBuilder * Return incorrectly deleted code * Remove BuildAutoPolicyPlanCommand from ProjectCommandBuilder * Split runAutoCommand into two functions runAutoPlanCommand - does what originally RunAutoplancommand was doing except now it returns CommandResult and []models.ProjectCommandContext runAutoPolicyCheckCommand - accepts CommandContext, CommandResult, and []models.ProjectCommandContext as arguments and runs PolicyCheckStep runner * Refactor RunCommentCommand * Remove BuildPolicyCheckCommand and rename StepCmdExec back to TerraformExec * Add policy step runner logic and conftest interfaces. * Add show step runner to policy check stage. * Adding models.PolicyCheckCommand to buildCtx This also means buildPlanAllCommands call buildCtx twice once with models.PlanCommand and once with models.PolicyCheckCommand * Adding new project_command_builder that supports policy_check * Refactoring PolicyCheck specific logic into a PolicyCheckProjectCommandBuilder * Moving events.CommandContext to models.CommandContext this will allow me to remove buildCtx method and move ProjectCommandContext creation into models package * Policy Owners might be different types, for that reason we are refactoring Owners into its own struct with specific keys defining different owner types Co-authored-by: Nish Krishnan <nishk@lyft.com> Co-authored-by: Nish Krishnan <nishkrishnan@users.noreply.github.com>
227 lines
7.4 KiB
Go
227 lines
7.4 KiB
Go
// Code generated by pegomock. DO NOT EDIT.
|
|
// Source: github.com/runatlantis/atlantis/server/events/runtime/models (interfaces: FilePath)
|
|
|
|
package mocks
|
|
|
|
import (
|
|
pegomock "github.com/petergtz/pegomock"
|
|
models "github.com/runatlantis/atlantis/server/events/runtime/models"
|
|
"reflect"
|
|
"time"
|
|
)
|
|
|
|
type MockFilePath struct {
|
|
fail func(message string, callerSkip ...int)
|
|
}
|
|
|
|
func NewMockFilePath(options ...pegomock.Option) *MockFilePath {
|
|
mock := &MockFilePath{}
|
|
for _, option := range options {
|
|
option.Apply(mock)
|
|
}
|
|
return mock
|
|
}
|
|
|
|
func (mock *MockFilePath) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
|
|
func (mock *MockFilePath) FailHandler() pegomock.FailHandler { return mock.fail }
|
|
|
|
func (mock *MockFilePath) NotExists() bool {
|
|
if mock == nil {
|
|
panic("mock must not be nil. Use myMock := NewMockFilePath().")
|
|
}
|
|
params := []pegomock.Param{}
|
|
result := pegomock.GetGenericMockFrom(mock).Invoke("NotExists", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem()})
|
|
var ret0 bool
|
|
if len(result) != 0 {
|
|
if result[0] != nil {
|
|
ret0 = result[0].(bool)
|
|
}
|
|
}
|
|
return ret0
|
|
}
|
|
|
|
func (mock *MockFilePath) Join(elem ...string) models.FilePath {
|
|
if mock == nil {
|
|
panic("mock must not be nil. Use myMock := NewMockFilePath().")
|
|
}
|
|
params := []pegomock.Param{}
|
|
for _, param := range elem {
|
|
params = append(params, param)
|
|
}
|
|
result := pegomock.GetGenericMockFrom(mock).Invoke("Join", params, []reflect.Type{reflect.TypeOf((*models.FilePath)(nil)).Elem()})
|
|
var ret0 models.FilePath
|
|
if len(result) != 0 {
|
|
if result[0] != nil {
|
|
ret0 = result[0].(models.FilePath)
|
|
}
|
|
}
|
|
return ret0
|
|
}
|
|
|
|
func (mock *MockFilePath) Symlink(newname string) (models.FilePath, error) {
|
|
if mock == nil {
|
|
panic("mock must not be nil. Use myMock := NewMockFilePath().")
|
|
}
|
|
params := []pegomock.Param{newname}
|
|
result := pegomock.GetGenericMockFrom(mock).Invoke("Symlink", params, []reflect.Type{reflect.TypeOf((*models.FilePath)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
|
|
var ret0 models.FilePath
|
|
var ret1 error
|
|
if len(result) != 0 {
|
|
if result[0] != nil {
|
|
ret0 = result[0].(models.FilePath)
|
|
}
|
|
if result[1] != nil {
|
|
ret1 = result[1].(error)
|
|
}
|
|
}
|
|
return ret0, ret1
|
|
}
|
|
|
|
func (mock *MockFilePath) Resolve() string {
|
|
if mock == nil {
|
|
panic("mock must not be nil. Use myMock := NewMockFilePath().")
|
|
}
|
|
params := []pegomock.Param{}
|
|
result := pegomock.GetGenericMockFrom(mock).Invoke("Resolve", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem()})
|
|
var ret0 string
|
|
if len(result) != 0 {
|
|
if result[0] != nil {
|
|
ret0 = result[0].(string)
|
|
}
|
|
}
|
|
return ret0
|
|
}
|
|
|
|
func (mock *MockFilePath) VerifyWasCalledOnce() *VerifierMockFilePath {
|
|
return &VerifierMockFilePath{
|
|
mock: mock,
|
|
invocationCountMatcher: pegomock.Times(1),
|
|
}
|
|
}
|
|
|
|
func (mock *MockFilePath) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockFilePath {
|
|
return &VerifierMockFilePath{
|
|
mock: mock,
|
|
invocationCountMatcher: invocationCountMatcher,
|
|
}
|
|
}
|
|
|
|
func (mock *MockFilePath) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockFilePath {
|
|
return &VerifierMockFilePath{
|
|
mock: mock,
|
|
invocationCountMatcher: invocationCountMatcher,
|
|
inOrderContext: inOrderContext,
|
|
}
|
|
}
|
|
|
|
func (mock *MockFilePath) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockFilePath {
|
|
return &VerifierMockFilePath{
|
|
mock: mock,
|
|
invocationCountMatcher: invocationCountMatcher,
|
|
timeout: timeout,
|
|
}
|
|
}
|
|
|
|
type VerifierMockFilePath struct {
|
|
mock *MockFilePath
|
|
invocationCountMatcher pegomock.Matcher
|
|
inOrderContext *pegomock.InOrderContext
|
|
timeout time.Duration
|
|
}
|
|
|
|
func (verifier *VerifierMockFilePath) NotExists() *MockFilePath_NotExists_OngoingVerification {
|
|
params := []pegomock.Param{}
|
|
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NotExists", params, verifier.timeout)
|
|
return &MockFilePath_NotExists_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
|
}
|
|
|
|
type MockFilePath_NotExists_OngoingVerification struct {
|
|
mock *MockFilePath
|
|
methodInvocations []pegomock.MethodInvocation
|
|
}
|
|
|
|
func (c *MockFilePath_NotExists_OngoingVerification) GetCapturedArguments() {
|
|
}
|
|
|
|
func (c *MockFilePath_NotExists_OngoingVerification) GetAllCapturedArguments() {
|
|
}
|
|
|
|
func (verifier *VerifierMockFilePath) Join(elem ...string) *MockFilePath_Join_OngoingVerification {
|
|
params := []pegomock.Param{}
|
|
for _, param := range elem {
|
|
params = append(params, param)
|
|
}
|
|
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Join", params, verifier.timeout)
|
|
return &MockFilePath_Join_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
|
}
|
|
|
|
type MockFilePath_Join_OngoingVerification struct {
|
|
mock *MockFilePath
|
|
methodInvocations []pegomock.MethodInvocation
|
|
}
|
|
|
|
func (c *MockFilePath_Join_OngoingVerification) GetCapturedArguments() []string {
|
|
elem := c.GetAllCapturedArguments()
|
|
return elem[len(elem)-1]
|
|
}
|
|
|
|
func (c *MockFilePath_Join_OngoingVerification) GetAllCapturedArguments() (_param0 [][]string) {
|
|
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
|
|
if len(params) > 0 {
|
|
_param0 = make([][]string, len(c.methodInvocations))
|
|
for u := 0; u < len(c.methodInvocations); u++ {
|
|
_param0[u] = make([]string, len(params)-0)
|
|
for x := 0; x < len(params); x++ {
|
|
if params[x][u] != nil {
|
|
_param0[u][x-0] = params[x][u].(string)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
func (verifier *VerifierMockFilePath) Symlink(newname string) *MockFilePath_Symlink_OngoingVerification {
|
|
params := []pegomock.Param{newname}
|
|
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Symlink", params, verifier.timeout)
|
|
return &MockFilePath_Symlink_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
|
}
|
|
|
|
type MockFilePath_Symlink_OngoingVerification struct {
|
|
mock *MockFilePath
|
|
methodInvocations []pegomock.MethodInvocation
|
|
}
|
|
|
|
func (c *MockFilePath_Symlink_OngoingVerification) GetCapturedArguments() string {
|
|
newname := c.GetAllCapturedArguments()
|
|
return newname[len(newname)-1]
|
|
}
|
|
|
|
func (c *MockFilePath_Symlink_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
|
|
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
|
|
if len(params) > 0 {
|
|
_param0 = make([]string, len(c.methodInvocations))
|
|
for u, param := range params[0] {
|
|
_param0[u] = param.(string)
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
func (verifier *VerifierMockFilePath) Resolve() *MockFilePath_Resolve_OngoingVerification {
|
|
params := []pegomock.Param{}
|
|
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Resolve", params, verifier.timeout)
|
|
return &MockFilePath_Resolve_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
|
}
|
|
|
|
type MockFilePath_Resolve_OngoingVerification struct {
|
|
mock *MockFilePath
|
|
methodInvocations []pegomock.MethodInvocation
|
|
}
|
|
|
|
func (c *MockFilePath_Resolve_OngoingVerification) GetCapturedArguments() {
|
|
}
|
|
|
|
func (c *MockFilePath_Resolve_OngoingVerification) GetAllCapturedArguments() {
|
|
}
|