diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-16 02:32:57 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-16 02:32:57 +0900 |
| commit | f9edec7e4169ecda63ba15762f12e64803b9984d (patch) | |
| tree | bc3682c185dc32bfb941b68578ead2c85449d60b /hst/hst_test.go | |
| parent | 305c600cf5b69e16538e0142cf3d10844a671577 (diff) | |
hst: merge miscellaneous files
These structs were going to be bigger at some point. They turned out not to be.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'hst/hst_test.go')
| -rw-r--r-- | hst/hst_test.go | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/hst/hst_test.go b/hst/hst_test.go new file mode 100644 index 00000000..31b9013e --- /dev/null +++ b/hst/hst_test.go @@ -0,0 +1,163 @@ +package hst_test + +import ( + "encoding/json" + "testing" + + "hakurei.app/hst" +) + +func TestTemplate(t *testing.T) { + const want = `{ + "id": "org.chromium.Chromium", + "path": "/run/current-system/sw/bin/chromium", + "args": [ + "chromium", + "--ignore-gpu-blocklist", + "--disable-smooth-scrolling", + "--enable-features=UseOzonePlatform", + "--ozone-platform=wayland" + ], + "enablements": { + "wayland": true, + "dbus": true, + "pulse": true + }, + "session_bus": { + "see": null, + "talk": [ + "org.freedesktop.Notifications", + "org.freedesktop.FileManager1", + "org.freedesktop.ScreenSaver", + "org.freedesktop.secrets", + "org.kde.kwalletd5", + "org.kde.kwalletd6", + "org.gnome.SessionManager" + ], + "own": [ + "org.chromium.Chromium.*", + "org.mpris.MediaPlayer2.org.chromium.Chromium.*", + "org.mpris.MediaPlayer2.chromium.*" + ], + "call": { + "org.freedesktop.portal.*": "*" + }, + "broadcast": { + "org.freedesktop.portal.*": "@/org/freedesktop/portal/*" + }, + "filter": true + }, + "system_bus": { + "see": null, + "talk": [ + "org.bluez", + "org.freedesktop.Avahi", + "org.freedesktop.UPower" + ], + "own": null, + "call": null, + "broadcast": null, + "filter": true + }, + "username": "chronos", + "shell": "/run/current-system/sw/bin/zsh", + "data": "/var/lib/hakurei/u0/org.chromium.Chromium", + "dir": "/data/data/org.chromium.Chromium", + "extra_perms": [ + { + "ensure": true, + "path": "/var/lib/hakurei/u0", + "x": true + }, + { + "path": "/var/lib/hakurei/u0/org.chromium.Chromium", + "r": true, + "w": true, + "x": true + } + ], + "identity": 9, + "groups": [ + "video", + "dialout", + "plugdev" + ], + "container": { + "hostname": "localhost", + "wait_delay": -1, + "seccomp_flags": 1, + "seccomp_presets": 1, + "seccomp_compat": true, + "devel": true, + "userns": true, + "net": true, + "tty": true, + "multiarch": true, + "env": { + "GOOGLE_API_KEY": "AIzaSyBHDrl33hwRp4rMQY0ziRbj8K9LPA6vUCY", + "GOOGLE_DEFAULT_CLIENT_ID": "77185425430.apps.googleusercontent.com", + "GOOGLE_DEFAULT_CLIENT_SECRET": "OTJgUOQcT7lO7GsGZq2G4IlT" + }, + "map_real_uid": true, + "device": true, + "filesystem": [ + { + "type": "ephemeral", + "dst": "/tmp/", + "write": true, + "perm": 493 + }, + { + "type": "overlay", + "dst": "/nix/store", + "lower": [ + "/mnt-root/nix/.ro-store" + ], + "upper": "/mnt-root/nix/.rw-store/upper", + "work": "/mnt-root/nix/.rw-store/work" + }, + { + "type": "bind", + "src": "/nix/store" + }, + { + "type": "bind", + "src": "/run/current-system" + }, + { + "type": "bind", + "src": "/run/opengl-driver" + }, + { + "type": "bind", + "dst": "/data/data/org.chromium.Chromium", + "src": "/var/lib/hakurei/u0/org.chromium.Chromium", + "write": true + }, + { + "type": "bind", + "src": "/dev/dri", + "dev": true, + "optional": true + } + ], + "symlink": [ + { + "target": "/run/user/65534", + "linkname": "/run/user/150" + } + ], + "auto_root": "/var/lib/hakurei/base/org.debian", + "root_flags": 2, + "etc": "/etc/", + "auto_etc": true + } +}` + + if p, err := json.MarshalIndent(hst.Template(), "", "\t"); err != nil { + t.Fatalf("cannot marshal: %v", err) + } else if s := string(p); s != want { + t.Fatalf("Template:\n%s\nwant:\n%s", + s, want) + } +} |
