fixture

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 18 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 fixture builds sampleapp as v1 and v2, installs v1 and serves v2, for the suites that exercise real binaries. Test-only: it imports testing and httptest, which is why it is not part of testkit, which production code imports for its kill hooks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSampleApp

func BuildSampleApp(t *testing.T, out, version, behaviour string) []byte

BuildSampleApp builds testdata/sampleapp with the otatest tag and returns its bytes.

func ModuleRoot

func ModuleRoot(t *testing.T) string

ModuleRoot is the ota module directory, found by walking up from the test's working directory.

Types

type Fixture

type Fixture struct {
	T      *testing.T
	Bin    string
	V1, V2 []byte
	Marker string
	Env    []string
	Store  *server.MemStore
}

Fixture is sampleapp v1 installed, and v2 offered by a real server.

func NewFixture

func NewFixture(t *testing.T, v2behaviour string, signWith stded.PrivateKey) *Fixture

NewFixture builds v1 and v2, installs v1, and serves an offer for v2 signed by signWith (a fresh trusted key when nil).

func (*Fixture) Command

func (f *Fixture) Command(args ...string) *exec.Cmd

Command returns an exec.Cmd for the installed binary with the fixture env.

func (*Fixture) Installed

func (f *Fixture) Installed() []byte

Installed returns the bytes at the install path.

func (*Fixture) Lines

func (f *Fixture) Lines() string

Lines returns the marker file.

func (*Fixture) WaitFor

func (f *Fixture) WaitFor(s string, timeout time.Duration) bool

WaitFor polls the marker file until it contains s.

func (*Fixture) WaitForCount

func (f *Fixture) WaitForCount(s string, n int, timeout time.Duration) bool

WaitForCount polls the marker file until s appears at least n times.

Jump to

Keyboard shortcuts

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