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

Improve reliability of kvstore-related tests #26347

Merged
merged 4 commits into from Jun 20, 2023

Conversation

giorio94
Copy link
Member

This PR introduces a set of changes to improve the reliability of the kvstore-related tests, in particular preventing that multiple tests can operate on the same kvstore in parallel. Please refer to the individual commit messages for additional details.

  • kvstore: TestGetSet misc improvements
  • kvstore: refactor the EtcdRateLimiter test
  • kvstore: prevent multiple test clients from being created in parallel
  • kvstoremesh: re-enable the integration tests

@giorio94 giorio94 added kind/bug/CI This is a bug in the testing code. area/clustermesh Relates to multi-cluster routing functionality in Cilium. release-note/misc This PR makes changes that have no direct user impact. sig/kvstore Impacts the KVStore package interactions. labels Jun 19, 2023
@giorio94 giorio94 requested review from a team as code owners June 19, 2023 09:58
@giorio94
Copy link
Member Author

/test

Currently, the kvstore GetSet test repeats the same set of operations for
256 times. Yet, due to the rate limiting settings (i.e., 20 QPS), this
ends up requiring quite a lot of time in the etcd case. Hence, let's reduce
the number of iterations to 8, to speed up the test execution, given that
the overall coverage would not be affected.

Before: --- PASS: Test/EtcdSuite/TestGetSet (101.76s)
After:  --- PASS: Test/EtcdSuite/TestGetSet (2.55s)

Additionally, this commit updates one of the checks that was identical
to another performed immediately before.

Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
In view of the subsequent commit that will introduce a locking mechanism
to prevent the execution of two kvstore tests in parallel, we need to
refactor the EtcdRateLimiter test to avoid initializing two clients
during the same test (as it would lead to a deadlock). While being at
it, let's also convert it to leverage the testing framework. No functional
differences are expected to be introduced by this refactoring.

Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
Multiple tests might be running in parallel by go test if they are part
of different packages. This can lead to race conditions and tests
flakiness if different tests touch the same keys. Hence, let's add a
locking mechanism to the client initialization logic used in tests to
prevent that two clients are created in parallel. Additionally, let's
automatically register the appropriate cleanup logic to delete all keys
and close the client when the test terminates.

Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
Now that a locking mechanism is in place to prevent the interaction
between different tests using the kvstore, let's enable again the
kvstoremesh integration tests.

Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
@giorio94
Copy link
Member Author

/test

Copy link
Member

@jrajahalme jrajahalme left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@YutaroHayakawa YutaroHayakawa left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@borkmann borkmann added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Jun 20, 2023
@borkmann borkmann merged commit 03fdfef into cilium:main Jun 20, 2023
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/clustermesh Relates to multi-cluster routing functionality in Cilium. kind/bug/CI This is a bug in the testing code. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact. sig/kvstore Impacts the KVStore package interactions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants