test: compare optional lease snapshots without dereferencing nil

This commit is contained in:
pingqiu committed 2026-11-22 00:50:55 -08:00
1 parent b31577dea0
commit 61695b30ef
1 file changed
+2 -1
@@ -4,6 +4,7 @@ import (
control "github.com/seaweedfs/seaweed-block/core/rpc/control"
"google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/proto"
"reflect"
"testing"
)
@@ -48,7 +49,7 @@ func TestWorkspaceLeaseRequiresHolderServerForGrantRenewAndRegrant(t *testing.T)
t.Errorf("%s accepted lease for server %q", stage, server)
}
after := h.Publisher().WorkspaceState("v")
if !proto.Equal(leaseFact("v", before.Lease), leaseFact("v", after.Lease)) {
if !reflect.DeepEqual(before.Lease, after.Lease) {
t.Errorf("%s refused identity changed lease", stage)
}
}