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

Sync epoch #622

Merged
merged 3 commits into from
Sep 7, 2023
Merged

Sync epoch #622

merged 3 commits into from
Sep 7, 2023

Conversation

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.

You can have a bit less commits, tick_and_wait changes can be made throughout the whole codebase in a single one.

pytest_tests/steps/cluster_test_base.py Outdated Show resolved Hide resolved
robot/resources/lib/python_keywords/epoch.py Outdated Show resolved Hide resolved
robot/resources/lib/python_keywords/epoch.py Outdated Show resolved Hide resolved
robot/resources/lib/python_keywords/epoch.py Outdated Show resolved Hide resolved
robot/resources/lib/python_keywords/node_management.py Outdated Show resolved Hide resolved
pytest_tests/steps/storage_object.py Outdated Show resolved Hide resolved
@@ -202,7 +202,7 @@ def test_session_token_expiration_flags(
session=session_token,
)

self.tick_epochs(2)
self.tick_epochs_and_wait(2)
Copy link
Contributor

Choose a reason for hiding this comment

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

iiuc tick_epochs_and_wait asserts that all nodes match certain condition (>=CURRENT+2) and have exactly the same epoch, am i right?

if so, for cases like this, we may lighten requirement to different values matching the condition (e.g. if we tick from 10 twice, then we are OK with any 12+ value). While same values are definitely better and expected much more, the test doesn't break with the different ones IMO

Copy link
Member

Choose a reason for hiding this comment

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

Different tests can have different requirements, so having a single current epoch is safer. And it's feasible in general, the next epoch update is expected to happen long after the current one once it's updated. If we have premature epoch ticks from IR that's a problem and failing a test in this case is appropriate behaviour.

Copy link
Contributor

Choose a reason for hiding this comment

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

i'd leave the tests granular and, if possible, not adding dependencies on other subsystems (we test them separately). Such a test may fail on a strange tick, but this may not be a node's token verification bug. If epoch is OK, then token is OK, and vice versa, no matter how they tick. Stronger precondition does not improve the test IMO

this is my developer vision, may be @vvarg229 @evgeniiz321 have other opinion

Copy link
Member

Choose a reason for hiding this comment

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

What if you want to test token's nbf? It won't be OK if some nodes are to have N+1 epoch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@cthulhu-rider let's continue the discussion in another issue?
I don't really understand how the ticking of an epoch can affect a session token.

@vvarg229 vvarg229 force-pushed the sync_epoch branch 4 times, most recently from 8e72775 to 0bb4ffa Compare September 5, 2023 16:19
@vvarg229
Copy link
Collaborator Author

vvarg229 commented Sep 5, 2023

You can have a bit less commits, tick_and_wait changes can be made throughout the whole codebase in a single one.

Fixed

Added functionality to make sure the new epoch ticked.
This is to ensure that the epoch is ticked before the next step
in tests where it is necessary.

Signed-off-by: Oleg Kulachenko <[email protected]>
current_epoch = self.get_epoch()
for _ in range(epochs_to_tick):
self.tick_epoch()
epoch.wait_for_epochs_align(self.shell, self.cluster, current_epoch)
Copy link
Contributor

Choose a reason for hiding this comment

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

is it ok that current_epoch won't be really current? shouldn't it be updated inside the cycle?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

is it ok that current_epoch won't be really current? shouldn't it be updated inside the cycle?

That's right - we are comparing the current epoch and the epoch that will be after the ticking.

@roman-khimov roman-khimov merged commit ce9db46 into nspcc-dev:master Sep 7, 2023
1 check passed
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.

Wait for the cluster to sync epoch in ensure_fresh_epoch()
4 participants