itest

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package itest contains ready-made preset handlers for outbound checks in the itestkit pipeline.

Package itest contains ready-made preset handlers for outbound checks in the itestkit pipeline.

Package itest is a generated GoMock package.

Index

Constants

View Source
const AwaitOutboundHandlerName = "AwaitOutbound"

AwaitOutboundHandlerName captures the name of the await check preset handler.

View Source
const CleanupBrokerHandlerName = "CleanupBroker"

CleanupBrokerHandlerName captures the name of the resource cleanup preset handler.

View Source
const PlanOutboundHandlerName = "PlanOutbound"

PlanOutboundHandlerName captures the name of the wait scheduling preset handler.

View Source
const VerifyOutboundHandlerName = "VerifyOutbound"

VerifyOutboundHandlerName fixes the name of the verify-verification preset handler.

Variables

This section is empty.

Functions

func NewRegistry

func NewRegistry[C OutboundHarness](customHandlers map[string]itestkit.Handler[C]) itestkit.MapRegistry[C]

NewRegistry creates a MapRegistry with preset outbound handlers and custom action handlers.

Types

type AwaitOutboundHandler

type AwaitOutboundHandler[C OutboundHarness] struct{}

AwaitOutboundHandler implements an await step to observe an outbound publication.

func (AwaitOutboundHandler[C]) DecodeExpectedResponse

func (AwaitOutboundHandler[C]) DecodeExpectedResponse(raw json.RawMessage) (any, error)

DecodeExpectedResponse decodes the awaited result.

func (AwaitOutboundHandler[C]) DecodeRequest

func (AwaitOutboundHandler[C]) DecodeRequest(raw json.RawMessage) (any, error)

DecodeRequest decodes an empty await step request.

func (AwaitOutboundHandler[C]) Invoke

func (AwaitOutboundHandler[C]) Invoke(ctx context.Context, harness C, request any) (any, error)

Invoke runs an intermediate await check via a harness.

func (AwaitOutboundHandler[C]) NormalizeResponse

func (AwaitOutboundHandler[C]) NormalizeResponse(response any) (any, error)

NormalizeResponse returns the response unchanged.

type CleanupBrokerHandler

type CleanupBrokerHandler[C OutboundHarness] struct{}

CleanupBrokerHandler implements the cleanup step to free resources.

func (CleanupBrokerHandler[C]) DecodeExpectedResponse

func (CleanupBrokerHandler[C]) DecodeExpectedResponse(raw json.RawMessage) (any, error)

DecodeExpectedResponse decodes the expected cleanup response.

func (CleanupBrokerHandler[C]) DecodeRequest

func (CleanupBrokerHandler[C]) DecodeRequest(raw json.RawMessage) (any, error)

DecodeRequest decodes an empty cleanup request.

func (CleanupBrokerHandler[C]) Invoke

func (CleanupBrokerHandler[C]) Invoke(ctx context.Context, harness C, request any) (any, error)

Invoke releases the broker helper's resources.

func (CleanupBrokerHandler[C]) NormalizeResponse

func (CleanupBrokerHandler[C]) NormalizeResponse(response any) (any, error)

NormalizeResponse returns the response unchanged.

type CleanupBrokerResponse

type CleanupBrokerResponse struct {
	Cleaned bool `json:"cleaned"`
}

CleanupBrokerResponse confirms that the cleanup step completed successfully.

type MockOutboundHarness

type MockOutboundHarness struct {
	// contains filtered or unexported fields
}

MockOutboundHarness is a mock of OutboundHarness interface.

func NewMockOutboundHarness

func NewMockOutboundHarness(ctrl *gomock.Controller) *MockOutboundHarness

NewMockOutboundHarness creates a new mock instance.

func (*MockOutboundHarness) AwaitOutbound

func (m *MockOutboundHarness) AwaitOutbound(ctx context.Context) (probe.CheckResult, error)

AwaitOutbound mocks base method.

func (*MockOutboundHarness) CleanupBroker

func (m *MockOutboundHarness) CleanupBroker(ctx context.Context) error

CleanupBroker mocks base method.

func (*MockOutboundHarness) EXPECT

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

func (*MockOutboundHarness) PlanOutbound

func (m *MockOutboundHarness) PlanOutbound(ctx context.Context, expectation probe.OutboundExpectation) error

PlanOutbound mocks base method.

func (*MockOutboundHarness) VerifyOutbound

