it

package module
v0.0.0-...-ac398fe Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultStartupTimeout is the maximum time to wait for all services to become healthy.
	DefaultStartupTimeout = 120 * time.Second

	// HealthCheckInterval is how often to poll service health endpoints.
	HealthCheckInterval = 2 * time.Second
)
View Source
const (
	// GatewayControllerPort is the management REST API port.
	GatewayControllerPort = "9090"

	// EventGatewayAdminPort is the admin/health port of the event-gateway runtime.
	EventGatewayAdminPort = "9002"

	// WebSubPort is the HTTP WebSub listener port.
	WebSubPort = "8080"

	// WebSocketPort is the WebSocket listener port.
	WebSocketPort = "8081"

	// WebhookListenerPort is the port of the wh-listener test service.
	WebhookListenerPort = "8090"

	// GatewayManagementAPIBasePath is the base path for the management REST API.
	GatewayManagementAPIBasePath = "/api/management/v1"
)

Port constants for event gateway services.

Variables

This section is empty.

Functions

func CheckDockerAvailable

func CheckDockerAvailable() error

CheckDockerAvailable verifies that Docker is running.

func CheckPortsAvailable

func CheckPortsAvailable() error

CheckPortsAvailable verifies that the ports used by the test stack are free.

func RegisterCommonSteps

func RegisterCommonSteps(ctx *godog.ScenarioContext, state *TestState)

RegisterCommonSteps registers generic HTTP assertion and utility steps.

func RegisterHealthSteps

func RegisterHealthSteps(ctx *godog.ScenarioContext, state *TestState)

RegisterHealthSteps registers health / readiness step definitions.

func RegisterWebBrokerSteps

func RegisterWebBrokerSteps(ctx *godog.ScenarioContext, state *TestState)

RegisterWebBrokerSteps registers all WebBroker API management and end-to-end step definitions.

func RegisterWebSubSteps

func RegisterWebSubSteps(ctx *godog.ScenarioContext, state *TestState)

RegisterWebSubSteps registers all WebSub API management and end-to-end step definitions.

func RegisterWebhookSecretSteps

func RegisterWebhookSecretSteps(ctx *godog.ScenarioContext, state *TestState, ws *WebhookSecretSteps)

RegisterWebhookSecretSteps registers all webhook secret management step definitions.

Types

type AuthUser

type AuthUser struct {
	Username string
	Password string
}

AuthUser holds credentials for a test user.

type ComposeManager

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

ComposeManager manages the Docker Compose lifecycle for integration tests.

func NewComposeManager

func NewComposeManager(composeFile string) (*ComposeManager, error)

NewComposeManager creates a new ComposeManager from the given docker-compose file path.

func (*ComposeManager) Cleanup

func (cm *ComposeManager) Cleanup()

Cleanup stops and removes all Docker Compose services. Safe to call multiple times and from concurrent goroutines.

func (*ComposeManager) DumpLogs

func (cm *ComposeManager) DumpLogs(outputFile string) error

DumpLogs writes docker compose logs to the given file.

func (*ComposeManager) Start

func (cm *ComposeManager) Start() error

Start brings up all Docker Compose services and waits for them to be healthy.

func (*ComposeManager) WaitForHealthy

func (cm *ComposeManager) WaitForHealthy(ctx context.Context) error

WaitForHealthy polls the health endpoints of each service until all pass.

type Config

type Config struct {
	GatewayControllerURL string
	EventGatewayAdminURL string
	WebSubURL            string
	WebSocketURL         string
	WebhookListenerURL   string
	KafkaBrokers         []string
	KafkaUsername        string
	KafkaPassword        string
	HTTPTimeout          time.Duration
	Users                map[string]AuthUser
}

Config holds the addresses and settings used across all test scenarios.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default test configuration assuming services are mapped to localhost ports via docker-compose.dev.yaml.

type TestState

type TestState struct {
	Config     *Config
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

TestState is the global state shared across step definitions within a scenario.

func NewTestState

func NewTestState(cfg *Config) *TestState

NewTestState creates and returns an initialised TestState.

func (*TestState) LastBody

func (s *TestState) LastBody() []byte

LastBody returns the body bytes of the most recent HTTP response.

func (*TestState) LastResponse

func (s *TestState) LastResponse() *http.Response

LastResponse returns the most recent HTTP response.

func (*TestState) Reset

func (s *TestState) Reset()

Reset clears per-scenario state.

func (*TestState) SetHeader

func (s *TestState) SetHeader(key, value string)

SetHeader sets a request header that will be included in subsequent requests.

type WebhookSecretSteps

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

WebhookSecretSteps holds per-scenario state for webhook secret step definitions.

func (*WebhookSecretSteps) Reset

func (w *WebhookSecretSteps) Reset()

Reset clears per-scenario webhook secret state.

Jump to

Keyboard shortcuts

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