mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-07-28 23:48:20 +00:00
Draining cleanup
This commit is contained in:
@@ -33,7 +33,6 @@ import (
|
||||
. "github.com/runatlantis/atlantis/testing"
|
||||
)
|
||||
|
||||
var commitStatusUpdater *mocks.MockCommitStatusUpdater
|
||||
var projectCommandBuilder *mocks.MockProjectCommandBuilder
|
||||
var projectCommandRunner *mocks.MockProjectCommandRunner
|
||||
var eventParsing *mocks.MockEventParsing
|
||||
@@ -48,7 +47,6 @@ var drainer *events.Drainer
|
||||
|
||||
func setup(t *testing.T) *vcsmocks.MockClient {
|
||||
RegisterMockTestingT(t)
|
||||
commitStatusUpdater = mocks.NewMockCommitStatusUpdater()
|
||||
projectCommandBuilder = mocks.NewMockProjectCommandBuilder()
|
||||
eventParsing = mocks.NewMockEventParsing()
|
||||
vcsClient := vcsmocks.NewMockClient()
|
||||
@@ -66,7 +64,7 @@ func setup(t *testing.T) *vcsmocks.MockClient {
|
||||
ThenReturn(pullLogger)
|
||||
ch = events.DefaultCommandRunner{
|
||||
VCSClient: vcsClient,
|
||||
CommitStatusUpdater: commitStatusUpdater,
|
||||
CommitStatusUpdater: &events.DefaultCommitStatusUpdater{vcsClient, "atlantis"},
|
||||
EventParser: eventParsing,
|
||||
MarkdownRenderer: &events.MarkdownRenderer{},
|
||||
GithubPullGetter: githubGetter,
|
||||
|
||||
@@ -19,7 +19,7 @@ type DrainStatus struct {
|
||||
InProgressOps int
|
||||
}
|
||||
|
||||
// StartOp tries to start a new operation. It returns false is Atlantis is
|
||||
// StartOp tries to start a new operation. It returns false if Atlantis is
|
||||
// shutting down.
|
||||
func (d *Drainer) StartOp() bool {
|
||||
d.mutex.Lock()
|
||||
|
||||
@@ -1,177 +0,0 @@
|
||||
// Code generated by pegomock. DO NOT EDIT.
|
||||
// Source: github.com/runatlantis/atlantis/server/events (interfaces: Drainer)
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
pegomock "github.com/petergtz/pegomock"
|
||||
events "github.com/runatlantis/atlantis/server/events"
|
||||
"reflect"
|
||||
"time"
|
||||
)
|
||||
|
||||
type MockDrainer struct {
|
||||
fail func(message string, callerSkip ...int)
|
||||
}
|
||||
|
||||
func NewMockDrainer(options ...pegomock.Option) *MockDrainer {
|
||||
mock := &MockDrainer{}
|
||||
for _, option := range options {
|
||||
option.Apply(mock)
|
||||
}
|
||||
return mock
|
||||
}
|
||||
|
||||
func (mock *MockDrainer) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
|
||||
func (mock *MockDrainer) FailHandler() pegomock.FailHandler { return mock.fail }
|
||||
|
||||
func (mock *MockDrainer) GetStatus() events.DrainStatus {
|
||||
if mock == nil {
|
||||
panic("mock must not be nil. Use myMock := NewMockDrainer().")
|
||||
}
|
||||
params := []pegomock.Param{}
|
||||
result := pegomock.GetGenericMockFrom(mock).Invoke("GetStatus", params, []reflect.Type{reflect.TypeOf((*events.DrainStatus)(nil)).Elem()})
|
||||
var ret0 events.DrainStatus
|
||||
if len(result) != 0 {
|
||||
if result[0] != nil {
|
||||
ret0 = result[0].(events.DrainStatus)
|
||||
}
|
||||
}
|
||||
return ret0
|
||||
}
|
||||
|
||||
func (mock *MockDrainer) RemoveOngoingOperation() {
|
||||
if mock == nil {
|
||||
panic("mock must not be nil. Use myMock := NewMockDrainer().")
|
||||
}
|
||||
params := []pegomock.Param{}
|
||||
pegomock.GetGenericMockFrom(mock).Invoke("OpDone", params, []reflect.Type{})
|
||||
}
|
||||
|
||||
func (mock *MockDrainer) StartDrain() {
|
||||
if mock == nil {
|
||||
panic("mock must not be nil. Use myMock := NewMockDrainer().")
|
||||
}
|
||||
params := []pegomock.Param{}
|
||||
pegomock.GetGenericMockFrom(mock).Invoke("ShutdownBlocking", params, []reflect.Type{})
|
||||
}
|
||||
|
||||
func (mock *MockDrainer) TryAddNewOngoingOperation() bool {
|
||||
if mock == nil {
|
||||
panic("mock must not be nil. Use myMock := NewMockDrainer().")
|
||||
}
|
||||
params := []pegomock.Param{}
|
||||
result := pegomock.GetGenericMockFrom(mock).Invoke("StartOp", 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 *MockDrainer) VerifyWasCalledOnce() *VerifierMockDrainer {
|
||||
return &VerifierMockDrainer{
|
||||
mock: mock,
|
||||
invocationCountMatcher: pegomock.Times(1),
|
||||
}
|
||||
}
|
||||
|
||||
func (mock *MockDrainer) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockDrainer {
|
||||
return &VerifierMockDrainer{
|
||||
mock: mock,
|
||||
invocationCountMatcher: invocationCountMatcher,
|
||||
}
|
||||
}
|
||||
|
||||
func (mock *MockDrainer) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockDrainer {
|
||||
return &VerifierMockDrainer{
|
||||
mock: mock,
|
||||
invocationCountMatcher: invocationCountMatcher,
|
||||
inOrderContext: inOrderContext,
|
||||
}
|
||||
}
|
||||
|
||||
func (mock *MockDrainer) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockDrainer {
|
||||
return &VerifierMockDrainer{
|
||||
mock: mock,
|
||||
invocationCountMatcher: invocationCountMatcher,
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
type VerifierMockDrainer struct {
|
||||
mock *MockDrainer
|
||||
invocationCountMatcher pegomock.Matcher
|
||||
inOrderContext *pegomock.InOrderContext
|
||||
timeout time.Duration
|
||||
}
|
||||
|
||||
func (verifier *VerifierMockDrainer) GetStatus() *MockDrainer_GetStatus_OngoingVerification {
|
||||
params := []pegomock.Param{}
|
||||
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetStatus", params, verifier.timeout)
|
||||
return &MockDrainer_GetStatus_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
||||
}
|
||||
|
||||
type MockDrainer_GetStatus_OngoingVerification struct {
|
||||
mock *MockDrainer
|
||||
methodInvocations []pegomock.MethodInvocation
|
||||
}
|
||||
|
||||
func (c *MockDrainer_GetStatus_OngoingVerification) GetCapturedArguments() {
|
||||
}
|
||||
|
||||
func (c *MockDrainer_GetStatus_OngoingVerification) GetAllCapturedArguments() {
|
||||
}
|
||||
|
||||
func (verifier *VerifierMockDrainer) RemoveOngoingOperation() *MockDrainer_RemoveOngoingOperation_OngoingVerification {
|
||||
params := []pegomock.Param{}
|
||||
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "OpDone", params, verifier.timeout)
|
||||
return &MockDrainer_RemoveOngoingOperation_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
||||
}
|
||||
|
||||
type MockDrainer_RemoveOngoingOperation_OngoingVerification struct {
|
||||
mock *MockDrainer
|
||||
methodInvocations []pegomock.MethodInvocation
|
||||
}
|
||||
|
||||
func (c *MockDrainer_RemoveOngoingOperation_OngoingVerification) GetCapturedArguments() {
|
||||
}
|
||||
|
||||
func (c *MockDrainer_RemoveOngoingOperation_OngoingVerification) GetAllCapturedArguments() {
|
||||
}
|
||||
|
||||
func (verifier *VerifierMockDrainer) StartDrain() *MockDrainer_StartDrain_OngoingVerification {
|
||||
params := []pegomock.Param{}
|
||||
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ShutdownBlocking", params, verifier.timeout)
|
||||
return &MockDrainer_StartDrain_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
||||
}
|
||||
|
||||
type MockDrainer_StartDrain_OngoingVerification struct {
|
||||
mock *MockDrainer
|
||||
methodInvocations []pegomock.MethodInvocation
|
||||
}
|
||||
|
||||
func (c *MockDrainer_StartDrain_OngoingVerification) GetCapturedArguments() {
|
||||
}
|
||||
|
||||
func (c *MockDrainer_StartDrain_OngoingVerification) GetAllCapturedArguments() {
|
||||
}
|
||||
|
||||
func (verifier *VerifierMockDrainer) TryAddNewOngoingOperation() *MockDrainer_TryAddNewOngoingOperation_OngoingVerification {
|
||||
params := []pegomock.Param{}
|
||||
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "StartOp", params, verifier.timeout)
|
||||
return &MockDrainer_TryAddNewOngoingOperation_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
||||
}
|
||||
|
||||
type MockDrainer_TryAddNewOngoingOperation_OngoingVerification struct {
|
||||
mock *MockDrainer
|
||||
methodInvocations []pegomock.MethodInvocation
|
||||
}
|
||||
|
||||
func (c *MockDrainer_TryAddNewOngoingOperation_OngoingVerification) GetCapturedArguments() {
|
||||
}
|
||||
|
||||
func (c *MockDrainer_TryAddNewOngoingOperation_OngoingVerification) GetAllCapturedArguments() {
|
||||
}
|
||||
Reference in New Issue
Block a user