udiskstest

package
v0.3.21 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package udiskstest is a fake UDisks2 on a private bus: drives and their volumes a test adds and removes, mounted into directories the test owns, so nothing on the host is ever mounted.

Index

Constants

View Source
const (
	CallMount    = "Mount"
	CallUnmount  = "Unmount"
	CallUnlock   = "Unlock"
	CallLock     = "Lock"
	CallPowerOff = "PowerOff"
	CallEject    = "Eject"
)

The calls Calls records, each followed by a space and the object.

Variables

This section is empty.

Functions

This section is empty.

Types

type Drive

type Drive struct {
	Removable, Ejectable, CanPowerOff bool
}

Drive is a drive the test adds.

type UDisks

type UDisks struct {
	// Bus is the private bus the fake owns its name on.
	Bus *dbustest.Bus
	// Calls lists the method calls, "Mount <object>" and the like, in
	// order.
	Calls dbustest.Var[[]string]
	// Busy makes every Unmount fail as a filesystem in use.
	Busy dbustest.Var[bool]
	// Passphrase is the passphrase every container unlocks with.
	Passphrase string
	// MountRoot is where volumes mount, a directory each by label.
	MountRoot string
	// contains filtered or unexported fields
}

UDisks is the fake.

func Start

func Start(t *testing.T) *UDisks

Start runs the fake on a private bus.

func (*UDisks) AddDrive

func (u *UDisks) AddDrive(t *testing.T, path dbus.ObjectPath, d Drive)

AddDrive adds a drive at path.

func (*UDisks) AddVolume

func (u *UDisks) AddVolume(t *testing.T, path dbus.ObjectPath, v Volume)

AddVolume adds a block device at path.

func (*UDisks) Client

func (u *UDisks) Client(t *testing.T) *dbus.Conn

Client is a connection to the fake's bus, for udisks.New.

func (*UDisks) Remove

func (u *UDisks) Remove(t *testing.T, path dbus.ObjectPath)

Remove removes the object at path, as unplugging it does.

type Volume

type Volume struct {
	Label, HintName string
	Size            uint64
	Drive           dbus.ObjectPath
	Encrypted       bool
	HintSystem      bool
	HintIgnore      bool
}

Volume is a block device the test adds: a filesystem, or an encrypted container when Encrypted.

Jump to

Keyboard shortcuts

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