Closed mojtaba-esk closed 2 months ago
The changes introduce a namePrefix
constant to enhance instance naming in test functions within the netshaper_test.go
file, replacing hardcoded names to avoid collisions. Additionally, a mutex and atomic counter are added in suite_setup_test.go
to manage test cleanup operations safely, replacing the previous teardown method with a new approach that invokes cleanup after each test, ensuring resources are released appropriately.
Files | Change Summary |
---|---|
e2e/netshaper/netshaper_test.go |
Introduced namePrefix constant for dynamic instance naming to reduce collisions in tests. |
e2e/netshaper/suite_setup_test.go |
Added cleanupMu mutex and totalTests atomic counter for thread-safe cleanup management; replaced TearDownSuite with TearDownTest to improve control flow. |
sequenceDiagram
participant Test as Test Function
participant Suite as Test Suite
participant Cleanup as Cleanup Process
Test->>Suite: Start Test
Suite->>Suite: Increment totalTests
Suite->>Test: Execute Test
Test-->>Suite: Test Completed
Suite->>Suite: Increment finishedTests
alt All Tests Completed
Suite->>Cleanup: Trigger Cleanup
end
🐇 "In the land of tests, where all things align,
A prefix for names, oh how they shine!
With mutexes twirling and counters in play,
Cleanup is tidy, all in a day.
Hop, skip, and jump through each test with glee,
Our code now dances, as happy as can be!" 🎉
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
This PR proposes a set of small optimizations and cleanup procedure to run the netshaper tests smoother and faster
Please note that the system tests are filing due to a series of issues that are resolved in #535
Summary by CodeRabbit
New Features
Bug Fixes