feat: full NFSv4.2 server and client in pure Go
Test / test (push) Successful in 2m4s
Release / gates (push) Successful in 2m5s
Release / build (amd64, freebsd) (push) Successful in 1m27s
Release / build (amd64, linux) (push) Successful in 1m22s
Release / build (amd64, netbsd) (push) Successful in 1m19s
Release / build (amd64, openbsd) (push) Successful in 1m20s
Release / build (arm64, darwin) (push) Successful in 1m21s
Release / build (arm64, freebsd) (push) Successful in 1m26s
Release / build (arm64, linux) (push) Successful in 1m25s
Release / build (arm64, netbsd) (push) Successful in 1m31s
Release / build (arm64, openbsd) (push) Successful in 1m27s
Release / build (loong64, linux) (push) Successful in 1m37s
Release / build (riscv64, linux) (push) Successful in 1m21s
Release / release (push) Successful in 40s
Test / test (push) Successful in 2m4s
Release / gates (push) Successful in 2m5s
Release / build (amd64, freebsd) (push) Successful in 1m27s
Release / build (amd64, linux) (push) Successful in 1m22s
Release / build (amd64, netbsd) (push) Successful in 1m19s
Release / build (amd64, openbsd) (push) Successful in 1m20s
Release / build (arm64, darwin) (push) Successful in 1m21s
Release / build (arm64, freebsd) (push) Successful in 1m26s
Release / build (arm64, linux) (push) Successful in 1m25s
Release / build (arm64, netbsd) (push) Successful in 1m31s
Release / build (arm64, openbsd) (push) Successful in 1m27s
Release / build (loong64, linux) (push) Successful in 1m37s
Release / build (riscv64, linux) (push) Successful in 1m21s
Release / release (push) Successful in 40s
Assisted-by: GLM 5.3 Flash
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package nfs4server
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"sourcedock.dev/petrbalvin/nfs/internal/nfs4"
|
||||
)
|
||||
|
||||
// TestOpName covers the log names of the common operations and the
|
||||
// numeric fallback.
|
||||
func TestOpName(t *testing.T) {
|
||||
for op, want := range map[uint32]string{
|
||||
nfs4.OpGetattr: "GETATTR", nfs4.OpReaddir: "READDIR",
|
||||
nfs4.OpReclaimComplete: "RECLAIM_COMPLETE", nfs4.OpGetxattr: "GETXATTR",
|
||||
999: "OP999",
|
||||
} {
|
||||
if got := opName(op); got != want {
|
||||
t.Fatalf("opName(%d) = %q, want %q", op, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestLogOp covers the log line shape: operation, status, duration.
|
||||
func TestLogOp(t *testing.T) {
|
||||
var buf bytes.Buffer
|
||||
log.SetOutput(&buf)
|
||||
t.Cleanup(func() { log.SetOutput(os.Stderr) })
|
||||
logOp(nfs4.OpWrite, nfs4.ErrOK, 1500*time.Microsecond)
|
||||
line := buf.String()
|
||||
if !strings.Contains(line, "WRITE status 0") || !strings.Contains(line, "1.5") {
|
||||
t.Fatalf("log line %q misses the operation, the status or the duration", line)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user