nginx-gateway-fabric
nginx-gateway-fabric copied to clipboard
Fix unit tests to avoid data race in pipelines
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
- run
make unit-test10-12 times. Passes all the time - 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.
- [x] I have read the CONTRIBUTING doc
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] I have checked that all unit tests pass after adding my changes
- [ ] I have updated necessary documentation
- [x] I have rebased my branch onto main
- [x] 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.