Documentation
¶
Overview ¶
Package autoflowtest is a generated GoMock package.
Package autoflowtest serves a mocked AutoFlow service, with or without TLS, for the tests of the `glab autoflow workflow` commands.
Index ¶
- Constants
- func Answer[Req, Resp any](calls chan<- Call[Req], resp Resp, err error) func(context.Context, Req) (Resp, error)
- func MakeToken(t *testing.T, gitlabClaims map[string]any) string
- func NewTestExec(t *testing.T, cmdFunc cmdtest.CmdFunc, opts ...cmdtest.FactoryOption) (cmdtest.CmdExecFunc, string)
- func NewTokenServer(t *testing.T, gotBody *tokenexchangetest.WireRequest) (*httptest.Server, *atomic.Int32, string)
- func WriteFile(t *testing.T, content string) string
- type Call
- type MockAutoFlowServiceServer
- func (m *MockAutoFlowServiceServer) CancelWorkflow(arg0 context.Context, arg1 *rpcv1.CancelWorkflowRequest) (*rpcv1.CancelWorkflowResponse, error)
- func (m *MockAutoFlowServiceServer) EXPECT() *MockAutoFlowServiceServerMockRecorder
- func (m *MockAutoFlowServiceServer) GetWorkflow(arg0 context.Context, arg1 *rpcv1.GetWorkflowRequest) (*rpcv1.GetWorkflowResponse, error)
- func (m *MockAutoFlowServiceServer) SendToWorkflowChannel(arg0 context.Context, arg1 *rpcv1.SendToWorkflowChannelRequest) (*rpcv1.SendToWorkflowChannelResponse, error)
- func (m *MockAutoFlowServiceServer) StartWorkflow(arg0 context.Context, arg1 *rpcv1.StartWorkflowRequest) (*rpcv1.StartWorkflowResponse, error)
- type MockAutoFlowServiceServerCancelWorkflowCall
- func (c *MockAutoFlowServiceServerCancelWorkflowCall) Do(...) *MockAutoFlowServiceServerCancelWorkflowCall
- func (c *MockAutoFlowServiceServerCancelWorkflowCall) DoAndReturn(...) *MockAutoFlowServiceServerCancelWorkflowCall
- func (c *MockAutoFlowServiceServerCancelWorkflowCall) Return(arg0 *rpcv1.CancelWorkflowResponse, arg1 error) *MockAutoFlowServiceServerCancelWorkflowCall
- type MockAutoFlowServiceServerGetWorkflowCall
- func (c *MockAutoFlowServiceServerGetWorkflowCall) Do(...) *MockAutoFlowServiceServerGetWorkflowCall
- func (c *MockAutoFlowServiceServerGetWorkflowCall) DoAndReturn(...) *MockAutoFlowServiceServerGetWorkflowCall
- func (c *MockAutoFlowServiceServerGetWorkflowCall) Return(arg0 *rpcv1.GetWorkflowResponse, arg1 error) *MockAutoFlowServiceServerGetWorkflowCall
- type MockAutoFlowServiceServerMockRecorder
- func (mr *MockAutoFlowServiceServerMockRecorder) CancelWorkflow(arg0, arg1 any) *MockAutoFlowServiceServerCancelWorkflowCall
- func (mr *MockAutoFlowServiceServerMockRecorder) GetWorkflow(arg0, arg1 any) *MockAutoFlowServiceServerGetWorkflowCall
- func (mr *MockAutoFlowServiceServerMockRecorder) SendToWorkflowChannel(arg0, arg1 any) *MockAutoFlowServiceServerSendToWorkflowChannelCall
- func (mr *MockAutoFlowServiceServerMockRecorder) StartWorkflow(arg0, arg1 any) *MockAutoFlowServiceServerStartWorkflowCall
- type MockAutoFlowServiceServerSendToWorkflowChannelCall
- func (c *MockAutoFlowServiceServerSendToWorkflowChannelCall) Do(...) *MockAutoFlowServiceServerSendToWorkflowChannelCall
- func (c *MockAutoFlowServiceServerSendToWorkflowChannelCall) DoAndReturn(...) *MockAutoFlowServiceServerSendToWorkflowChannelCall
- func (c *MockAutoFlowServiceServerSendToWorkflowChannelCall) Return(arg0 *rpcv1.SendToWorkflowChannelResponse, arg1 error) *MockAutoFlowServiceServerSendToWorkflowChannelCall
- type MockAutoFlowServiceServerStartWorkflowCall
- func (c *MockAutoFlowServiceServerStartWorkflowCall) Do(...) *MockAutoFlowServiceServerStartWorkflowCall
- func (c *MockAutoFlowServiceServerStartWorkflowCall) DoAndReturn(...) *MockAutoFlowServiceServerStartWorkflowCall
- func (c *MockAutoFlowServiceServerStartWorkflowCall) Return(arg0 *rpcv1.StartWorkflowResponse, arg1 error) *MockAutoFlowServiceServerStartWorkflowCall
- type MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall
- func (c *MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall) Do(f func()) *MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall
- func (c *MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall) DoAndReturn(f func()) *MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall
- func (c *MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall) Return() *MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall
- type Relay
Constants ¶
const NamespaceID = "5b4a3928-1706-4f5e-8d4c-3b2a19081726"
NamespaceID is the organization the tokens of NewTokenServer are issued for, and so the namespace the tests address.
Variables ¶
This section is empty.
Functions ¶
func Answer ¶
func Answer[Req, Resp any](calls chan<- Call[Req], resp Resp, err error) func(context.Context, Req) (Resp, error)
Answer returns a mock action that answers with resp and err and sends the call on calls. The call travels on a channel because the race detector cannot see the socket ordering the RPC with the test's reads.
func NewTestExec ¶
func NewTestExec(t *testing.T, cmdFunc cmdtest.CmdFunc, opts ...cmdtest.FactoryOption) (cmdtest.CmdExecFunc, string)
NewTestExec wires cmdFunc to a token exchange endpoint that answers with the token it returns.
func NewTokenServer ¶
func NewTokenServer(t *testing.T, gotBody *tokenexchangetest.WireRequest) (*httptest.Server, *atomic.Int32, string)
NewTokenServer starts a token exchange endpoint that answers with a gitlab-autoflow token, which it returns along with a count of exchanges.
Types ¶
type MockAutoFlowServiceServer ¶
type MockAutoFlowServiceServer struct {
// contains filtered or unexported fields
}
MockAutoFlowServiceServer is a mock of AutoFlowServiceServer interface.
func NewMockAutoFlowServiceServer ¶
func NewMockAutoFlowServiceServer(ctrl *gomock.Controller) *MockAutoFlowServiceServer
NewMockAutoFlowServiceServer creates a new mock instance.
func (*MockAutoFlowServiceServer) CancelWorkflow ¶
func (m *MockAutoFlowServiceServer) CancelWorkflow(arg0 context.Context, arg1 *rpcv1.CancelWorkflowRequest) (*rpcv1.CancelWorkflowResponse, error)
CancelWorkflow mocks base method.
func (*MockAutoFlowServiceServer) EXPECT ¶
func (m *MockAutoFlowServiceServer) EXPECT() *MockAutoFlowServiceServerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockAutoFlowServiceServer) GetWorkflow ¶
func (m *MockAutoFlowServiceServer) GetWorkflow(arg0 context.Context, arg1 *rpcv1.GetWorkflowRequest) (*rpcv1.GetWorkflowResponse, error)
GetWorkflow mocks base method.
func (*MockAutoFlowServiceServer) SendToWorkflowChannel ¶
func (m *MockAutoFlowServiceServer) SendToWorkflowChannel(arg0 context.Context, arg1 *rpcv1.SendToWorkflowChannelRequest) (*rpcv1.SendToWorkflowChannelResponse, error)
SendToWorkflowChannel mocks base method.
func (*MockAutoFlowServiceServer) StartWorkflow ¶
func (m *MockAutoFlowServiceServer) StartWorkflow(arg0 context.Context, arg1 *rpcv1.StartWorkflowRequest) (*rpcv1.StartWorkflowResponse, error)
StartWorkflow mocks base method.
type MockAutoFlowServiceServerCancelWorkflowCall ¶
MockAutoFlowServiceServerCancelWorkflowCall wrap *gomock.Call
func (*MockAutoFlowServiceServerCancelWorkflowCall) Do ¶
func (c *MockAutoFlowServiceServerCancelWorkflowCall) Do(f func(context.Context, *rpcv1.CancelWorkflowRequest) (*rpcv1.CancelWorkflowResponse, error)) *MockAutoFlowServiceServerCancelWorkflowCall
Do rewrite *gomock.Call.Do
func (*MockAutoFlowServiceServerCancelWorkflowCall) DoAndReturn ¶
func (c *MockAutoFlowServiceServerCancelWorkflowCall) DoAndReturn(f func(context.Context, *rpcv1.CancelWorkflowRequest) (*rpcv1.CancelWorkflowResponse, error)) *MockAutoFlowServiceServerCancelWorkflowCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockAutoFlowServiceServerCancelWorkflowCall) Return ¶
func (c *MockAutoFlowServiceServerCancelWorkflowCall) Return(arg0 *rpcv1.CancelWorkflowResponse, arg1 error) *MockAutoFlowServiceServerCancelWorkflowCall
Return rewrite *gomock.Call.Return
type MockAutoFlowServiceServerGetWorkflowCall ¶
MockAutoFlowServiceServerGetWorkflowCall wrap *gomock.Call
func (*MockAutoFlowServiceServerGetWorkflowCall) Do ¶
func (c *MockAutoFlowServiceServerGetWorkflowCall) Do(f func(context.Context, *rpcv1.GetWorkflowRequest) (*rpcv1.GetWorkflowResponse, error)) *MockAutoFlowServiceServerGetWorkflowCall
Do rewrite *gomock.Call.Do
func (*MockAutoFlowServiceServerGetWorkflowCall) DoAndReturn ¶
func (c *MockAutoFlowServiceServerGetWorkflowCall) DoAndReturn(f func(context.Context, *rpcv1.GetWorkflowRequest) (*rpcv1.GetWorkflowResponse, error)) *MockAutoFlowServiceServerGetWorkflowCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockAutoFlowServiceServerGetWorkflowCall) Return ¶
func (c *MockAutoFlowServiceServerGetWorkflowCall) Return(arg0 *rpcv1.GetWorkflowResponse, arg1 error) *MockAutoFlowServiceServerGetWorkflowCall
Return rewrite *gomock.Call.Return
type MockAutoFlowServiceServerMockRecorder ¶
type MockAutoFlowServiceServerMockRecorder struct {
// contains filtered or unexported fields
}
MockAutoFlowServiceServerMockRecorder is the mock recorder for MockAutoFlowServiceServer.
func (*MockAutoFlowServiceServerMockRecorder) CancelWorkflow ¶
func (mr *MockAutoFlowServiceServerMockRecorder) CancelWorkflow(arg0, arg1 any) *MockAutoFlowServiceServerCancelWorkflowCall
CancelWorkflow indicates an expected call of CancelWorkflow.
func (*MockAutoFlowServiceServerMockRecorder) GetWorkflow ¶
func (mr *MockAutoFlowServiceServerMockRecorder) GetWorkflow(arg0, arg1 any) *MockAutoFlowServiceServerGetWorkflowCall
GetWorkflow indicates an expected call of GetWorkflow.
func (*MockAutoFlowServiceServerMockRecorder) SendToWorkflowChannel ¶
func (mr *MockAutoFlowServiceServerMockRecorder) SendToWorkflowChannel(arg0, arg1 any) *MockAutoFlowServiceServerSendToWorkflowChannelCall
SendToWorkflowChannel indicates an expected call of SendToWorkflowChannel.
func (*MockAutoFlowServiceServerMockRecorder) StartWorkflow ¶
func (mr *MockAutoFlowServiceServerMockRecorder) StartWorkflow(arg0, arg1 any) *MockAutoFlowServiceServerStartWorkflowCall
StartWorkflow indicates an expected call of StartWorkflow.
type MockAutoFlowServiceServerSendToWorkflowChannelCall ¶
MockAutoFlowServiceServerSendToWorkflowChannelCall wrap *gomock.Call
func (*MockAutoFlowServiceServerSendToWorkflowChannelCall) Do ¶
func (c *MockAutoFlowServiceServerSendToWorkflowChannelCall) Do(f func(context.Context, *rpcv1.SendToWorkflowChannelRequest) (*rpcv1.SendToWorkflowChannelResponse, error)) *MockAutoFlowServiceServerSendToWorkflowChannelCall
Do rewrite *gomock.Call.Do
func (*MockAutoFlowServiceServerSendToWorkflowChannelCall) DoAndReturn ¶
func (c *MockAutoFlowServiceServerSendToWorkflowChannelCall) DoAndReturn(f func(context.Context, *rpcv1.SendToWorkflowChannelRequest) (*rpcv1.SendToWorkflowChannelResponse, error)) *MockAutoFlowServiceServerSendToWorkflowChannelCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockAutoFlowServiceServerSendToWorkflowChannelCall) Return ¶
func (c *MockAutoFlowServiceServerSendToWorkflowChannelCall) Return(arg0 *rpcv1.SendToWorkflowChannelResponse, arg1 error) *MockAutoFlowServiceServerSendToWorkflowChannelCall
Return rewrite *gomock.Call.Return
type MockAutoFlowServiceServerStartWorkflowCall ¶
MockAutoFlowServiceServerStartWorkflowCall wrap *gomock.Call
func (*MockAutoFlowServiceServerStartWorkflowCall) Do ¶
func (c *MockAutoFlowServiceServerStartWorkflowCall) Do(f func(context.Context, *rpcv1.StartWorkflowRequest) (*rpcv1.StartWorkflowResponse, error)) *MockAutoFlowServiceServerStartWorkflowCall
Do rewrite *gomock.Call.Do
func (*MockAutoFlowServiceServerStartWorkflowCall) DoAndReturn ¶
func (c *MockAutoFlowServiceServerStartWorkflowCall) DoAndReturn(f func(context.Context, *rpcv1.StartWorkflowRequest) (*rpcv1.StartWorkflowResponse, error)) *MockAutoFlowServiceServerStartWorkflowCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockAutoFlowServiceServerStartWorkflowCall) Return ¶
func (c *MockAutoFlowServiceServerStartWorkflowCall) Return(arg0 *rpcv1.StartWorkflowResponse, arg1 error) *MockAutoFlowServiceServerStartWorkflowCall
Return rewrite *gomock.Call.Return
type MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall ¶
type MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall struct {
*gomock.Call
}
MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall wrap *gomock.Call
func (*MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall) Do ¶
func (c *MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall) Do(f func()) *MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall
Do rewrite *gomock.Call.Do
func (*MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall) DoAndReturn ¶
func (c *MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall) DoAndReturn(f func()) *MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall) Return ¶
func (c *MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall) Return() *MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall
Return rewrite *gomock.Call.Return
type Relay ¶
type Relay struct {
Mock *MockAutoFlowServiceServer
Address string
CACertFile string
}
Relay is a mocked AutoFlow service listening on Address with a self-signed certificate, which CACertFile holds.
func NewCleartextRelay ¶
NewCleartextRelay starts a Relay without TLS. Its CACertFile is empty.