internal/app: reduce test case indentation
All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Sandbox (push) Successful in 2m13s
Test / Hakurei (push) Successful in 3m9s
Test / Sandbox (race detector) (push) Successful in 4m3s
Test / Hpkg (push) Successful in 4m4s
Test / Hakurei (race detector) (push) Successful in 4m44s
Test / Flake checks (push) Successful in 1m28s
All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Sandbox (push) Successful in 2m13s
Test / Hakurei (push) Successful in 3m9s
Test / Sandbox (race detector) (push) Successful in 4m3s
Test / Hpkg (push) Successful in 4m4s
Test / Hakurei (race detector) (push) Successful in 4m44s
Test / Flake checks (push) Successful in 1m28s
This improves readability on narrower displays. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -41,9 +41,7 @@ func TestApp(t *testing.T) {
|
|||||||
wantSys *system.I
|
wantSys *system.I
|
||||||
wantParams *container.Params
|
wantParams *container.Params
|
||||||
}{
|
}{
|
||||||
{
|
{"nixos permissive defaults no enablements", new(stubNixOS), &hst.Config{Container: &hst.ContainerConfig{
|
||||||
"nixos permissive defaults no enablements", new(stubNixOS),
|
|
||||||
&hst.Config{Container: &hst.ContainerConfig{
|
|
||||||
Filesystem: []hst.FilesystemConfigJSON{
|
Filesystem: []hst.FilesystemConfigJSON{
|
||||||
{FilesystemConfig: &hst.FSBind{
|
{FilesystemConfig: &hst.FSBind{
|
||||||
Target: fhs.AbsRoot,
|
Target: fhs.AbsRoot,
|
||||||
@@ -71,20 +69,22 @@ func TestApp(t *testing.T) {
|
|||||||
Args: []string{"/run/current-system/sw/bin/zsh"},
|
Args: []string{"/run/current-system/sw/bin/zsh"},
|
||||||
|
|
||||||
Flags: hst.FUserns | hst.FHostNet | hst.FHostAbstract | hst.FTty | hst.FShareRuntime | hst.FShareTmpdir,
|
Flags: hst.FUserns | hst.FHostNet | hst.FHostAbstract | hst.FTty | hst.FShareRuntime | hst.FShareTmpdir,
|
||||||
}},
|
}}, state.ID{
|
||||||
state.ID{
|
|
||||||
0x4a, 0x45, 0x0b, 0x65,
|
0x4a, 0x45, 0x0b, 0x65,
|
||||||
0x96, 0xd7, 0xbc, 0x15,
|
0x96, 0xd7, 0xbc, 0x15,
|
||||||
0xbd, 0x01, 0x78, 0x0e,
|
0xbd, 0x01, 0x78, 0x0e,
|
||||||
0xb9, 0xa6, 0x07, 0xac,
|
0xb9, 0xa6, 0x07, 0xac,
|
||||||
},
|
}, system.New(t.Context(), msg, 1000000).
|
||||||
system.New(t.Context(), msg, 1000000).
|
|
||||||
Ensure(m("/tmp/hakurei.0"), 0711).
|
Ensure(m("/tmp/hakurei.0"), 0711).
|
||||||
Ensure(m("/tmp/hakurei.0/runtime"), 0700).UpdatePermType(system.User, m("/tmp/hakurei.0/runtime"), acl.Execute).
|
Ensure(m("/tmp/hakurei.0/runtime"), 0700).
|
||||||
Ensure(m("/tmp/hakurei.0/runtime/0"), 0700).UpdatePermType(system.User, m("/tmp/hakurei.0/runtime/0"), acl.Read, acl.Write, acl.Execute).
|
UpdatePermType(system.User, m("/tmp/hakurei.0/runtime"), acl.Execute).
|
||||||
Ensure(m("/tmp/hakurei.0/tmpdir"), 0700).UpdatePermType(system.User, m("/tmp/hakurei.0/tmpdir"), acl.Execute).
|
Ensure(m("/tmp/hakurei.0/runtime/0"), 0700).
|
||||||
Ensure(m("/tmp/hakurei.0/tmpdir/0"), 01700).UpdatePermType(system.User, m("/tmp/hakurei.0/tmpdir/0"), acl.Read, acl.Write, acl.Execute),
|
UpdatePermType(system.User, m("/tmp/hakurei.0/runtime/0"), acl.Read, acl.Write, acl.Execute).
|
||||||
&container.Params{
|
Ensure(m("/tmp/hakurei.0/tmpdir"), 0700).
|
||||||
|
UpdatePermType(system.User, m("/tmp/hakurei.0/tmpdir"), acl.Execute).
|
||||||
|
Ensure(m("/tmp/hakurei.0/tmpdir/0"), 01700).
|
||||||
|
UpdatePermType(system.User, m("/tmp/hakurei.0/tmpdir/0"), acl.Read, acl.Write, acl.Execute), &container.Params{
|
||||||
|
|
||||||
Dir: m("/home/chronos"),
|
Dir: m("/home/chronos"),
|
||||||
Path: m("/run/current-system/sw/bin/zsh"),
|
Path: m("/run/current-system/sw/bin/zsh"),
|
||||||
Args: []string{"/run/current-system/sw/bin/zsh"},
|
Args: []string{"/run/current-system/sw/bin/zsh"},
|
||||||
@@ -120,11 +120,9 @@ func TestApp(t *testing.T) {
|
|||||||
HostAbstract: true,
|
HostAbstract: true,
|
||||||
RetainSession: true,
|
RetainSession: true,
|
||||||
ForwardCancel: true,
|
ForwardCancel: true,
|
||||||
},
|
}},
|
||||||
},
|
|
||||||
{
|
{"nixos permissive defaults chromium", new(stubNixOS), &hst.Config{
|
||||||
"nixos permissive defaults chromium", new(stubNixOS),
|
|
||||||
&hst.Config{
|
|
||||||
ID: "org.chromium.Chromium",
|
ID: "org.chromium.Chromium",
|
||||||
Identity: 9,
|
Identity: 9,
|
||||||
Groups: []string{"video"},
|
Groups: []string{"video"},
|
||||||
@@ -195,14 +193,12 @@ func TestApp(t *testing.T) {
|
|||||||
|
|
||||||
Flags: hst.FUserns | hst.FHostNet | hst.FHostAbstract | hst.FTty | hst.FShareRuntime | hst.FShareTmpdir,
|
Flags: hst.FUserns | hst.FHostNet | hst.FHostAbstract | hst.FTty | hst.FShareRuntime | hst.FShareTmpdir,
|
||||||
},
|
},
|
||||||
},
|
}, state.ID{
|
||||||
state.ID{
|
|
||||||
0xeb, 0xf0, 0x83, 0xd1,
|
0xeb, 0xf0, 0x83, 0xd1,
|
||||||
0xb1, 0x75, 0x91, 0x17,
|
0xb1, 0x75, 0x91, 0x17,
|
||||||
0x82, 0xd4, 0x13, 0x36,
|
0x82, 0xd4, 0x13, 0x36,
|
||||||
0x9b, 0x64, 0xce, 0x7c,
|
0x9b, 0x64, 0xce, 0x7c,
|
||||||
},
|
}, system.New(t.Context(), msg, 1000009).
|
||||||
system.New(t.Context(), msg, 1000009).
|
|
||||||
Ensure(m("/tmp/hakurei.0"), 0711).
|
Ensure(m("/tmp/hakurei.0"), 0711).
|
||||||
Ensure(m("/tmp/hakurei.0/runtime"), 0700).UpdatePermType(system.User, m("/tmp/hakurei.0/runtime"), acl.Execute).
|
Ensure(m("/tmp/hakurei.0/runtime"), 0700).UpdatePermType(system.User, m("/tmp/hakurei.0/runtime"), acl.Execute).
|
||||||
Ensure(m("/tmp/hakurei.0/runtime/9"), 0700).UpdatePermType(system.User, m("/tmp/hakurei.0/runtime/9"), acl.Read, acl.Write, acl.Execute).
|
Ensure(m("/tmp/hakurei.0/runtime/9"), 0700).UpdatePermType(system.User, m("/tmp/hakurei.0/runtime/9"), acl.Read, acl.Write, acl.Execute).
|
||||||
@@ -251,8 +247,8 @@ func TestApp(t *testing.T) {
|
|||||||
"/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/system_bus_socket",
|
"/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/system_bus_socket",
|
||||||
}).
|
}).
|
||||||
UpdatePerm(m("/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/bus"), acl.Read, acl.Write).
|
UpdatePerm(m("/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/bus"), acl.Read, acl.Write).
|
||||||
UpdatePerm(m("/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/system_bus_socket"), acl.Read, acl.Write),
|
UpdatePerm(m("/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/system_bus_socket"), acl.Read, acl.Write), &container.Params{
|
||||||
&container.Params{
|
|
||||||
Dir: m("/home/chronos"),
|
Dir: m("/home/chronos"),
|
||||||
Path: m("/run/current-system/sw/bin/zsh"),
|
Path: m("/run/current-system/sw/bin/zsh"),
|
||||||
Args: []string{"zsh", "-c", "exec chromium "},
|
Args: []string{"zsh", "-c", "exec chromium "},
|
||||||
@@ -299,12 +295,9 @@ func TestApp(t *testing.T) {
|
|||||||
HostAbstract: true,
|
HostAbstract: true,
|
||||||
RetainSession: true,
|
RetainSession: true,
|
||||||
ForwardCancel: true,
|
ForwardCancel: true,
|
||||||
},
|
}},
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{"nixos chromium direct wayland", new(stubNixOS), &hst.Config{
|
||||||
"nixos chromium direct wayland", new(stubNixOS),
|
|
||||||
&hst.Config{
|
|
||||||
ID: "org.chromium.Chromium",
|
ID: "org.chromium.Chromium",
|
||||||
Enablements: hst.NewEnablements(hst.EWayland | hst.EDBus | hst.EPulse),
|
Enablements: hst.NewEnablements(hst.EWayland | hst.EDBus | hst.EPulse),
|
||||||
Container: &hst.ContainerConfig{
|
Container: &hst.ContainerConfig{
|
||||||
@@ -354,14 +347,12 @@ func TestApp(t *testing.T) {
|
|||||||
DirectWayland: true,
|
DirectWayland: true,
|
||||||
|
|
||||||
Identity: 1, Groups: []string{},
|
Identity: 1, Groups: []string{},
|
||||||
},
|
}, state.ID{
|
||||||
state.ID{
|
|
||||||
0x8e, 0x2c, 0x76, 0xb0,
|
0x8e, 0x2c, 0x76, 0xb0,
|
||||||
0x66, 0xda, 0xbe, 0x57,
|
0x66, 0xda, 0xbe, 0x57,
|
||||||
0x4c, 0xf0, 0x73, 0xbd,
|
0x4c, 0xf0, 0x73, 0xbd,
|
||||||
0xb4, 0x6e, 0xb5, 0xc1,
|
0xb4, 0x6e, 0xb5, 0xc1,
|
||||||
},
|
}, system.New(t.Context(), msg, 1000001).
|
||||||
system.New(t.Context(), msg, 1000001).
|
|
||||||
Ensure(m("/tmp/hakurei.0"), 0711).
|
Ensure(m("/tmp/hakurei.0"), 0711).
|
||||||
Ensure(m("/tmp/hakurei.0/runtime"), 0700).UpdatePermType(system.User, m("/tmp/hakurei.0/runtime"), acl.Execute).
|
Ensure(m("/tmp/hakurei.0/runtime"), 0700).UpdatePermType(system.User, m("/tmp/hakurei.0/runtime"), acl.Execute).
|
||||||
Ensure(m("/tmp/hakurei.0/runtime/1"), 0700).UpdatePermType(system.User, m("/tmp/hakurei.0/runtime/1"), acl.Read, acl.Write, acl.Execute).
|
Ensure(m("/tmp/hakurei.0/runtime/1"), 0700).UpdatePermType(system.User, m("/tmp/hakurei.0/runtime/1"), acl.Read, acl.Write, acl.Execute).
|
||||||
@@ -401,8 +392,8 @@ func TestApp(t *testing.T) {
|
|||||||
"/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/system_bus_socket",
|
"/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/system_bus_socket",
|
||||||
}).
|
}).
|
||||||
UpdatePerm(m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/bus"), acl.Read, acl.Write).
|
UpdatePerm(m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/bus"), acl.Read, acl.Write).
|
||||||
UpdatePerm(m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/system_bus_socket"), acl.Read, acl.Write),
|
UpdatePerm(m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/system_bus_socket"), acl.Read, acl.Write), &container.Params{
|
||||||
&container.Params{
|
|
||||||
Uid: 1971,
|
Uid: 1971,
|
||||||
Gid: 100,
|
Gid: 100,
|
||||||
Dir: m("/var/lib/persist/module/hakurei/0/1"),
|
Dir: m("/var/lib/persist/module/hakurei/0/1"),
|
||||||
@@ -455,8 +446,7 @@ func TestApp(t *testing.T) {
|
|||||||
SeccompPresets: comp.PresetExt | comp.PresetDenyTTY | comp.PresetDenyDevel,
|
SeccompPresets: comp.PresetExt | comp.PresetDenyTTY | comp.PresetDenyDevel,
|
||||||
HostNet: true,
|
HostNet: true,
|
||||||
ForwardCancel: true,
|
ForwardCancel: true,
|
||||||
},
|
}},
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
|
|||||||
Reference in New Issue
Block a user