Documentation
¶
Overview ¶
Package snaptest contains helper functions for mocking snaps.
Index ¶
- func BuildSquashfsSnap(sourceDir, targetDir string) (string, error)
- func MakeTestSnapWithFiles(c *check.C, snapYamlContent string, files [][]string) (snapFilePath string)
- func MockSnap(c *check.C, yamlText string, sideInfo *snap.SideInfo) *snap.Info
- func MockSnapWithHooks(c *check.C, yamlText string, sideInfo *snap.SideInfo, hookNames []string) *snap.Info
- func PopulateDir(dir string, files [][]string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildSquashfsSnap ¶
BuildSquashfsSnap the given sourceDirectory and return the generated snap file
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 MockSnap ¶
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 MockSnapWithHooks ¶
func MockSnapWithHooks(c *check.C, yamlText string, sideInfo *snap.SideInfo, hookNames []string) *snap.Info
MockSnapWithHooks puts a snap.yaml file on disk along with hooks 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 PopulateDir ¶
PopulateDir populates the directory with files specified as pairs of relative file path and its content. Useful to add extra files to a snap.
Types ¶
This section is empty.