Skip to content

tests: posix_test.go has never compiled — MockBackend redeclared under -tags=posix #197

Closed

Description

@scttfrdmn

tests/posix_test.go:420 declares MockBackend, and so does another file in the same package. Under the posix build tag the package does not compile:

$ go vet -tags=posix ./tests/...
vet: tests/posix_test.go:420:6: MockBackend redeclared in this block

Nothing in CI passes -tags=posix, so this has never been caught. The file is 400+ lines of POSIX conformance assertions that have never run — not "run and passed", never compiled.

Two things to decide, and they are separate:

  1. The redeclaration is mechanical: rename or share the one mock.
  2. Whether the tag should exist at all. A build tag that no CI job passes is a file that is not tested, dressed as a file that is. scripts/pjdfstest.sh exists alongside it and is also not wired to CI. Either the posix suite runs somewhere or it should not be carried as if it does.

Prefer (2) resolved first — if the answer is "these run in the live integration job", then fixing the redeclaration is worth it; if the answer is "this was superseded by internal/difftest", the file should go rather than be repaired.

Verification: go vet -tags=posix ./tests/... clean, and a CI job that actually passes the tag — otherwise this reopens the moment someone adds a second declaration.

Activity

  1. added
    type: testing
    priority: medium
    area: tests
    effort: small
    on Aug 2, 2026
  2. scttfrdmn commented on Aug 3, 2026

    @scttfrdmn
    OwnerAuthor

    Reproduced on current main:

    $ go vet -tags=posix ./tests/...
    vet: tests/posix_test.go:420:6: MockBackend redeclared in this block
    

    Still true, and worth stating plainly: a POSIX conformance test file that has never compiled provides no coverage at all, while its presence in the tree implies it does. Same class as the cgofuse subset — a build tag nothing in CI exercises.

  3. scttfrdmn commented on Aug 3, 2026

    @scttfrdmn
    OwnerAuthor

    Part of a class, now tracked as #240: four build tags in this repo (posix, aws_s3, benchmark, integration) carry code that no CI job compiles, and three of the four are broken — this one, plus two PutObject call sites that were never updated when the method gained its metadata parameter, plus a fmt.Itoa that has never existed.

    That does not change what this issue asks. Question (2) — whether the posix tag should exist at all given internal/difftest superseded it — is still the one to answer first, and #240 depends on the answer rather than supplying it. What #240 adds is the gate: a go vet matrix cell per surviving tag, so whichever way this resolves, the next tagged file to stop compiling fails a PR instead of rotting for ten months.

  4. scttfrdmn commented on Aug 4, 2026

    @scttfrdmn
    OwnerAuthor

    Resolved in #351 by answering question (2) as superseded, which is the ordering this issue asked for.

    The redeclaration was mechanical, but repairing it was not: removing the duplicate MockBackend yields unknown field files, fixing that yields undefined: vfs, and adding the import yields not enough arguments in call to metrics.NewCollector (it wants *metrics.Config). Three API generations, one behind the other. The file's own MockBackend copy had meanwhile been half-edited by some later sweep — it takes a meta argument and carries a rename-preserves-metadata comment — which is the clearest evidence available that someone updated this file in a mechanical pass without ever compiling it.

    Its eight suite methods are covered elsewhere, and better: internal/fuse has 13 test files over Lookup/Readdir/Mkdir/Create/Unlink/Rmdir/Rename/Chmod/Setattr/Fsync/Statfs/attributes/read-path/cache-invalidation/errno against a real in-process S3 endpoint rather than a map[string][]byte; internal/difftest runs write/read/truncate/flush/reopen/stat sequences against ObjectFS and the local OS filesystem and asserts agreement; internal/fuse/kernel_options_live_test.go covers what genuinely needs a kernel, behind fuse_mount, and is compiled in CI.

    One detail settles the verification clause on its own. This issue asks for "a CI job that actually passes the tag" — but the file could not have joined CI as written. TestFilesystemMount and all seven other methods call s.manager.Mount(s.ctx) under assert.NoError/require.NoError, so on any runner without /dev/fuse it would have failed rather than skipped. kernel_options_live_test.go states the principle it violated: "A test skipping itself for want of a device would be worse than a build tag: it would report success." This file managed a third option — reporting failure for want of a device.

    The verification is met in the form the issue's own preference implies: go vet -tags=posix ./... is clean because nothing carries the tag, and #351 adds TestGatedTagsStillExist, which fails if a posix cell is ever added back to the CI matrix without files behind it — so this cannot reopen by way of a green cell for a suite that is gone. Verified by mutation.

    The second half of this issue — scripts/pjdfstest.sh also running nowhere — is split out as #352. Different answer: that script works, and is blocked on the real-AWS nightly job rather than broken.

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

    area: testseffort: smallpriority: mediumtype: testing

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions