Documentation ¶
Index ¶
- type BranchProvider
- type BranchProviderMock
- type GitBranchProvider
- type InteractivePromptProvider
- func (s *InteractivePromptProvider) ConfirmDisablingPromotionOnOtherPullRequest(branch, env string) (bool, error)
- func (s *InteractivePromptProvider) PrintBranchDoesNotSupportAutoPromotion(branch string)
- func (s *InteractivePromptProvider) PrintNotCreatingPullRequest()
- func (s *InteractivePromptProvider) PrintPromotionAlreadyConfigured(branch, env string)
- func (s *InteractivePromptProvider) PrintPromotionConfigured(branch string, env string)
- func (s *InteractivePromptProvider) PrintPromotionDisabled(branch string)
- func (s *InteractivePromptProvider) PrintPromotionNotConfigured(branch string, env string)
- func (s *InteractivePromptProvider) WhetherToCreateMissingPullRequest() (bool, error)
- func (s *InteractivePromptProvider) WhichEnvironmentToPromoteTo(environments []string, preSelectedEnv string) (string, error)
- type Promotion
- type PromptProvider
- type PromptProviderMock
- func (mock *PromptProviderMock) ConfirmDisablingPromotionOnOtherPullRequest(branch string, env string) (bool, error)
- func (mock *PromptProviderMock) ConfirmDisablingPromotionOnOtherPullRequestCalls() []struct{ ... }
- func (mock *PromptProviderMock) PrintBranchDoesNotSupportAutoPromotion(branch string)
- func (mock *PromptProviderMock) PrintBranchDoesNotSupportAutoPromotionCalls() []struct{ ... }
- func (mock *PromptProviderMock) PrintNotCreatingPullRequest()
- func (mock *PromptProviderMock) PrintNotCreatingPullRequestCalls() []struct{}
- func (mock *PromptProviderMock) PrintPromotionAlreadyConfigured(branch string, env string)
- func (mock *PromptProviderMock) PrintPromotionAlreadyConfiguredCalls() []struct{ ... }
- func (mock *PromptProviderMock) PrintPromotionConfigured(branch string, env string)
- func (mock *PromptProviderMock) PrintPromotionConfiguredCalls() []struct{ ... }
- func (mock *PromptProviderMock) PrintPromotionDisabled(branch string)
- func (mock *PromptProviderMock) PrintPromotionDisabledCalls() []struct{ ... }
- func (mock *PromptProviderMock) PrintPromotionNotConfigured(branch string, env string)
- func (mock *PromptProviderMock) PrintPromotionNotConfiguredCalls() []struct{ ... }
- func (mock *PromptProviderMock) WhetherToCreateMissingPullRequest() (bool, error)
- func (mock *PromptProviderMock) WhetherToCreateMissingPullRequestCalls() []struct{}
- func (mock *PromptProviderMock) WhichEnvironmentToPromoteTo(environments []string, preSelectedEnv string) (string, error)
- func (mock *PromptProviderMock) WhichEnvironmentToPromoteToCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BranchProvider ¶
type BranchProviderMock ¶ added in v0.45.1
type BranchProviderMock struct { // GetCurrentBranchFunc mocks the GetCurrentBranch method. GetCurrentBranchFunc func() (string, error) // contains filtered or unexported fields }
BranchProviderMock is a mock implementation of BranchProvider.
func TestSomethingThatUsesBranchProvider(t *testing.T) { // make and configure a mocked BranchProvider mockedBranchProvider := &BranchProviderMock{ GetCurrentBranchFunc: func() (string, error) { panic("mock out the GetCurrentBranch method") }, } // use mockedBranchProvider in code that requires BranchProvider // and then make assertions. }
func (*BranchProviderMock) GetCurrentBranch ¶ added in v0.45.1
func (mock *BranchProviderMock) GetCurrentBranch() (string, error)
GetCurrentBranch calls GetCurrentBranchFunc.
func (*BranchProviderMock) GetCurrentBranchCalls ¶ added in v0.45.1
func (mock *BranchProviderMock) GetCurrentBranchCalls() []struct { }
GetCurrentBranchCalls gets all the calls that were made to GetCurrentBranch. Check the length with:
len(mockedBranchProvider.GetCurrentBranchCalls())
type GitBranchProvider ¶
type GitBranchProvider struct {
// contains filtered or unexported fields
}
func NewGitBranchProvider ¶
func NewGitBranchProvider(dir string) *GitBranchProvider
func (*GitBranchProvider) GetCurrentBranch ¶
func (g *GitBranchProvider) GetCurrentBranch() (string, error)
type InteractivePromptProvider ¶
type InteractivePromptProvider struct{}
func (*InteractivePromptProvider) ConfirmDisablingPromotionOnOtherPullRequest ¶
func (s *InteractivePromptProvider) ConfirmDisablingPromotionOnOtherPullRequest(branch, env string) (bool, error)
func (*InteractivePromptProvider) PrintBranchDoesNotSupportAutoPromotion ¶
func (s *InteractivePromptProvider) PrintBranchDoesNotSupportAutoPromotion(branch string)
func (*InteractivePromptProvider) PrintNotCreatingPullRequest ¶
func (s *InteractivePromptProvider) PrintNotCreatingPullRequest()
func (*InteractivePromptProvider) PrintPromotionAlreadyConfigured ¶
func (s *InteractivePromptProvider) PrintPromotionAlreadyConfigured(branch, env string)
func (*InteractivePromptProvider) PrintPromotionConfigured ¶
func (s *InteractivePromptProvider) PrintPromotionConfigured(branch string, env string)
func (*InteractivePromptProvider) PrintPromotionDisabled ¶
func (s *InteractivePromptProvider) PrintPromotionDisabled(branch string)
func (*InteractivePromptProvider) PrintPromotionNotConfigured ¶
func (s *InteractivePromptProvider) PrintPromotionNotConfigured(branch string, env string)
func (*InteractivePromptProvider) WhetherToCreateMissingPullRequest ¶
func (s *InteractivePromptProvider) WhetherToCreateMissingPullRequest() (bool, error)
func (*InteractivePromptProvider) WhichEnvironmentToPromoteTo ¶
func (s *InteractivePromptProvider) WhichEnvironmentToPromoteTo(environments []string, preSelectedEnv string) (string, error)
type Promotion ¶
type Promotion struct {
// contains filtered or unexported fields
}
func NewDefaultPromotion ¶
func NewPromotion ¶
func NewPromotion(branchProvider BranchProvider, pullRequestProvider pr.PullRequestProvider, prompt PromptProvider) *Promotion
type PromptProvider ¶
type PromptProvider interface { // WhetherToCreateMissingPullRequest prompts user to create a pull request for current branch. WhetherToCreateMissingPullRequest() (bool, error) // WhichEnvironmentToPromoteTo prompts user to select environment to auto-promote builds of pull request to. // If empty string is returned, user opted to disable auto-promotion. WhichEnvironmentToPromoteTo(environments []string, preSelectedEnv string) (string, error) // ConfirmDisablingPromotionOnOtherPullRequest prompts user to confirm it is ok to disable auto-promotion of another // pull request having same target environment. ConfirmDisablingPromotionOnOtherPullRequest(branch, env string) (bool, error) // PrintBranchDoesNotSupportAutoPromotion prints message that master/main branch cannot be promoted. PrintBranchDoesNotSupportAutoPromotion(branch string) // PrintNotCreatingPullRequest prints message that user opted not to create pull request. PrintNotCreatingPullRequest() // PrintPromotionAlreadyConfigured prints message that given branch is configured for auto-promotion to given // environment. PrintPromotionAlreadyConfigured(branch, env string) // PrintPromotionNotConfigured prints message that promotion was not configured. PrintPromotionNotConfigured(branch, env string) // PrintPromotionConfigured prints message that promotion was correctly configured. PrintPromotionConfigured(branch, env string) // PrintPromotionDisabled prints message that promotion was disabled. PrintPromotionDisabled(branch string) }
type PromptProviderMock ¶ added in v0.45.1
type PromptProviderMock struct { // ConfirmDisablingPromotionOnOtherPullRequestFunc mocks the ConfirmDisablingPromotionOnOtherPullRequest method. ConfirmDisablingPromotionOnOtherPullRequestFunc func(branch string, env string) (bool, error) // PrintBranchDoesNotSupportAutoPromotionFunc mocks the PrintBranchDoesNotSupportAutoPromotion method. PrintBranchDoesNotSupportAutoPromotionFunc func(branch string) // PrintNotCreatingPullRequestFunc mocks the PrintNotCreatingPullRequest method. PrintNotCreatingPullRequestFunc func() // PrintPromotionAlreadyConfiguredFunc mocks the PrintPromotionAlreadyConfigured method. PrintPromotionAlreadyConfiguredFunc func(branch string, env string) // PrintPromotionConfiguredFunc mocks the PrintPromotionConfigured method. PrintPromotionConfiguredFunc func(branch string, env string) // PrintPromotionDisabledFunc mocks the PrintPromotionDisabled method. PrintPromotionDisabledFunc func(branch string) // PrintPromotionNotConfiguredFunc mocks the PrintPromotionNotConfigured method. PrintPromotionNotConfiguredFunc func(branch string, env string) // WhetherToCreateMissingPullRequestFunc mocks the WhetherToCreateMissingPullRequest method. WhetherToCreateMissingPullRequestFunc func() (bool, error) // WhichEnvironmentToPromoteToFunc mocks the WhichEnvironmentToPromoteTo method. WhichEnvironmentToPromoteToFunc func(environments []string, preSelectedEnv string) (string, error) // contains filtered or unexported fields }
PromptProviderMock is a mock implementation of PromptProvider.
func TestSomethingThatUsesPromptProvider(t *testing.T) { // make and configure a mocked PromptProvider mockedPromptProvider := &PromptProviderMock{ ConfirmDisablingPromotionOnOtherPullRequestFunc: func(branch string, env string) (bool, error) { panic("mock out the ConfirmDisablingPromotionOnOtherPullRequest method") }, PrintBranchDoesNotSupportAutoPromotionFunc: func(branch string) { panic("mock out the PrintBranchDoesNotSupportAutoPromotion method") }, PrintNotCreatingPullRequestFunc: func() { panic("mock out the PrintNotCreatingPullRequest method") }, PrintPromotionAlreadyConfiguredFunc: func(branch string, env string) { panic("mock out the PrintPromotionAlreadyConfigured method") }, PrintPromotionConfiguredFunc: func(branch string, env string) { panic("mock out the PrintPromotionConfigured method") }, PrintPromotionDisabledFunc: func(branch string) { panic("mock out the PrintPromotionDisabled method") }, PrintPromotionNotConfiguredFunc: func(branch string, env string) { panic("mock out the PrintPromotionNotConfigured method") }, WhetherToCreateMissingPullRequestFunc: func() (bool, error) { panic("mock out the WhetherToCreateMissingPullRequest method") }, WhichEnvironmentToPromoteToFunc: func(environments []string, preSelectedEnv string) (string, error) { panic("mock out the WhichEnvironmentToPromoteTo method") }, } // use mockedPromptProvider in code that requires PromptProvider // and then make assertions. }
func (*PromptProviderMock) ConfirmDisablingPromotionOnOtherPullRequest ¶ added in v0.45.1
func (mock *PromptProviderMock) ConfirmDisablingPromotionOnOtherPullRequest(branch string, env string) (bool, error)
ConfirmDisablingPromotionOnOtherPullRequest calls ConfirmDisablingPromotionOnOtherPullRequestFunc.
func (*PromptProviderMock) ConfirmDisablingPromotionOnOtherPullRequestCalls ¶ added in v0.45.1
func (mock *PromptProviderMock) ConfirmDisablingPromotionOnOtherPullRequestCalls() []struct { Branch string Env string }
ConfirmDisablingPromotionOnOtherPullRequestCalls gets all the calls that were made to ConfirmDisablingPromotionOnOtherPullRequest. Check the length with:
len(mockedPromptProvider.ConfirmDisablingPromotionOnOtherPullRequestCalls())
func (*PromptProviderMock) PrintBranchDoesNotSupportAutoPromotion ¶ added in v0.45.1
func (mock *PromptProviderMock) PrintBranchDoesNotSupportAutoPromotion(branch string)
PrintBranchDoesNotSupportAutoPromotion calls PrintBranchDoesNotSupportAutoPromotionFunc.
func (*PromptProviderMock) PrintBranchDoesNotSupportAutoPromotionCalls ¶ added in v0.45.1
func (mock *PromptProviderMock) PrintBranchDoesNotSupportAutoPromotionCalls() []struct { Branch string }
PrintBranchDoesNotSupportAutoPromotionCalls gets all the calls that were made to PrintBranchDoesNotSupportAutoPromotion. Check the length with:
len(mockedPromptProvider.PrintBranchDoesNotSupportAutoPromotionCalls())
func (*PromptProviderMock) PrintNotCreatingPullRequest ¶ added in v0.45.1
func (mock *PromptProviderMock) PrintNotCreatingPullRequest()
PrintNotCreatingPullRequest calls PrintNotCreatingPullRequestFunc.
func (*PromptProviderMock) PrintNotCreatingPullRequestCalls ¶ added in v0.45.1
func (mock *PromptProviderMock) PrintNotCreatingPullRequestCalls() []struct { }
PrintNotCreatingPullRequestCalls gets all the calls that were made to PrintNotCreatingPullRequest. Check the length with:
len(mockedPromptProvider.PrintNotCreatingPullRequestCalls())
func (*PromptProviderMock) PrintPromotionAlreadyConfigured ¶ added in v0.45.1
func (mock *PromptProviderMock) PrintPromotionAlreadyConfigured(branch string, env string)
PrintPromotionAlreadyConfigured calls PrintPromotionAlreadyConfiguredFunc.
func (*PromptProviderMock) PrintPromotionAlreadyConfiguredCalls ¶ added in v0.45.1
func (mock *PromptProviderMock) PrintPromotionAlreadyConfiguredCalls() []struct { Branch string Env string }
PrintPromotionAlreadyConfiguredCalls gets all the calls that were made to PrintPromotionAlreadyConfigured. Check the length with:
len(mockedPromptProvider.PrintPromotionAlreadyConfiguredCalls())
func (*PromptProviderMock) PrintPromotionConfigured ¶ added in v0.45.1
func (mock *PromptProviderMock) PrintPromotionConfigured(branch string, env string)
PrintPromotionConfigured calls PrintPromotionConfiguredFunc.
func (*PromptProviderMock) PrintPromotionConfiguredCalls ¶ added in v0.45.1
func (mock *PromptProviderMock) PrintPromotionConfiguredCalls() []struct { Branch string Env string }
PrintPromotionConfiguredCalls gets all the calls that were made to PrintPromotionConfigured. Check the length with:
len(mockedPromptProvider.PrintPromotionConfiguredCalls())
func (*PromptProviderMock) PrintPromotionDisabled ¶ added in v0.45.1
func (mock *PromptProviderMock) PrintPromotionDisabled(branch string)
PrintPromotionDisabled calls PrintPromotionDisabledFunc.
func (*PromptProviderMock) PrintPromotionDisabledCalls ¶ added in v0.45.1
func (mock *PromptProviderMock) PrintPromotionDisabledCalls() []struct { Branch string }
PrintPromotionDisabledCalls gets all the calls that were made to PrintPromotionDisabled. Check the length with:
len(mockedPromptProvider.PrintPromotionDisabledCalls())
func (*PromptProviderMock) PrintPromotionNotConfigured ¶ added in v0.45.1
func (mock *PromptProviderMock) PrintPromotionNotConfigured(branch string, env string)
PrintPromotionNotConfigured calls PrintPromotionNotConfiguredFunc.
func (*PromptProviderMock) PrintPromotionNotConfiguredCalls ¶ added in v0.45.1
func (mock *PromptProviderMock) PrintPromotionNotConfiguredCalls() []struct { Branch string Env string }
PrintPromotionNotConfiguredCalls gets all the calls that were made to PrintPromotionNotConfigured. Check the length with:
len(mockedPromptProvider.PrintPromotionNotConfiguredCalls())
func (*PromptProviderMock) WhetherToCreateMissingPullRequest ¶ added in v0.45.1
func (mock *PromptProviderMock) WhetherToCreateMissingPullRequest() (bool, error)
WhetherToCreateMissingPullRequest calls WhetherToCreateMissingPullRequestFunc.
func (*PromptProviderMock) WhetherToCreateMissingPullRequestCalls ¶ added in v0.45.1
func (mock *PromptProviderMock) WhetherToCreateMissingPullRequestCalls() []struct { }
WhetherToCreateMissingPullRequestCalls gets all the calls that were made to WhetherToCreateMissingPullRequest. Check the length with:
len(mockedPromptProvider.WhetherToCreateMissingPullRequestCalls())
func (*PromptProviderMock) WhichEnvironmentToPromoteTo ¶ added in v0.45.1
func (mock *PromptProviderMock) WhichEnvironmentToPromoteTo(environments []string, preSelectedEnv string) (string, error)
WhichEnvironmentToPromoteTo calls WhichEnvironmentToPromoteToFunc.
func (*PromptProviderMock) WhichEnvironmentToPromoteToCalls ¶ added in v0.45.1
func (mock *PromptProviderMock) WhichEnvironmentToPromoteToCalls() []struct { Environments []string PreSelectedEnv string }
WhichEnvironmentToPromoteToCalls gets all the calls that were made to WhichEnvironmentToPromoteTo. Check the length with:
len(mockedPromptProvider.WhichEnvironmentToPromoteToCalls())