shillscript

package
v0.0.0-...-9474aff Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package shillscript has helper functions and the dbus monitor implementation for the shill init scripts tests.

Index

Constants

View Source
const (
	FakeUser                   = chrome.DefaultUser
	GuestUser                  = cryptohome.GuestUser
	CryptohomePathCommand      = "/usr/sbin/cryptohome-path"
	DaemonStoreBase            = "/run/daemon-store/shill"
	ShillUserProfilesDir       = "/run/shill/user_profiles"
	ShillUserProfileChronosDir = "/run/shill/user_profiles/chronos"
	ChronosProfileName         = "~chronos/shill"
	ExpectedProfileName        = "/profile/chronos/shill"
	DbusMonitorTimeout         = 30 * time.Second
	CreateUserProfile          = "CreateProfile"
	InsertUserProfile          = "InsertUserProfile"
	PopAllUserProfiles         = "PopAllUserProfiles"
)

The FakeUser/GuestUser are used to simulate a regular/guest user login.

Variables

This section is empty.

Functions

func AssureExists

func AssureExists(path string) error

AssureExists asserts that path exists.

func AssureIsDir

func AssureIsDir(path string) error

AssureIsDir asserts that path is a directory.

func AssureIsLink(path string) error

AssureIsLink asserts that path is a symbolic link.

func AssureIsLinkTo

func AssureIsLinkTo(path, pointee string) error

AssureIsLinkTo asserts that path is a symbolic link to pointee.

func AssureMethodCalls

func AssureMethodCalls(ctx context.Context, expectedMethodCalls []string, calledMethods []dbusutil.CalledMethod) error

AssureMethodCalls assure that the expected methods are called.

func AssureNotExists

func AssureNotExists(path string) error

AssureNotExists asserts that path doesn't exist.

func AssurePathGroup

func AssurePathGroup(path, group string) error

AssurePathGroup asserts that path is owned by group.

func AssurePathOwner

func AssurePathOwner(path, owner string) error

AssurePathOwner asserts that path is owned by owner.

func CreateFileWithContents

func CreateFileWithContents(fileName, contents string) error

CreateFileWithContents creates a file named |filename| that contains contents.

func DbusEventMonitor

func DbusEventMonitor(ctx context.Context) (func() ([]dbusutil.CalledMethod, error), error)

DbusEventMonitor monitors the system message bus for those D-Bus calls we want to observe (InsertUserProfile, PopAllUserProfiles, CreateUserProfile). It returns a stop function and error. The stop function stops the D-Bus monitor and return the called methods and/or error.

func GetProfileList

func GetProfileList(ctx context.Context) ([]*shill.Profile, error)

GetProfileList return the profiles in the profile stack.

func RunTest

func RunTest(ctx context.Context, fn testFuncType, isGuest bool) error

RunTest runs the test, stops shill and erases the state.

func Touch

func Touch(filename string) error

Touch creates an empty file named filename.

Types

type TestEnv

type TestEnv struct {
	ShillUserProfileDir string
	ShillUserProfile    string
	CreatedDirectories  []string
}

TestEnv struct has the variables that are used by the functions below.

Jump to

Keyboard shortcuts

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