func (m *MockOutboundHarness) VerifyOutbound(ctx context.Context) (probe.CheckResult, error)

VerifyOutbound mocks base method.

type MockOutboundHarnessMockRecorder

type MockOutboundHarnessMockRecorder struct {
	// contains filtered or unexported fields
}

MockOutboundHarnessMockRecorder is the mock recorder for MockOutboundHarness.

func (*MockOutboundHarnessMockRecorder) AwaitOutbound

func (mr *MockOutboundHarnessMockRecorder) AwaitOutbound(ctx any) *gomock.Call

AwaitOutbound indicates an expected call of AwaitOutbound.

func (*MockOutboundHarnessMockRecorder) CleanupBroker

func (mr *MockOutboundHarnessMockRecorder) CleanupBroker(ctx any) *gomock.Call

CleanupBroker indicates an expected call of CleanupBroker.

func (*MockOutboundHarnessMockRecorder) PlanOutbound

func (mr *MockOutboundHarnessMockRecorder) PlanOutbound(ctx, expectation any) *gomock.Call

PlanOutbound indicates an expected call of PlanOutbound.

func (*MockOutboundHarnessMockRecorder) VerifyOutbound

func (mr *MockOutboundHarnessMockRecorder) VerifyOutbound(ctx any) *gomock.Call

VerifyOutbound indicates an expected call of VerifyOutbound.

type OutboundHarness

type OutboundHarness interface {
	// PlanOutbound saves expectations and activates the observation boundary for the current case.
	PlanOutbound(ctx context.Context, expectation probe.OutboundExpectation) error
	// AwaitOutbound performs an intermediate check of expectations in the await step.
	AwaitOutbound(ctx context.Context) (probe.CheckResult, error)
	// VerifyOutbound performs the final check of expectations in the verify step.
	VerifyOutbound(ctx context.Context) (probe.CheckResult, error)
	// CleanupBroker releases helper resources for the current case.
	CleanupBroker(ctx context.Context) error
}

OutboundHarness describes the minimum harness contract for outbound scenarios.

type PlanOutboundHandler

type PlanOutboundHandler[C OutboundHarness] struct{}

PlanOutboundHandler implements the prepare step for saving the outbound plan.

func (PlanOutboundHandler[C]) DecodeExpectedResponse

func (PlanOutboundHandler[C]) DecodeExpectedResponse(raw json.RawMessage) (any, error)

DecodeExpectedResponse decodes the expected response from the prepare step.

func (PlanOutboundHandler[C]) DecodeRequest

func (PlanOutboundHandler[C]) DecodeRequest(raw json.RawMessage) (any, error)

DecodeRequest decodes the outbound message expectation contract.

func (PlanOutboundHandler[C]) Invoke

func (PlanOutboundHandler[C]) Invoke(ctx context.Context, harness C, request any) (any, error)

Invoke stores the contract in the harness and activates the surveillance boundary.

func (PlanOutboundHandler[C]) NormalizeResponse

func (PlanOutboundHandler[C]) NormalizeResponse(response any) (any, error)

NormalizeResponse returns the response unchanged.

type PlanOutboundResponse

type PlanOutboundResponse struct {
	Topic         string `json:"topic"`
	ExpectedCount int    `json:"expected_count"`
	Planned       bool   `json:"planned"`
}

PlanOutboundResponse confirms that the wait was saved successfully.

type VerifyOutboundHandler

type VerifyOutboundHandler[C OutboundHarness] struct{}

VerifyOutboundHandler implements the verify step for final verification of the outbound publication.

func (VerifyOutboundHandler[C]) DecodeExpectedResponse

func (VerifyOutboundHandler[C]) DecodeExpectedResponse(raw json.RawMessage) (any, error)

DecodeExpectedResponse decodes the expected verify result.

func (VerifyOutboundHandler[C]) DecodeRequest

func (VerifyOutboundHandler[C]) DecodeRequest(raw json.RawMessage) (any, error)

DecodeRequest decodes an empty verify step request.

func (VerifyOutboundHandler[C]) Invoke

func (VerifyOutboundHandler[C]) Invoke(ctx context.Context, harness C, request any) (any, error)

Invoke runs the final verify check via the harness.

func (VerifyOutboundHandler[C]) NormalizeResponse

func (VerifyOutboundHandler[C]) NormalizeResponse(response any) (any, error)

NormalizeResponse returns the response unchanged.

Jump to

Keyboard shortcuts

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