edgetest

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package edgetest stages what an edge-channel upgrade touches, for tests (Task 20376): a device installed as `cloop executor agent install` would install it — unit, drop-ins, remote-upgrade helper, binary — under a temp directory, and an edge release served over HTTP whose assets a stand-in cosign (internal/cosigntest) will accept or refuse by signer.

The binaries are shell scripts that answer `cloop version` the way a real build does, so the installer's identify-before-replace check runs for real.

Index

Constants

View Source
const DefaultSequence = 4000

DefaultSequence is the place on main Publish gives a build.

Variables

This section is empty.

Functions

func FakeCloop

func FakeCloop(version string, protocol int, marker string) string

FakeCloop is a stand-in cloop binary reporting version and protocol, with a marker a test can read back to tell which one is installed. It reports no commit and no sequence: a build from before builds were stamped with their place on main (Task 20380).

func FakeCloopAt

func FakeCloopAt(version string, protocol int, commit string, sequence int, marker string) string

FakeCloopAt is FakeCloop stamped with a commit and its place on main, as scripts/build-release.sh stamps every build since Task 20380. A zero sequence and an empty commit are left out of the report, as a real build leaves them out.

func Marker

func Marker(body string) string

Marker reads back what FakeCloop embedded.

func Recorder

func Recorder() (*install.Installer, func() []string)

Recorder is an Installer that records the commands it would run and reports the service active, so an upgrade restarts and settles.

func TarGz

func TarGz(t testing.TB, binary string) []byte

TarGz packs a "cloop" file the way scripts/build-release.sh does.

Types

type Build

type Build struct {
	Commit   string
	SAN      string
	Protocol int
	// Sequence is the commit's place on main. Zero publishes a build from
	// before Task 20380: a schema-1 manifest, and a binary carrying none.
	Sequence int
	Marker   string
	// Binary, when set, is the archived binary instead of the stand-in the
	// manifest describes — a validly signed manifest paired with the bytes
	// of another build.
	Binary string
}

Build is one edge build to publish.

type Device

type Device struct {
	Spec install.Spec
}

Device is a staged install.

func NewDevice

func NewDevice(t testing.TB, installedVersion string, protocol int, channel provenance.Channel) *Device

NewDevice stages an install running installedVersion at protocol, on channel, with the packet-filter grant and the remote-upgrade helper. Its binary carries no sequence; InstallBuild replaces it with one that does.

func (*Device) InstallBuild

func (d *Device) InstallBuild(t testing.TB, body string)

InstallBuild puts a binary in place as if the device ran body — for a device whose installed build is stamped (FakeCloopAt).

func (*Device) Installed

func (d *Device) Installed(t testing.TB) (current, previous string)

Installed reads the marker of the binary in place, and of the one kept for rollback ("" when there is none).

func (*Device) Target

func (d *Device) Target() (install.Spec, install.Output, error)

Target answers agent.Config.InstallTarget.

type Release

type Release struct {
	URL string
	// contains filtered or unexported fields
}

Release is a stand-in for the edge release's download endpoint.

func NewRelease

func NewRelease(t testing.TB) *Release

NewRelease serves an empty edge release.

func (*Release) Options

func (r *Release) Options(t testing.TB) upgrade.Options

Options are the staging options that fetch from this release and verify with the stand-in cosign.

func (*Release) Publish

func (r *Release) Publish(t testing.TB, commit, san string, protocol int, marker string) upgrade.EdgeManifest

Publish puts commit's build up, every asset signed by san, its binary a FakeCloopAt reporting the edge version at protocol, stamped with commit and DefaultSequence, with the given marker.

func (*Release) PublishBuild

func (r *Release) PublishBuild(t testing.TB, b Build) upgrade.EdgeManifest

PublishBuild puts b up, every asset signed by b.SAN.

Jump to

Keyboard shortcuts

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