testutils

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package testutils contains several helpers and assertions for our unit, package or integration tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chmod

func Chmod(t *testing.T, dest string, mode os.FileMode)

Chmod applies the given mode to dest and restores permissions on cleanup.

func CompareTreesWithFiltering

func CompareTreesWithFiltering(t *testing.T, p, goldPath string, update bool)

CompareTreesWithFiltering allows comparing a goldPath directory to p. Those can be updated via the dedicated flag.

func GoldenPath

func GoldenPath(t *testing.T) string

GoldenPath returns the golden path for the provided test.

func InstallUpdateFlag

func InstallUpdateFlag()

InstallUpdateFlag install an update flag referenced in this package. The flags need to be parsed before running the tests.

func MakeReadOnly

func MakeReadOnly(t *testing.T, dest string)

MakeReadOnly makes dest read only and restore permission on cleanup.

func NewDbusConn

func NewDbusConn(t *testing.T) *dbus.Conn

NewDbusConn returns a system dbus connection which automatically close on test shutdown.

func NormalizeGoldenName

func NormalizeGoldenName(t *testing.T, name string) string

NormalizeGoldenName returns the name of the golden file with illegal Windows characters replaced or removed.

func StartLocalSystemBus

func StartLocalSystemBus() func()

StartLocalSystemBus allows to start and set environment variable to a local bus, preventing polluting system ones.

func TestFamilyPath

func TestFamilyPath(t *testing.T) string

TestFamilyPath returns the path of the dir for storing fixtures and other files related to the test.

func Update

func Update() bool

Update returns true if the update flag was set, false otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

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