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
- func Driver(t testing.TB, driver string, v DriverVars) string
- func Fake(t testing.TB, dir, name, body string)
- func Flow(t testing.TB, dir, bootID string)
- func Install(t testing.TB, dir string, now int64)
- func Paths(code string, v PathVars) string
- func Restarted(t testing.TB, dir, bootID string)
- func Write(t testing.TB, dir, rel, content string)
- type DriverVars
- type PathVars
Constants ¶
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 Flow ¶
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 ¶
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 ¶
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.
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.