testclient

package
v0.0.0-...-89e479d Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testclient will contain OpenAPI-backed test-client workflows for exercising dkim2d through its public HTTP contract.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DurationBucket

func DurationBucket(duration time.Duration) string

DurationBucket returns a bounded nonnumeric diagnostic class.

func ErrorWasReported

func ErrorWasReported(err error) bool

ErrorWasReported reports whether JSONL output already represents the failure.

func HasExitClass

func HasExitClass(err error) bool

HasExitClass reports whether an error originated from the stable class boundary.

func NewExitError

func NewExitError(class ExitClass) error

NewExitError constructs a content-free classified error.

func ParseServerURL

func ParseServerURL(raw string) (*url.URL, error)

ParseServerURL accepts only one canonical loopback HTTP authority.

func WriteFailure

func WriteFailure(output io.Writer, class ExitClass) error

WriteFailure emits one content-free command-level failure record.

Types

type Application

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

Application owns one command invocation and its deterministic output.

func NewApplication

func NewApplication(output io.Writer) *Application

NewApplication constructs one command-scoped test client application.

func (*Application) Run

func (a *Application) Run(options Options, paths []string) error

Run executes one completely validated deterministic fixture plan.

func (*Application) Smoke

func (a *Application) Smoke(options Options, expectReady bool) error

Smoke performs the generated health and readiness checks.

func (*Application) Validate

func (a *Application) Validate(_ Options, paths []string) error

Validate validates all fixture documents without protected or network access.

type Capability

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

Capability owns one exact local process capability until Close.

func LoadCapability

func LoadCapability(path string) (*Capability, error)

LoadCapability opens and validates one protected capability through one descriptor.

func LoadCapabilityForOperation

func LoadCapabilityForOperation(path string, operation Operation) (*Capability, error)

LoadCapabilityForOperation binds protected bytes to exactly one generated route.

func (*Capability) Close

func (c *Capability) Close() error

Close zeroes the owned array and rejects later request editing.

func (*Capability) EditRequest

func (c *Capability) EditRequest(_ context.Context, request *http.Request) error

EditRequest attaches the capability to exactly one otherwise-uncredentialed request.

func (*Capability) Format

func (c *Capability) Format(state fmt.State, _ rune)

Format makes every fmt verb content-free.

func (*Capability) GoString

func (c *Capability) GoString() string

GoString returns a content-free Go-syntax diagnostic representation.

func (*Capability) String

func (c *Capability) String() string

String returns a content-free diagnostic representation.

type ExecutionPlan

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

ExecutionPlan is one immutable deterministic set of validated cases.

func LoadExecutionPlan

func LoadExecutionPlan(paths []string) (ExecutionPlan, error)

LoadExecutionPlan validates every path and document before returning a plan.

func (ExecutionPlan) FixtureIdentifiers

func (p ExecutionPlan) FixtureIdentifiers() []string

FixtureIdentifiers returns a defensive copy of deterministic fixture IDs.

type ExitClass

type ExitClass uint8

ExitClass is the stable process exit status for one closed failure class.

const (
	// ExitOK reports that every requested case matched.
	ExitOK ExitClass = 0
	// ExitUsage reports command shape or flag validation failure.
	ExitUsage ExitClass = 2
	// ExitFixture reports fixture loading or validation failure.
	ExitFixture ExitClass = 3
	// ExitCapability reports protected capability loading failure.
	ExitCapability ExitClass = 4
	// ExitTransport reports local transport or deadline failure.
	ExitTransport ExitClass = 5
	// ExitContract reports malformed or unsupported response contracts.
	ExitContract ExitClass = 6
	// ExitMismatch reports a valid response that did not match expectations.
	ExitMismatch ExitClass = 7
	// ExitInternal reports an internal invariant failure.
	ExitInternal ExitClass = 8
)

func ExitClassOf

func ExitClassOf(err error) ExitClass

