aboutsummaryrefslogtreecommitdiffhomepage
path: root/dbus/dbus_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2024-12-26 15:29:26 +0900
committerOphestra <cat@gensokyo.uk>2024-12-26 16:08:48 +0900
commit614ad86a5bb5d2acbf195d175e1e7c7287c7d467 (patch)
treeacfa5a8e5e18b092907e8179a193ec277e49d0f7 /dbus/dbus_test.go
parent831dc6a1810df6c42bb0c7127c6c3f586a1cb093 (diff)
dbus: fail on LookPath error
An absolute path to xdg-dbus-proxy is required. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'dbus/dbus_test.go')
-rw-r--r--dbus/dbus_test.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/dbus/dbus_test.go b/dbus/dbus_test.go
index 8e267c79..717ded71 100644
--- a/dbus/dbus_test.go
+++ b/dbus/dbus_test.go
@@ -124,6 +124,8 @@ func testProxyStartWaitCloseString(t *testing.T, sandbox bool) {
t.Run("proxy for "+id, func(t *testing.T) {
helper.InternalReplaceExecCommand(t)
+ overridePath(t)
+
p := dbus.New(tc[0].bus, tc[1].bus)
output := new(strings.Builder)
@@ -174,7 +176,7 @@ func testProxyStartWaitCloseString(t *testing.T, sandbox bool) {
t.Run("sealed start of "+id, func(t *testing.T) {
if err := p.Start(nil, output, sandbox); err != nil {
- t.Errorf("Start(nil, nil) error = %v",
+ t.Fatalf("Start(nil, nil) error = %v",
err)
}
@@ -213,3 +215,11 @@ func testProxyStartWaitCloseString(t *testing.T, sandbox bool) {
})
}
}
+
+func overridePath(t *testing.T) {
+ proxyName := dbus.ProxyName
+ dbus.ProxyName = "/nonexistent-xdg-dbus-proxy"
+ t.Cleanup(func() {
+ dbus.ProxyName = proxyName
+ })
+}