-
Notifications
You must be signed in to change notification settings - Fork 6
Preliminary refactoring #456
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
Preliminary refactoring #456
Conversation
cf0b716 to
292f75a
Compare
292f75a to
45b0e87
Compare
| import static org.mockito.ArgumentMatchers.*; | ||
| import static org.mockito.Mockito.*; | ||
|
|
||
| public class SaltRotationTest { |
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.
You can put this class-level annotation:
@ExtendWith(MockitoExtension.java)
Then you won't need to do MockitoAnnotations.openMocks(this); in setup()
If the test fails because the stubs are too lenient, you can additionally add this class-level annotation:
@MockitoSettings(strictness = Strictness.LENIENT)
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.
This would require importing some new libraries. I suggest we keep this for a separate PR.
|
|
||
| for (int i = 0; i < oldSalts.length; i++) { | ||
| var shouldRotate = saltIndexesToRotate.contains(i); | ||
| updatedSalts[i] = updateSalt(oldSalts[i], shouldRotate, nextEffective); |
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.
Can we just skip the function call if !shouldRotate and set updatedSalts[i] = oldSalts[i]?
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 can, but the whole point of this refactoring is to prepare for updating refreshFrom. We're planning to always calculate refreshFrom so we'd need to cycle through every salt.
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.
And we'll also need to update the previous from salt in here too
5a743f8
into
sch-UID2-5350-rotate-salts-at-utc-midnight
No description provided.