ExitClassOf returns the stable class or the internal class for unknown errors.

func (ExitClass) String

func (c ExitClass) String() string

String returns the canonical decimal exit class.

func (ExitClass) ValidFailure

func (c ExitClass) ValidFailure() bool

ValidFailure reports whether the class is one of the declared nonzero exits.

type Operation

type Operation string

Operation is the closed generated-client operation vocabulary.

const (
	// OperationHealth identifies the generated liveness call.
	OperationHealth Operation = "health"
	// OperationReadiness identifies the generated readiness call.
	OperationReadiness Operation = "readiness"
	// OperationProcess identifies the generated inbound process call.
	OperationProcess Operation = "process"
	// OperationSign identifies the generated originator-signing call.
	OperationSign Operation = "sign"
	// OperationRevise identifies the generated ordinary-transit revision call.
	OperationRevise Operation = "revise"
	// OperationDSNSign identifies the dedicated delivery-status signing call.
	OperationDSNSign Operation = "sign_dsn"
	// OperationDSNPropagate identifies the delivery-status propagation call.
	OperationDSNPropagate Operation = "propagate_dsn"
	// OperationDSNPropagateCommit identifies the propagation-coordinate commit call.
	OperationDSNPropagateCommit Operation = "commit_dsn_propagation"
)

type Options

type Options struct {
	ServerURL                  string
	Timeout                    time.Duration
	CapabilityFile             string
	SignCapabilityFile         string
	ReviseCapabilityFile       string
	DSNSignCapabilityFile      string
	DSNPropagateCapabilityFile string
	Output                     string
}

Options owns the validated command-wide authority and resource bounds.

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns the closed local-only command defaults.

func (Options) Validate

func (o Options) Validate(requireCapability bool) error

Validate checks all command options before protected-file or network access.

type ResponseFact

type ResponseFact struct {
	Operation Operation
	Status    int
	Health    *generated.HealthResponse
	Readiness *generated.ReadinessResponse
	Process   *generated.ProcessResponse
	Sign      *generated.OperationResponse
	Revise    *generated.OperationResponse
	DSNSign   *generated.OperationResponse
	// DSNPropagate holds the route-specific propagation response.
	DSNPropagate *generated.DSNPropagateResponse
	// DSNCommit holds the propagation-coordinate commit response.
	DSNCommit *generated.DSNPropagateCommitResponse
	Error     *generated.ErrorResponse
}

ResponseFact is the bounded typed result of one generated operation.

type ResultDeliveryStatus

type ResultDeliveryStatus struct {
	Structure        string `json:"structure"`
	Embedded         string `json:"embedded"`
	OuterAlignment   string `json:"outer_alignment"`
	RecipientLinkage string `json:"recipient_linkage"`
	LocalHop         string `json:"local_hop"`
	Propagation      string `json:"propagation"`
}

ResultDeliveryStatus is the stable closed projection of the received delivery-status evaluation. Every member is a closed vocabulary value; no address, message byte, or identifier enters this record.

type ResultRecord

type ResultRecord struct {
	Schema              string  `json:"schema"`
	Draft               string  `json:"draft"`
	Fixture             *string `json:"fixture"`
	Case                *string `json:"case"`
	Operation           *string `json:"operation"`
	Outcome             string  `json:"outcome"`
	HTTPStatus          *int    `json:"http_status"`
	ErrorClass          *string `json:"error_class"`
	DurationBucket      *string `json:"duration_bucket"`
	Disposition         *string `json:"disposition"`
	VerificationState   *string `json:"verification_state"`
	AuthenticationState *string `json:"authentication_state"`
	PolicyVerdict       *string `json:"policy_verdict"`
	ReplayClass         *string `json:"replay_class"`
	// PropagationResult is the closed propagation-route operation result.
	PropagationResult *string `json:"propagation_result"`
	// PropagationDisposition is the closed propagation-route disposition.
	PropagationDisposition *string `json:"propagation_disposition"`
	// PropagationFailure is the closed permanent propagation failure reason.
	PropagationFailure *string `json:"propagation_failure"`
	// PropagationState is the closed committed-coordinate state.
	PropagationState *string `json:"propagation_state"`
	// PropagationDigest is the lowercase hexadecimal SHA-256 of the signed
	// notification. The notification bytes themselves never reach the output.
	PropagationDigest *string `json:"propagation_digest"`
	// DeliveryStatus is the closed received delivery-status projection.
	DeliveryStatus *ResultDeliveryStatus `json:"delivery_status"`
}

