fixtures

package
v0.0.0-...-b47b284 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: BSD-3-Clause Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// On the mount of the test dockerd's containerd: an install hardlinks the store's layers into it.
	AppStoreRoot       = "/var/lib/docker/reset-apps"
	AppComposeRootRoot = "/var/sota/compose-apps"
)

Variables

This section is empty.

Functions

func Check

func Check(t *testing.T, err error)

func Checkf

func Checkf(t *testing.T, err error, format string, args ...any)

func GenerateLayersMetaFile

func GenerateLayersMetaFile(t *testing.T, appsRootDir string) string

func NewTestConfig

func NewTestConfig(t *testing.T) *compose.Config

func PublishDerivedImage

func PublishDerivedImage(t *testing.T, base string, sizeMB int) string

PublishDerivedImage builds an image on top of base with one layer of sizeMB random bytes and pushes it to the test registry through the publisher dockerd, which the publish step reads the image layers from. It returns the image reference.

func PublishDerivedImageOfFiles

func PublishDerivedImageOfFiles(t *testing.T, base string, files int) string

PublishDerivedImageOfFiles is PublishDerivedImage with a layer of the given number of small files: its extraction takes a syscall per file, not a disk write, so it stays slow on a fast disk.

func RunCmd

func RunCmd(t *testing.T, args ...string) []byte

RunCmd runs composectl with the given arguments from the current directory and fails the test unless it exits 0. It returns the combined output.

func RunCmdExpectFail

func RunCmdExpectFail(t *testing.T, appDir string, args ...string) []byte

RunCmdExpectFail runs composectl with the given args and fails the test unless the command exits with a non-zero status. It returns the combined output so the caller can assert on the user-facing error message.

func RunCmdOffline

func RunCmdOffline(t *testing.T, args ...string) ([]byte, error)

RunCmdOffline runs composectl with the given args through an unreachable proxy, so every registry request fails. It returns the combined output and the command's error.

func WithAppBundleIndexes

func WithAppBundleIndexes(enableAppBundleIndexes bool) func(opts *PublishOpts)

func WithLayersManifest

func WithLayersManifest(addLayerManifest bool) func(opts *PublishOpts)

func WithRegistry

func WithRegistry(registry string) func(opts *PublishOpts)

Types

type App

type App struct {
	Name         string
	PublishedUri string
	Dir          string
}

func NewApp

func NewApp(t *testing.T, composeDef string, name ...string) *App

func (*App) CheckFetched

func (a *App) CheckFetched(t *testing.T)

func (*App) CheckInstalled

func (a *App) CheckInstalled(t *testing.T)

func (*App) CheckRunning

func (a *App) CheckRunning(t *testing.T)

func (*App) GetAppImageManifest

func (a *App) GetAppImageManifest(t *testing.T, image string) (imageManifest ocischema.Manifest)

func (*App) GetAppImages

func (a *App) GetAppImages(t *testing.T) []string

func (*App) GetAppImagesFromAppStore

func (a *App) GetAppImagesFromAppStore(t *testing.T) []string

func (*App) GetInstallCheckRes

func (a *App) GetInstallCheckRes(t *testing.T) (checkRes *composectl.AppInstallCheckResult)

func (*App) GetRunningStatus

func (a *App) GetRunningStatus(t *testing.T) (appStatus *composectl.App)

func (*App) Install

func (a *App) Install(t *testing.T)

func (*App) Publish

func (a *App) Publish(t *testing.T, publishOpts ...func(*PublishOpts))

func (*App) Pull

func (a *App) Pull(t *testing.T)

func (*App) PullAppImagesWithSkopeo

func (a *App) PullAppImagesWithSkopeo(t *testing.T)

func (*App) PullWithWorkers

func (a *App) PullWithWorkers(t *testing.T, workers int)

func (*App) Remove

func (a *App) Remove(t *testing.T)

func (*App) Run

func (a *App) Run(t *testing.T)

func (*App) Stop

func (a *App) Stop(t *testing.T)

func (*App) Uninstall

func (a *App) Uninstall(t *testing.T)

func (*App) Up

func (a *App) Up(t *testing.T)

type PublishOpts

type PublishOpts struct {
	PublishLayersManifest   bool
	PublishLayersMetaFile   bool
	Registry                string
	PublishAppBundleIndexes bool
}

Jump to

Keyboard shortcuts

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