-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
netmap: add GetAttributes
and SetAttributes
for NodeInfo
#635
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #635 +/- ##
==========================================
+ Coverage 56.33% 56.34% +0.01%
==========================================
Files 164 164
Lines 22403 22420 +17
==========================================
+ Hits 12620 12633 +13
- Misses 9396 9400 +4
Partials 387 387 ☔ View full report in Codecov by Sentry. |
729be9c
to
bfd0121
Compare
bfd0121
to
e6979b9
Compare
netmap/node_info_test.go
Outdated
require.Equal(t, attr2[1], n.Attribute(k2)) | ||
require.Equal(t, 2, n.NumberOfAttributes()) | ||
|
||
n.SetAttributes() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
essentially this is a reset API which code seems a bit strange to me. I'd replace variadic parameter with a slice. At the same time, passing individual items like few lines above look a bit nicer w/o slicing. But i still stand for slice prm, but dont insist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am also for slice, but do not insist
netmap/node_info_test.go
Outdated
require.Equal(t, 2, n.NumberOfAttributes()) | ||
|
||
n.SetAttributes() | ||
require.Equal(t, 0, n.NumberOfAttributes()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require.Zero
netmap/node_info_test.go
Outdated
|
||
n.SetAttributes(attr1) | ||
attrs := n.GetAttributes() | ||
require.Equal(t, len(attrs), n.NumberOfAttributes()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require.Equal(t, len(attrs), n.NumberOfAttributes()) | |
require.Len(t, attrs, 1) |
netmap/node_info_test.go
Outdated
|
||
n.SetAttributes(attr1, attr2) | ||
attrs = n.GetAttributes() | ||
require.Equal(t, len(attrs), n.NumberOfAttributes()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require.Equal(t, len(attrs), n.NumberOfAttributes()) | |
require.Len(t, attrs, 2) |
netmap/node_info_test.go
Outdated
require.Equal(t, attr2[1], n.Attribute(k2)) | ||
require.Equal(t, 2, n.NumberOfAttributes()) | ||
|
||
n.SetAttributes() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am also for slice, but do not insist
Signed-off-by: Andrey Butusov <[email protected]>
e6979b9
to
41a43d3
Compare
Refs nspcc-dev/neofs-node#3005 (comment).
I'm not sure about taking out
netmap.Attribute
. Maybe I need to create my own Attribute?