Skip to content

Conversation

@aulme
Copy link
Contributor

@aulme aulme commented May 8, 2025

No description provided.

@aulme aulme force-pushed the aul-UID2-5351-preliminary-refactoring branch from cf0b716 to 292f75a Compare May 8, 2025 02:00
@aulme aulme force-pushed the aul-UID2-5351-preliminary-refactoring branch from 292f75a to 45b0e87 Compare May 8, 2025 02:06
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;

public class SaltRotationTest {
Copy link
Contributor

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)

Copy link
Contributor Author

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);
Copy link
Contributor

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]?

Copy link
Contributor Author

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.

Copy link
Contributor

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

@aulme aulme merged commit 5a743f8 into sch-UID2-5350-rotate-salts-at-utc-midnight May 8, 2025
4 checks passed
@aulme aulme deleted the aul-UID2-5351-preliminary-refactoring branch May 8, 2025 03:59
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