Skip to content

Server tests fail as root and under full-suite load #43

Open

Description

@thecodacus

From the review of #41. The server suite (npm test -w server, 369 tests) was run in node:22 on Linux. Three failures show up that depend on how the suite is run, not on the code under test.

Fails when run as root

server/test/message-versions.test.mjs fakes a failing disk by making a directory read-only and expecting EACCES:

chmodSync(dir, 0o500);
await assert.rejects(sessions.switchVersion(...), /EACCES|permission/);

Root ignores file permissions, so the write succeeds and the test reports Missing expected rejection.:

Both pass as a normal user. Containers and CI runners often run as root, so these should be skipped when process.getuid?.() === 0, or fail the write some way that doesn't depend on permissions.

Timing threshold too tight under load

server/test/model-levels.test.mjs:29, "a chat's levels do not wait for pi's catalogue to be built", asserts:

assert.ok(Date.now() - started < 1000, `answered after ${...}ms`);

It reported answered after 1226ms during a full parallel run. Run on its own it passed 5 out of 5. The 1000 ms bound needs more room, or the check should measure something other than wall-clock time.

Related: macOS

Separate from Linux, three tests fail on macOS and the suite then hangs until killed. The causes are /var being a symlink to /private/var (paths compared unresolved) and macOS's shorter socket-path limit (104 characters against Linux's 108). Not urgent since the portal ships on Linux, but worth knowing for anyone running the tests on a Mac.

Activity

  1. added a commit that references this issue on Sep 29, 2026
  2. Piggidragon commented on Oct 18, 2026

    @Piggidragon
    Collaborator

    The as-root part is done: since #245 the full server suite passes as root on Node 22, on a 2-vCPU machine at --test-concurrency=3 like CI. model-levels uses a clock of its own instead of 1000 ms of wall-clock time. The auth and loaded-from-folders files are split so that none comes near the 120 s per-file limit under load. Still open: the macOS part (the /var symlink and the shorter socket-path limit).

  3. thecodacus commented on Oct 23, 2026

    @thecodacus
    OwnerAuthor

    Status for 0.2.0: the as-root and under-load parts are done.

    What's left is macOS, which I'm keeping here. On main, a macOS run of the server suite now finishes (1553 tests, about two minutes) rather than hanging. These still fail there:

    • Paths are compared without resolving /var -> /private/var: file-safety, extension-host and two browser-guard tests. All four pass with TMPDIR set to the resolved path.
    • The socket limit: holdDataDir checks against Linux's 108 bytes and falls back to an abstract socket, which macOS doesn't have. second-instance "too long for a socket" and session-images-route fail with listen EINVAL. The second one's socket path is 110 bytes after realpath.
    • db-upgrade "an upgrade whose page cannot have its port still upgrades" has a different cause. The test holds the port on 127.0.0.1 and the upgrade page listens on 0.0.0.0, which macOS allows, so no error comes. It is tracked here because chore(release): 0.2.0 #303 put it here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions