Skip to content
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

bearer: Improvements and test coverage #626

Merged
merged 9 commits into from
Oct 14, 2024
Merged

bearer: Improvements and test coverage #626

merged 9 commits into from
Oct 14, 2024

Conversation

cthulhu-rider
Copy link
Contributor

Copy link

codecov bot commented Sep 26, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 2 lines in your changes missing coverage. Please review.

Project coverage is 55.36%. Comparing base (a0572ad) to head (a3f70f4).
Report is 20 commits behind head on master.

Files with missing lines Patch % Lines
eacl/table.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #626      +/-   ##
==========================================
+ Coverage   54.19%   55.36%   +1.16%     
==========================================
  Files         164      164              
  Lines       19191    19203      +12     
==========================================
+ Hits        10401    10631     +230     
+ Misses       8362     8183     -179     
+ Partials      428      389      -39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cthulhu-rider cthulhu-rider marked this pull request as ready for review September 26, 2024 05:32
bearer/bearer.go Outdated Show resolved Hide resolved
bearer/bearer_test.go Outdated Show resolved Hide resolved
bearer/bearer_test.go Outdated Show resolved Hide resolved
bearer/bearer_test.go Outdated Show resolved Hide resolved
bearer/bearer_test.go Outdated Show resolved Hide resolved
bearer/bearer_test.go Outdated Show resolved Hide resolved
bearer/bearer_test.go Outdated Show resolved Hide resolved
bearer/bearer.go Outdated Show resolved Hide resolved
Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like 2a37283 does much more than expected from its message.

bearer/bearer.go Outdated Show resolved Hide resolved
@cthulhu-rider
Copy link
Contributor Author

oops rebase sheet, fixed

Bearer token type provides `EACLTable` method to access underlying eACL.
It states that if the table is unset, zero instance is returned. The
problem is that `eacl.Table` type did not implement `comparable`
constraint. So, there is no way to check whether eACL instance is zero
or not. Therefore, there was no way to find out whether the token
contained a table.

This adds `eacl.Table.IsZero` method allowing to check the eACL
presence. Currently, it covers all cases where table is required incl.
bearer tokens.

Signed-off-by: Leonard Lyubich <[email protected]>
Previously, bearer and session token types provided `InvalidAt` method
checking whether the token is invalid at the given epoch. This was not a
very good choice, since users are more naturally inclined to work with
affirmative methods. In this case, the validity check, not the
invalidity one.

This extends interface of NeoFS tokens with `ValidAt` method.
`InvalidAt` ones are marked deprecated.

Signed-off-by: Leonard Lyubich <[email protected]>
Signed-off-by: Leonard Lyubich <[email protected]>
// IsZero checks whether all fields of the table are zero/empty. The property
// can be used as a marker of unset eACL.
func (t Table) IsZero() bool {
return t.cid.IsZero() && len(t.records) == 0 && t.version == version.Version{}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not covered.

@roman-khimov roman-khimov merged commit cd609a1 into master Oct 14, 2024
11 checks passed
@roman-khimov roman-khimov deleted the bearer branch October 14, 2024 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants