smoke

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package smoke runs an end-to-end check of an OpenArch server: it creates a document, reads it, finds it with a query, and deletes it.

Index

Constants

View Source
const (
	Pass = "pass"
	Fail = "fail"
	Skip = "skip"
)

Step results.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	Ping(ctx context.Context) (api.PingResult, error)
	CreateDocument(ctx context.Context, parent string, body []byte) (api.Document, error)
	GetDocument(ctx context.Context, ref string) (api.Document, error)
	Query(ctx context.Context, o api.QueryOptions) (api.QueryResult, error)
	DeleteDocument(ctx context.Context, id string) error
}

API is the part of the API client that the smoke test uses.

type Options

type Options struct {
	URL string
	// IndexTimeout is how long to wait for the background search index.
	IndexTimeout time.Duration
	// PollInterval is the wait between two index checks.
	PollInterval time.Duration
}

Options are the inputs of Run.

type Report

type Report struct {
	URL      string  `json:"url"`
	Version  string  `json:"version,omitempty"`
	Document string  `json:"document,omitempty"`
	Steps    []Step  `json:"steps"`
	Summary  Summary `json:"summary"`
	// contains filtered or unexported fields
}

Report is the result of a run.

func Run

func Run(ctx context.Context, c API, o Options) Report

Run executes the steps. A step that depends on a failed step is skipped. The test document is always deleted when it was created.

func (Report) AuthFailed

func (r Report) AuthFailed() bool

AuthFailed reports whether the run stopped because the credentials were rejected.

func (Report) Passed

func (r Report) Passed() bool

Passed reports whether every step passed.

func (Report) WriteText

func (r Report) WriteText(w io.Writer) error

WriteText writes the human-readable form.

type Step

type Step struct {
	ID         string `json:"id"`
	Title      string `json:"title"`
	Status     string `json:"status"`
	Message    string `json:"message"`
	DurationMs int64  `json:"durationMs"`
}

Step is the result of one step.

type Summary

type Summary struct {
	Pass int `json:"pass"`
	Fail int `json:"fail"`
	Skip int `json:"skip"`
}

Summary counts the steps by result.

Jump to

Keyboard shortcuts

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