ResultRecord is the exact stable JSONL projection for one executed case.

type Runtime

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

Runtime owns one generated client and one bounded local HTTP transport.

func NewRuntime

func NewRuntime(options Options) (*Runtime, error)

NewRuntime constructs a generated client over one bounded loopback transport.

func NewRuntimeWithDoer

func NewRuntimeWithDoer(serverURL string, doer generated.HttpRequestDoer) (*Runtime, error)

NewRuntimeWithDoer constructs a generated boundary for deterministic transport tests.

func (*Runtime) CallDSNPropagate

func (r *Runtime) CallDSNPropagate(
	ctx context.Context,
	request generated.DSNPropagateRequest,
	editor generated.RequestEditorFn,
) (ResponseFact, error)

CallDSNPropagate executes and strictly classifies delivery-status propagation.

func (*Runtime) CallDSNPropagateCommit

func (r *Runtime) CallDSNPropagateCommit(
	ctx context.Context,
	request generated.DSNPropagateCommitRequest,
	editor generated.RequestEditorFn,
) (ResponseFact, error)

CallDSNPropagateCommit executes and strictly classifies the coordinate commit.

func (*Runtime) CallDSNSign

func (r *Runtime) CallDSNSign(
	ctx context.Context,
	request generated.DSNSignRequest,
	editor generated.RequestEditorFn,
) (ResponseFact, error)

CallDSNSign executes and strictly classifies dedicated delivery-status signing.

func (*Runtime) CallHealth

func (r *Runtime) CallHealth(ctx context.Context) (ResponseFact, error)

CallHealth executes and strictly classifies the generated health operation.

func (*Runtime) CallNegative

func (r *Runtime) CallNegative(
	ctx context.Context,
	mutation string,
	capability *Capability,
) (ResponseFact, error)

CallNegative executes one closed raw-contract mutation.

func (*Runtime) CallNegativeOperation

func (r *Runtime) CallNegativeOperation(
	ctx context.Context,
	operation Operation,
	mutation string,
	capability *Capability,
) (ResponseFact, error)

CallNegativeOperation executes one closed raw mutation on one declared route.

func (*Runtime) CallProcess

func (r *Runtime) CallProcess(
	ctx context.Context,
	request generated.ProcessRequest,
	editor generated.RequestEditorFn,
) (ResponseFact, error)

CallProcess executes and strictly classifies the generated authenticated process operation.

func (*Runtime) CallReadiness

func (r *Runtime) CallReadiness(ctx context.Context) (ResponseFact, error)

CallReadiness executes and strictly classifies the generated readiness operation.

func (*Runtime) CallRevise

func (r *Runtime) CallRevise(
	ctx context.Context,
	request generated.ReviseRequest,
	editor generated.RequestEditorFn,
) (ResponseFact, error)

CallRevise executes and strictly classifies the generated revision operation.

func (*Runtime) CallSign

func (r *Runtime) CallSign(
	ctx context.Context,
	request generated.SignRequest,
	editor generated.RequestEditorFn,
) (ResponseFact, error)

CallSign executes and strictly classifies the generated originator operation.

func (*Runtime) Close

func (r *Runtime) Close() error

Close releases transport-owned idle resources.

Directories

Path Synopsis
Package generated provides primitives to interact with the openapi HTTP API.
Package generated provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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