[#1693] node: Replace conditional panics with asserts
All checks were successful
Vulncheck / Vulncheck (push) Successful in 1m25s
Build / Build Components (push) Successful in 1m58s
Pre-commit hooks / Pre-commit (push) Successful in 2m1s
Tests and linters / Run gofumpt (push) Successful in 4m20s
Tests and linters / gopls check (push) Successful in 4m31s
Tests and linters / Lint (push) Successful in 4m46s
Tests and linters / Staticcheck (push) Successful in 4m42s
OCI image / Build container images (push) Successful in 4m54s
Tests and linters / Tests (push) Successful in 5m0s
Tests and linters / Tests with -race (push) Successful in 5m47s

Change-Id: I5024705fd1693d00cb9241235030a73984c2a7e1
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
Ekaterina Lebedeva 2025-04-14 12:38:52 +03:00
parent 410b6f70ba
commit a285d8924f

View file

@ -8,6 +8,7 @@ import (
"net"
"sync/atomic"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/assert"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/metrics"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/netmap"
@ -104,9 +105,7 @@ func (s *networkState) getNodeInfo() (res netmapSDK.NodeInfo, ok bool) {
v := s.nodeInfo.Load()
if v != nil {
res, ok = v.(netmapSDK.NodeInfo)
if !ok {
panic(fmt.Sprintf("unexpected value in atomic node info state: %T", v))
}
assert.True(ok, fmt.Sprintf("unexpected value in atomic node info state: %T", v))
}
return