snaptest

package
v2.42.5-go-mod+incompa... Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package snaptest contains helper functions for mocking snaps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeTestSnapWithFiles

func MakeTestSnapWithFiles(c *check.C, snapYamlContent string, files [][]string) (snapFilePath string)

MakeTestSnapWithFiles makes a squashfs snap file with the given snap.yaml content and optional extras files specified as pairs of relative file path and its content.

func MockInfo

func MockInfo(c *check.C, yamlText string, sideInfo *snap.SideInfo) *snap.Info

MockInfo parses the given snap.yaml text and returns a validated snap.Info object including the optional SideInfo.

The result is just kept in memory, there is nothing kept on disk. If that is desired please use MockSnap instead.

func MockInvalidInfo

func MockInvalidInfo(c *check.C, yamlText string, sideInfo *snap.SideInfo) *snap.Info

MockInvalidInfo parses the given snap.yaml text and returns the snap.Info object including the optional SideInfo.

The result is just kept in memory, there is nothing kept on disk. If that is desired please use MockSnap instead.

func MockSnap

func MockSnap(c *check.C, yamlText string, sideInfo *snap.SideInfo) *snap.Info

MockSnap puts a snap.yaml file on disk so to mock an installed snap, based on the provided arguments.

The caller is responsible for mocking root directory with dirs.SetRootDir() and for altering the overlord state if required.

func MockSnapCurrent

func MockSnapCurrent(c *check.C, yamlText string, sideInfo *snap.SideInfo) *snap.Info

MockSnapCurrent does the same as MockSnap but additionally creates the 'current' symlink.

The caller is responsible for mocking root directory with dirs.SetRootDir() and for altering the overlord state if required.

func MockSnapInstance

func MockSnapInstance(c *check.C, instanceName, yamlText string, sideInfo *snap.SideInfo) *snap.Info

MockSnapInstance puts a snap.yaml file on disk so to mock an installed snap instance, based on the provided arguments.

The caller is responsible for mocking root directory with dirs.SetRootDir() and for altering the overlord state if required.

func MockSnapInstanceCurrent

func MockSnapInstanceCurrent(c *check.C, instanceName, yamlText string, sideInfo *snap.SideInfo) *snap.Info

MockSnapInstanceCurrent does the same as MockSnapInstance but additionally creates the 'current' symlink.

The caller is responsible for mocking root directory with dirs.SetRootDir() and for altering the overlord state if required.

func MockSnapWithFiles

func MockSnapWithFiles(c *check.C, yamlText string, si *snap.SideInfo, files [][]string) *snap.Info

MockSnapWithFiles does the same as MockSnap, but also populates the snap directory with given content

The caller is responsible for mocking root directory with dirs.SetRootDir() and for altering the overlord state if required.

func MustParseChannel

func MustParseChannel(s string, architecture string) channel.Channel

MustParseChannel parses a string representing a store channel and includes the given architecture, if architecture is "" the system architecture is included. It panics on error.

func PopulateDir

func PopulateDir(dir string, files [][]string)

PopulateDir populates the directory with files specified as pairs of relative file path and its content. Useful to add extra files to a snap.

func RenameSlot

func RenameSlot(snapInfo *snap.Info, oldName, newName string) error

RenameSlot renames gives an existing slot a new name.

The new slot name cannot clash with an existing plug or slot and must be a valid slot name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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