mirror of
https://github.com/nspcc-dev/neofs-sdk-go.git
synced 2026-03-01 04:29:18 +00:00
Drop hardcoded raw values in tests #274
Labels
No labels
I2
I3
I4
S1
S2
S3
S4
U0
U1
U2
U2
U2
U3
U4
blocked
bug
client
config
discussion
documentation
enhancement
epic
feature
go
good first issue
help wanted
performance
pool
question
security
task
test
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nspcc-dev/neofs-sdk-go#274
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Originally created by @carpawell on GitHub (Jun 27, 2025).
I'm always frustrated when we test functionality that we do not implement. We can test bbolt, protobuf lib, we can test the whole std lib if we do not trust it. The waste of time will be in accordance.
Current Behavior
Once you change/extend SDK's structures and decide to adopt it in every test file, you open Pandora's box and you start living in signature hell.
Expected Behavior
If we write setters/getters, test setters/getters. If we write marshallers, test marshallers. There is no need to test whether computers can still calculate signatures from some random keys that satisfy us.
Possible Solution
Drop ecdsa test code like
nspcc-dev/neofs-sdk-go@673e1845df/bearer/bearer_test.go (L387-L421)Steps to Reproduce
Update SDK version, have fun.
Context
https://github.com/nspcc-dev/neofs-sdk-go/pull/721
@roman-khimov commented on GitHub (Jun 27, 2025):
Some hardcoded values are very much useful, we need to make sure that exact known binaries are always processed correctly, because marshal/unmarshal can have some symmetric bugs that make tests green, but then it'll all fail with real objects. Also, binaries allow to easier testing of protocol violation handling in some cases. But:
So if there are bugs, let's fix them. If there are some redundant tests, let's discuss and refactor/drop them. But dropping all binaries just because they're binaries is not appropriate.
@cthulhu-rider commented on GitHub (Jul 8, 2025):
how to test marshaler? Make sure it produces exact binary
@carpawell commented on GitHub (Jul 8, 2025):
I have not said that. I do not understand how hardcoded signatures + commented public keys help us even a little. I do not understand why "marshal + sign" was important then, but now, when there is one more field, this field is not required, you should not use it in tests (but if the field has "non-zero zero" value, any signature will break anyway) OR a dev dies recalculating all the signatures of the new field. Even if we are recalculating signatures, you do not check if they are ok, you just hardcode new values that you just received, and that is your new base from now.
Does it require signing these binaries?