hst/dbus: move dbus config struct
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m11s
Test / Hakurei (push) Successful in 3m12s
Test / Hpkg (push) Successful in 4m0s
Test / Hakurei (race detector) (push) Successful in 5m20s
Test / Sandbox (race detector) (push) Successful in 2m11s
Test / Flake checks (push) Successful in 1m31s
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m11s
Test / Hakurei (push) Successful in 3m12s
Test / Hpkg (push) Successful in 4m0s
Test / Hakurei (race detector) (push) Successful in 5m20s
Test / Sandbox (race detector) (push) Successful in 2m11s
Test / Flake checks (push) Successful in 1m31s
This allows holding a xdg-dbus-proxy configuration without importing system/dbus. It also makes more sense in the project structure since the config struct is part of the hst API however the rest of the implementation is not. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"hakurei.app/container/stub"
|
||||
"hakurei.app/helper"
|
||||
"hakurei.app/hst"
|
||||
"hakurei.app/system/dbus"
|
||||
)
|
||||
|
||||
@@ -82,7 +83,7 @@ func TestDBusProxyOp(t *testing.T) {
|
||||
Op: "dbus", Err: ErrDBusConfig,
|
||||
Msg: "attempted to create message bus proxy args without session bus config",
|
||||
}
|
||||
if err := sys.ProxyDBus(nil, new(dbus.Config), nil, nil); !reflect.DeepEqual(err, wantErr) {
|
||||
if err := sys.ProxyDBus(nil, new(hst.BusConfig), nil, nil); !reflect.DeepEqual(err, wantErr) {
|
||||
t.Errorf("ProxyDBus: error = %v, want %v", err, wantErr)
|
||||
}
|
||||
}, nil, stub.Expect{}},
|
||||
@@ -96,10 +97,10 @@ func TestDBusProxyOp(t *testing.T) {
|
||||
}()
|
||||
|
||||
sys.MustProxyDBus(
|
||||
m("/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/bus"), &dbus.Config{
|
||||
m("/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/bus"), &hst.BusConfig{
|
||||
// use impossible value here as an implicit assert that it goes through the stub
|
||||
Talk: []string{"session\x00"}, Filter: true,
|
||||
}, m("/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/system_bus_socket"), &dbus.Config{
|
||||
}, m("/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/system_bus_socket"), &hst.BusConfig{
|
||||
// use impossible value here as an implicit assert that it goes through the stub
|
||||
Talk: []string{"system\x00"}, Filter: true,
|
||||
})
|
||||
@@ -108,8 +109,8 @@ func TestDBusProxyOp(t *testing.T) {
|
||||
call("dbusFinalise", stub.ExpectArgs{
|
||||
dbus.ProxyPair{"unix:path=/run/user/1000/bus", "/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/bus"},
|
||||
dbus.ProxyPair{"unix:path=/run/dbus/system_bus_socket", "/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/system_bus_socket"},
|
||||
&dbus.Config{Talk: []string{"session\x00"}, Filter: true},
|
||||
&dbus.Config{Talk: []string{"system\x00"}, Filter: true},
|
||||
&hst.BusConfig{Talk: []string{"session\x00"}, Filter: true},
|
||||
&hst.BusConfig{Talk: []string{"system\x00"}, Filter: true},
|
||||
}, (*dbus.Final)(nil), syscall.EINVAL),
|
||||
}}},
|
||||
|
||||
@@ -119,10 +120,10 @@ func TestDBusProxyOp(t *testing.T) {
|
||||
Msg: "cannot finalise message bus proxy: unique error 0 injected by the test suite",
|
||||
}
|
||||
if err := sys.ProxyDBus(
|
||||
&dbus.Config{
|
||||
&hst.BusConfig{
|
||||
// use impossible value here as an implicit assert that it goes through the stub
|
||||
Talk: []string{"session\x00"}, Filter: true,
|
||||
}, &dbus.Config{
|
||||
}, &hst.BusConfig{
|
||||
// use impossible value here as an implicit assert that it goes through the stub
|
||||
Talk: []string{"system\x00"}, Filter: true,
|
||||
},
|
||||
@@ -135,17 +136,17 @@ func TestDBusProxyOp(t *testing.T) {
|
||||
call("dbusFinalise", stub.ExpectArgs{
|
||||
dbus.ProxyPair{"unix:path=/run/user/1000/bus", "/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/bus"},
|
||||
dbus.ProxyPair{"unix:path=/run/dbus/system_bus_socket", "/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/system_bus_socket"},
|
||||
&dbus.Config{Talk: []string{"session\x00"}, Filter: true},
|
||||
&dbus.Config{Talk: []string{"system\x00"}, Filter: true},
|
||||
&hst.BusConfig{Talk: []string{"session\x00"}, Filter: true},
|
||||
&hst.BusConfig{Talk: []string{"system\x00"}, Filter: true},
|
||||
}, (*dbus.Final)(nil), stub.UniqueError(0)),
|
||||
}}},
|
||||
|
||||
{"full", 0xcafebabe, func(_ *testing.T, sys *I) {
|
||||
sys.MustProxyDBus(
|
||||
m("/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/bus"), &dbus.Config{
|
||||
m("/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/bus"), &hst.BusConfig{
|
||||
// use impossible value here as an implicit assert that it goes through the stub
|
||||
Talk: []string{"session\x00"}, Filter: true,
|
||||
}, m("/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/system_bus_socket"), &dbus.Config{
|
||||
}, m("/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/system_bus_socket"), &hst.BusConfig{
|
||||
// use impossible value here as an implicit assert that it goes through the stub
|
||||
Talk: []string{"system\x00"}, Filter: true,
|
||||
})
|
||||
@@ -159,8 +160,8 @@ func TestDBusProxyOp(t *testing.T) {
|
||||
call("dbusFinalise", stub.ExpectArgs{
|
||||
dbus.ProxyPair{"unix:path=/run/user/1000/bus", "/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/bus"},
|
||||
dbus.ProxyPair{"unix:path=/run/dbus/system_bus_socket", "/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/system_bus_socket"},
|
||||
&dbus.Config{Talk: []string{"session\x00"}, Filter: true},
|
||||
&dbus.Config{Talk: []string{"system\x00"}, Filter: true},
|
||||
&hst.BusConfig{Talk: []string{"session\x00"}, Filter: true},
|
||||
&hst.BusConfig{Talk: []string{"system\x00"}, Filter: true},
|
||||
}, dbusNewFinalSample(0), nil),
|
||||
call("isVerbose", stub.ExpectArgs{}, true, nil),
|
||||
call("verbose", stub.ExpectArgs{[]any{"session bus proxy:", []string{"unix:path=/run/user/1000/bus", "/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/bus", "--filter", "--talk=session\x00"}}}, nil, nil),
|
||||
|
||||
Reference in New Issue
Block a user