Documentation
¶
Overview ¶
Package dbustest starts a private dbus-daemon for tests, so services that export or call D-Bus objects are exercised over a real bus without touching the user's session or system bus.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bus ¶
type Bus struct {
// Address is the bus address, for Dial or DBUS_SESSION_BUS_ADDRESS.
Address string
}
Bus is one private bus.
func Session ¶
Session starts a private bus and makes it the test's session bus, for daemon and CLI halves that both dial the session bus.
func Start ¶
Start launches a dbus-daemon for the test and stops it at cleanup. A missing dbus-daemon fails the test: the dev shell provides one.
func (*Bus) Conn ¶
Conn opens a new authenticated connection to the bus, closed at cleanup. Each call is a distinct peer with its own unique name.
func (*Bus) UseAsSessionBus ¶
UseAsSessionBus points DBUS_SESSION_BUS_ADDRESS at the bus for the test, for code that dials the session bus itself.
func (*Bus) UseAsSystemBus ¶
UseAsSystemBus points DBUS_SYSTEM_BUS_ADDRESS at the bus for the test, for code that dials the system bus itself.
type Var ¶
type Var[T any] struct { // contains filtered or unexported fields }
Var is state a bus handler writes and the test reads. A method call and its reply cross a socket, which the race detector cannot see as ordering, so a plain captured variable reads as a race even when the round trip orders it. Var's lock makes the ordering visible.