[#180] node: Refactor panics in unit test #182
No reviewers
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#182
Loading…
Reference in a new issue
No description provided.
Delete branch "aarifullin/frostfs-node:feature/180-factor_out_panics"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Signed-off-by: Airat Arifullin a.arifullin@yadro.com
Overall LGTM, but I think we could still replace some 3-line ifs with a single
require
@ -157,3 +157,3 @@
}
require.FailNow(t, "handler was called with an unexpected object: %s", addr)
panic("unreachable")
return errors.New("unreachable")
IMO panic better communicate our intentions here.
@ -100,3 +101,3 @@
addr.SetObject(id)
} else {
panic("object ID is not set")
t.Fatalf("object ID is not set")
Can we remove an if then?
@ -27,3 +29,3 @@
log, err := cfg.Build()
if err != nil {
panic("could not prepare logger: " + err.Error())
t.Fatalf("could not prepare logger: %v", err)
require.NoError
?4c34e924df
to7156e0b397
7156e0b397
toe9dc4d43ef
@ -120,2 +120,3 @@
var errSubTreeSend = errors.New("test error")
var (
errSubTreeSend = errors.New("test error")
even if it's a test error, can we use a more meaningful message?
Done
e9dc4d43ef
to6786dcf950
@ -120,2 +120,3 @@
var errSubTreeSend = errors.New("test error")
var (
errSubTreeSend = errors.New("Send finished with error")
In general error strings should not be capitalized. From https://github.com/golang/go/wiki/CodeReviewComments#error-strings
As far as I understand, we follow this rule.
Yes, it's my fault. Here Send is name of the method. Just coincidence :) I'll fix it anyway
LGTM (after resolving the pending comment)
6786dcf950
to221203beeb