Files
seaweedfs/seaweed-block/cmd/blockvolume/nvme_controller_id_test.go
T
Ping Qiu 6dd9dc33e2 docs: close iSCSI/NVMe protocol readiness plan (#44)
Close the current protocol-readiness plan and move active work to V2 parity and hardening.

The release gate now covers iSCSI ALUA/failover, NVMe ANA/multipath/failover, CSI protocol selection, and the iSCSI compatibility soak. Test layering is documented so default Go tests stay unit/component scoped, local subprocess tests are opt-in, and Linux lab coverage remains in runner-native TestOps suites.
2026-05-09 11:34:39 -07:00

32 lines
925 B
Go

package main
import "testing"
func TestNVMeControllerIDFromReplicaID_DenseReplicaSuffixes(t *testing.T) {
tests := map[string]uint16{
"r1": 1,
"r2": 2,
"replica3": 3,
"r0": 1,
"r65519": uint16(maxNVMeControllerID),
"r65520": uint16(maxNVMeControllerID),
"r999999999999": uint16(maxNVMeControllerID),
}
for replicaID, want := range tests {
if got := nvmeControllerIDFromReplicaID(replicaID); got != want {
t.Fatalf("nvmeControllerIDFromReplicaID(%q)=%d want %d", replicaID, got, want)
}
}
}
func TestNVMeControllerIDFromReplicaID_HashFallbackIsStableAndNonReserved(t *testing.T) {
a := nvmeControllerIDFromReplicaID("east-primary")
b := nvmeControllerIDFromReplicaID("east-primary")
if a != b {
t.Fatalf("hash fallback unstable: %d vs %d", a, b)
}
if a == 0 || a == 0xffff {
t.Fatalf("hash fallback returned reserved CNTLID %d", a)
}
}