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,49 @@
|
||||
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package nfs4
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"sourcedock.dev/petrbalvin/nfs/internal/xdr"
|
||||
)
|
||||
|
||||
func TestLockuAndLocktResWire(t *testing.T) {
|
||||
var st Stateid
|
||||
st[4], st[5], st[6], st[7] = 'L', 'O', 'C', 'K'
|
||||
arg := AppendLockuArgs(nil, st, 8, 32)
|
||||
d := xdr.NewDecoder(arg)
|
||||
if op, err := d.Uint32(); err != nil || op != OpLocku {
|
||||
t.Fatalf("op: %d, %v", op, err)
|
||||
}
|
||||
if lt, err := d.Uint32(); err != nil || lt != LockTypeWrite {
|
||||
t.Fatalf("locktype: %v", err)
|
||||
}
|
||||
if _, err := d.Uint32(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if raw, err := d.Raw(16); err != nil || raw[4] != 'L' {
|
||||
t.Fatalf("stateid: %x, %v", raw, err)
|
||||
}
|
||||
if off, err := d.Uint64(); err != nil || off != 8 {
|
||||
t.Fatalf("offset: %v", err)
|
||||
}
|
||||
if length, err := d.Uint64(); err != nil || length != 32 {
|
||||
t.Fatalf("length: %v", err)
|
||||
}
|
||||
|
||||
res := AppendLockuRes(nil, st)
|
||||
if n, err := resBodyLen(OpLocku, ErrOK, res); err != nil || n != 16 {
|
||||
t.Fatalf("locku measure: %d, %v", n, err)
|
||||
}
|
||||
|
||||
okBody := AppendLocktResOK(nil)
|
||||
if n, err := resBodyLen(OpLockt, ErrOK, okBody); err != nil || n != 0 {
|
||||
t.Fatalf("lockt ok measure: %d, %v", n, err)
|
||||
}
|
||||
denied := AppendLocktResDenied(nil, 0, 100, LockTypeWrite, 0x1111, []byte("holder"))
|
||||
if n, err := resBodyLen(OpLockt, ErrDenied, denied); err != nil || n != len(denied) {
|
||||
t.Fatalf("lockt denied measure: %d of %d, %v", n, len(denied), err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user