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 unit tests to avoid data race in pipelines #2602

Merged
merged 3 commits into from
Sep 26, 2024

Conversation

salonichf5
Copy link
Contributor

@salonichf5 salonichf5 commented Sep 25, 2024

Proposed changes

Write a clear and concise description that helps reviewers understand the purpose and impact of your changes. Use the
following format:

Problem: Users want to parallelize unit tests without having data race issues

Solution: Modify unit tests to be independent of variables, maps/structs to avoid data race when tests run in parallel.

Testing: Manual Testing

  1. run make unit-test 10-12 times. Passes all the time
  2. run tests 10-12 times in the folder https://github.com/nginxinc/nginx-gateway-fabric/tree/main/internal/mode/static/state/graph , where most of the data race failures were happening.

Please focus on (optional): If you any specific areas where you would like reviewers to focus their attention or provide
specific feedback, add them here.

Closes #2569
Closes #2578

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

Release notes

If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.


@salonichf5 salonichf5 requested a review from a team as a code owner September 25, 2024 01:48
@github-actions github-actions bot added the bug Something isn't working label Sep 25, 2024
Copy link

codecov bot commented Sep 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.01%. Comparing base (d490d7e) to head (063446f).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2602      +/-   ##
==========================================
- Coverage   89.20%   89.01%   -0.19%     
==========================================
  Files         100       99       -1     
  Lines        7642     7413     -229     
  Branches       50        0      -50     
==========================================
- Hits         6817     6599     -218     
+ Misses        768      757      -11     
  Partials       57       57              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@salonichf5 salonichf5 requested a review from a team as a code owner September 25, 2024 17:51
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Sep 25, 2024
@salonichf5 salonichf5 requested a review from sjberman September 25, 2024 17:52
docs/developer/testing.md Outdated Show resolved Hide resolved
docs/developer/testing.md Outdated Show resolved Hide resolved
docs/developer/testing.md Outdated Show resolved Hide resolved
Copy link
Contributor

@ADubhlaoich ADubhlaoich left a comment

Choose a reason for hiding this comment

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

PR is primarily code so I will not approve, but the documentation explaining the unit tests is clear.

@salonichf5 salonichf5 enabled auto-merge (squash) September 26, 2024 16:11
@salonichf5 salonichf5 merged commit 57676d9 into nginxinc:main Sep 26, 2024
38 checks passed
salonichf5 added a commit that referenced this pull request Oct 8, 2024
Fix unit tests to avoid data race in pipelines

Problem: Users want to parallelize unit tests without having data race issues
Solution: Modify unit tests to be independent of variables, maps/structs to avoid data race when tests run in parallel.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
Archived in project
6 participants