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

Fix concurrent map read and write in cache test #579

Merged

Conversation

mresvanis
Copy link
Contributor

This flaky internal cache test's root cause was that the StartCollecting method was locking the map to delete the expired item, but the respective test code could be writing to the map at the same time without locking it. By running the StartCollecting after the initial writing of the items to the map, we get rid of the possibility of concurrent map read and write errors.

Fixes #528

This flaky test's root cause was that the StartCollecting method was
locking the map to delete the expired item, but the test code could be
writing to the map at the same time. By running the StartCollecting
after writing the items to the map, we get rid of the possiblity of
concurrent map read and write errors.

Signed-off-by: Michail Resvanis <[email protected]>
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 27, 2023
@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 27, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mresvanis

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify
Copy link

netlify bot commented Sep 27, 2023

Deploy Preview for kubernetes-sigs-kmm ready!

Name Link
🔨 Latest commit 030a546
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kmm/deploys/6513e9a6c494ad0008a72dbf
😎 Deploy Preview https://deploy-preview-579--kubernetes-sigs-kmm.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 27, 2023
@qbarrand
Copy link
Contributor

/ok-to-test
/lgtm

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Sep 27, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 27, 2023
@k8s-ci-robot
Copy link
Contributor

@mresvanis: The /retest command does not accept any targets.
The following commands are available to trigger required jobs:

  • /test pull-kernel-module-management-build
  • /test pull-kernel-module-management-check-api-changes
  • /test pull-kernel-module-management-check-commits-count
  • /test pull-kernel-module-management-lint
  • /test pull-kernel-module-management-unit-tests

Use /test all to run all jobs.

In response to this:

/retest pull-kernel-module-management-unit-tests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@mresvanis mresvanis marked this pull request as ready for review September 27, 2023 09:06
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 27, 2023
@k8s-ci-robot k8s-ci-robot merged commit f572c8e into kubernetes-sigs:main Sep 27, 2023
@mresvanis mresvanis deleted the fix-528-flaky-internal-cache-test branch September 27, 2023 09:17
qbarrand added a commit to qbarrand/kernel-module-management that referenced this pull request Nov 8, 2023
qbarrand pushed a commit to qbarrand/kernel-module-management that referenced this pull request Nov 8, 2023
…kubernetes-sigs#789)

This flaky test's root cause was that the StartCollecting method was
locking the map to delete the expired item, but the test code could be
writing to the map at the same time. By running the StartCollecting
after writing the items to the map, we get rid of the possiblity of
concurrent map read and write errors.

Signed-off-by: Michail Resvanis <[email protected]>

Upstream-Commit: f572c8e

Co-authored-by: Michail Resvanis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix flaky unit tests for internal/cache
3 participants