-
Notifications
You must be signed in to change notification settings - Fork 711
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
map tests queues and refactor #1559
map tests queues and refactor #1559
Conversation
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.
Changes all look good to me
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.
Thanks for splitting this up into smaller bits. Please try not to move stuff (like the variable declarations) around without a clear benefit. It causes churn and makes things more time-consuming to review.
This commit introduces in the test sections for the maps the peek operation performed on a queue. It verifies that the 1st value is correctly returned and not removed from the data structure (lookup operation), and also that it returns the error `ErrKeyNotExist` on an empty queue. Signed-off-by: Simone Magnani <simone.magnani@isovalent.com>
This commit performs a small refactoring to some of the map tests, trying to shorten a bit, while also cleaning unnecessary code. Signed-off-by: Simone Magnani <simone.magnani@isovalent.com>
This commit introduces the `TestIterateWrongMap` test, which should assert that the `MapIterator` fails while called on keyless maps such as queues. We do not expect different behaviours, as the `MapIterator.Next` relies on the presence of a key for which it lookups the value. A different method can be later introduces to also traverse a queue, but in that case we'd need to additionally remove the value. Signed-off-by: Simone Magnani <simone.magnani@isovalent.com>
2613a2c
to
fbc3585
Compare
This PR introduces a new test for
MapIterator
as well as small refactoring to some other tests.With this, the aim is primarily to ensure that
MapIterator
fails when called on keyless maps such as queues/stacks: this is because the current implementation relies on a key (nextKey) lookup from the map, which is then used to retrieve its respective value.Commit messages should contain each the explanation, feel free to reach me for further q&a 😃