stubbackend

package
v19.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package stubbackend stands in for the external systems the real built-in AutoFlow modules talk to, inside the process that runs them: an HTTP server in place of the GitLab REST API and a counting sink in place of the events platform. Both answer deterministically, so a generated flow that calls a real module has a known outcome without a GitLab or an events platform anywhere near the run.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Publisher

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

Publisher accepts every event, counts it and drops it. The zero value is ready to use.

It stands in for the events platform, which the event module refuses to load without: a run that needs emit to happen does not need the events to be readable afterwards, only countable.

func (*Publisher) Publish

func (p *Publisher) Publish(_ context.Context, _ string, events ...*pkg_event.CloudEvent) ([]string, error)

Publish accepts every event, answering with the running publish count as each event's id, which is unique within the process.

func (*Publisher) Published

func (p *Publisher) Published() int64

Published counts the events published, so a caller can tell that emit reached the sink at all.

type Server

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

Server answers every request with a deterministic response.

func Start

func Start(ctx context.Context, log *slog.Logger) (*Server, error)

Start listens on a loopback port and serves until Close; ctx bounds taking the port, not the server's life. log carries a serve error, which is the one failure a caller cannot be handed by Start.

func (*Server) Close

func (s *Server) Close()

Close stops serving and waits for the serving goroutine.

func (*Server) Requests

func (s *Server) Requests() int64

Requests counts the requests served, so a caller can tell that traffic reached the stub at all.

func (*Server) URL

func (s *Server) URL() *url.URL

URL is the backend URL to point a GitLab client at.

Jump to

Keyboard shortcuts

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