-
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
Increase test coverage of accounting
and improve some test packages
#590
Conversation
It teaches what a regular user should be freed from. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
crypto/test/tests.go
Outdated
require.NoError(tb, err) | ||
// Signature returns random neofscrypto.Signature. | ||
func Signature() neofscrypto.Signature { | ||
sig := make([]byte, 64) |
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.
It was a question which I forget to ask many time. Do we want to move such magic
numbers inside packages they are belongs to? I mean this 64
to neofscrypto.SignatureBytesLength for example.
Another example of magic numbers, this 33
would be perfect to has a public const, because in the code in projects we have a lot of pubKey = make([]byte, 33)
pubKey = make([]byte, ecdsa.PublicKeyLength)
looks much better for me.
Yes, in some cases it could be inconvenient to export one more package, but in general case it would ok
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.
code should not do pubKey = make([]byte, 33)
: https://pkg.go.dev/github.com/nspcc-dev/neofs-sdk-go@v1.0.0-rc.12/crypto#PublicKey has method to get len
actually i dont wanna make it const, forgot to add some randomness, thx anyway
9f3af42
to
6650605
Compare
audit/result.go
Outdated
err = oID.ReadFromV2(oidV2) | ||
if err != nil { | ||
return fmt.Errorf("invalid passed storage group ID: %w", err) | ||
return fmt.Errorf("invalid passed storage group ID #%d: %w", i, err) |
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.
we have an exact ID we could not read here, why not add it? same below
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.
cuz it can be few MB len. We could make a cut for overlen values abc...def
but code'd become more complex
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 should admit though that audit is less of a problem wrt API changes (nothing outside the node cares).
audit/result.go
Outdated
// SetCompleted sets data audit completion flag. | ||
// | ||
// See also [Result.Completed]. | ||
func (r *Result) SetCompleted(completed bool) { |
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.
Do you have any use case for SetCompleted(false)
? Why are we changing the API here?
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.
no more relevant #590 (comment)
a736fbd
to
64ac78d
Compare
- split units tests for value and precision fields - add test for randomizing func Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Data audit is completely closed in the NeoFS Inner Ring, so there is no point in having its implementation in the SDK. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
@cthulhu-rider, linter died. What about tests btw? |
This is very inconvenient. The only current failure cases are private key randomization or signing with it: panic is pretty normal for them. Overall, nobody expects that generating in-memory data could fail. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
It is often needed to get another ID, as well as a list of random ones. With new functions, `cidtest.IDWithChecksum` becomes redundant, so it marked as deprecated. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Summary: * get rid of `Random` wording, it is implied everywhere; * provide single `Signer` function returning all potentially needed cryptographic components; * do not import `user` package into `neofscryptotest`, there is `usertest` for this; * provide test signer's wrapper which always failing signing. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
fixed linter, AIO tests fail for some reason unrelated to the changes. I'll take a closer look, maybe create a separate issue |
accounting
+audit
and improve some test packagesaccounting
and improve some test packages
@cthulhu-rider, yes, have not found issues about it and do not know when they appeared first (to me this PR is the first one), so lets create an issue (if cannot be fixed fast) or fix it here (if possible). |
ENV var containing listen endpoint of the REST GW differs b/w two tested versions. The easiest way is to set both. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #590 +/- ##
==========================================
+ Coverage 68.18% 68.78% +0.60%
==========================================
Files 122 120 -2
Lines 10035 10043 +8
==========================================
+ Hits 6842 6908 +66
+ Misses 2814 2759 -55
+ Partials 379 376 -3 ☔ View full report in Codecov by Sentry. |
added fix commit |
No description provided.