boxtest

package
v0.4.91 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 5 Imported by: ? 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 boxtest is the machine that the tests of the blocks of the upgrade run them on: a folder with the commands of a Debian 11 box replaced by small ones that answer what a test says (they are first in the PATH of the shell), the files that the blocks read at the places the folder gives them, and the way to point the text of a block at them. The suites that run the blocks (pkg/osplan) and the one that runs a whole upgrade through the core (service) have one machine, and this is it.

It is for tests only: nothing in the product imports it.

Index

Constants

View Source
const Converged = "Reading package lists...\n0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.\n"

Converged is what the stub of apt-get says of a simulation that has nothing left to do.

Variables

This section is empty.

Functions

func Driver

func Driver(t testing.TB, driver string, v DriverVars) string

Driver is the text of the driver with the paths of the machine that it names pointed at the box.

func Fake

func Fake(t testing.TB, dir, name, body string)

Fake makes a command of the box: a shell script, first in the PATH of the blocks.

func Flow

func Flow(t testing.TB, dir, bootID string)

Flow makes the machine that the nine blocks of a hop go through one after the other, on top of Install: two of the three timers running, the files that blocks 2 to 8 read, a kernel to start with, room, and a boot (bootID). The sources of apt and the simulations of the full upgrade are the plan's, and the test gives them.

func Install

func Install(t testing.TB, dir string, now int64)

Install makes the machine in dir: Debian 11 until a test says otherwise, with every command that a block of the hop or of the refresh runs, and room. now is the clock that the stub of date gives (seconds since the epoch), which is the time of the plan, an hour later.

func Paths

func Paths(code string, v PathVars) string

Paths points the paths of the machine that a block names at the box. The text is the block's own but for those, and nothing else of it is changed.

func Restarted

func Restarted(t testing.TB, dir, bootID string)

Restarted makes the machine the one after its restart: another boot, Debian 12, the kernel that block 7 looked at.

func Write

func Write(t testing.TB, dir, rel, content string)

Write writes a file of the box, under dir, making the folders of it.

Types

type DriverVars

type DriverVars struct {
	// Root is the folder whose bin comes first in the PATH of the driver and whose bootid is the boot id that it reads, and where the state of the timers is (timers.state).
	Root string
	// BKCase and RefreshCase are the case patterns that stand where the driver has /var/backups/casaos-os-upgrade-* and /var/backups/casaos-os-upgrade-refresh-*.
	BKCase, RefreshCase string
}

DriverVars say where the driver's own words point in the box.

type PathVars

type PathVars struct {
	// PlanID is the plan whose backup folder the blocks name (BK=/var/backups/casaos-os-upgrade-<PlanID>); for a refresh, the folder is named by BKFrom.
	PlanID string
	// BKFrom is the line that the block has for its backup folder, if it is not the plan's: "BK=/var/backups/casaos-os-upgrade-refresh-<run id>".
	BKFrom string
	// BK is the folder it points at: "./bk" in the box, or an absolute path where the core reads the same folder.
	BK string
	// TimersState is the file that holds the state of the timers, as the text names it.
	TimersState string
	// Cgroup is the file that the gate of an auto block reads in place of /proc/self/cgroup, when the text was written with the core's own words for it (the core gives no file); a test
	// that writes the text with a file of its own leaves it empty.
	Cgroup string
}

PathVars say where a block's own words point in the box.

Jump to

Keyboard shortcuts

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