autoflowtest

package
v1.131.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 20 Imported by: 0

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

View Source
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 MakeToken

func MakeToken(t *testing.T, gitlabClaims map[string]any) string

MakeToken mints a gitlab-autoflow token with the gitlab claim set to gitlabClaims.

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.

func WriteFile

func WriteFile(t *testing.T, content string) string

WriteFile writes content to a new file and returns its path.

Types

type Call

type Call[Req any] struct {
	Req  Req
	Auth []string
}

Call is one RPC the relay received.

func Received

func Received[Req any](t *testing.T, calls <-chan Call[Req]) Call[Req]

Received returns the next call on calls, failing the test if there is none.

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

CancelWorkflow mocks base method.

func (*MockAutoFlowServiceServer) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockAutoFlowServiceServer) GetWorkflow

GetWorkflow mocks base method.

func (*MockAutoFlowServiceServer) SendToWorkflowChannel

SendToWorkflowChannel mocks base method.

func (*MockAutoFlowServiceServer) StartWorkflow

StartWorkflow mocks base method.

type MockAutoFlowServiceServerCancelWorkflowCall

type MockAutoFlowServiceServerCancelWorkflowCall struct {
	*gomock.Call
}

MockAutoFlowServiceServerCancelWorkflowCall wrap *gomock.Call

func (*MockAutoFlowServiceServerCancelWorkflowCall) Do

Do rewrite *gomock.Call.Do

func (*MockAutoFlowServiceServerCancelWorkflowCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockAutoFlowServiceServerCancelWorkflowCall) Return

Return rewrite *gomock.Call.Return

type MockAutoFlowServiceServerGetWorkflowCall

type MockAutoFlowServiceServerGetWorkflowCall struct {
	*gomock.Call
}

MockAutoFlowServiceServerGetWorkflowCall wrap *gomock.Call

func (*MockAutoFlowServiceServerGetWorkflowCall) Do

Do rewrite *gomock.Call.Do

func (*MockAutoFlowServiceServerGetWorkflowCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockAutoFlowServiceServerGetWorkflowCall) Return

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

CancelWorkflow indicates an expected call of CancelWorkflow.

func (*MockAutoFlowServiceServerMockRecorder) GetWorkflow

GetWorkflow indicates an expected call of GetWorkflow.

func (*MockAutoFlowServiceServerMockRecorder) SendToWorkflowChannel

SendToWorkflowChannel indicates an expected call of SendToWorkflowChannel.

func (*MockAutoFlowServiceServerMockRecorder) StartWorkflow

StartWorkflow indicates an expected call of StartWorkflow.

type MockAutoFlowServiceServerSendToWorkflowChannelCall

type MockAutoFlowServiceServerSendToWorkflowChannelCall struct {
	*gomock.Call
}

MockAutoFlowServiceServerSendToWorkflowChannelCall wrap *gomock.Call

func (*MockAutoFlowServiceServerSendToWorkflowChannelCall) Do

Do rewrite *gomock.Call.Do

func (*MockAutoFlowServiceServerSendToWorkflowChannelCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockAutoFlowServiceServerSendToWorkflowChannelCall) Return

Return rewrite *gomock.Call.Return

type MockAutoFlowServiceServerStartWorkflowCall

type MockAutoFlowServiceServerStartWorkflowCall struct {
	*gomock.Call
}

MockAutoFlowServiceServerStartWorkflowCall wrap *gomock.Call

func (*MockAutoFlowServiceServerStartWorkflowCall) Do

Do rewrite *gomock.Call.Do

func (*MockAutoFlowServiceServerStartWorkflowCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockAutoFlowServiceServerStartWorkflowCall) Return

Return rewrite *gomock.Call.Return

type MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall

type MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall struct {
	*gomock.Call
}

MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall wrap *gomock.Call

func (*MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall) Do

Do rewrite *gomock.Call.Do

func (*MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockAutoFlowServiceServermustEmbedUnimplementedAutoFlowServiceServerCall) Return

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

func NewCleartextRelay(t *testing.T) *Relay

NewCleartextRelay starts a Relay without TLS. Its CACertFile is empty.

func NewRelay

func NewRelay(t *testing.T) *Relay

NewRelay starts a Relay. A call the test did not expect fails it.

func (*Relay) Args

func (r *Relay) Args() string

Args returns the flags that address the relay.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL