X-Git-Url: http://git.giacomolli.uk/onechat/blobdiff_plain/97274864799ac2eea84bf80c9727a810b695db55..697c662a48c87ee9be136358129c1f79f4f5a72f:/daemon_test.go?ds=sidebyside diff --git a/daemon_test.go b/daemon_test.go index 91d6ecc..fe40929 100644 --- a/daemon_test.go +++ b/daemon_test.go @@ -116,6 +116,18 @@ func TestListenSocketRefusesALongPath(t *testing.T) { require.ErrorContains(t, err, "set ONECHAT_DIR to a shorter path") } +func TestDaemonWritesNoFileForALongSocketPath(t *testing.T) { + dir := filepath.Join(t.TempDir(), strings.Repeat("d", 100)) + t.Setenv("ONECHAT_DIR", dir) + + err := daemon(t.Context(), io.Discard) + require.ErrorContains(t, err, "set ONECHAT_DIR to a shorter path") + + entries, err := os.ReadDir(dir) + require.NoError(t, err) + require.Empty(t, entries) +} + func TestOneProcessHoldsTheTokens(t *testing.T) { dir := t.TempDir() lock, err := lockTokens(dir)