-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[rb] ensure the grid is properly restarted in tests when there is a problem #16842
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
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||
ac7d38d to
56b26d9
Compare
56b26d9 to
840429d
Compare
User description
We sometimes get test failures if the grid dies and it affects all tests after that. This should isolate the problem to the one place it happens, or if it is expected, will properly refresh.
💥 What does this PR do?
#ensure_gridmethod to test_environment to make sure the grid is good every time a remote driver is created, andbefore(:suite)🔧 Implementation Notes
#reset_driver!or whendriveris used after a#quit_driver; By default it happens at the end of every failing test.💡 Additional Considerations
I'm seeing a bunch of hard coded driver instantiation in the test code we need to remove
🔄 Types of changes
PR Type
Bug fix, Enhancement
Description
Add
status_ok?method to verify grid health via process, socket, and HTTP status endpointImplement
ensure_gridmethod to automatically restart grid before remote driver creationImprove error handling in
reset_remote_serverwith try-catch-finally patternCall
ensure_gridinremote_driverandbefore(:suite)to prevent cascading test failuresDiagram Walkthrough
File Walkthrough
server.rb
Add grid health status verification methodrb/lib/selenium/server.rb
status_ok?method to verify grid health by checking process alivestatus, socket connection, and HTTP status endpoint
spec_helper.rb
Use ensure_grid in test suite setuprb/spec/integration/selenium/webdriver/spec_helper.rb
remote_server.startwithensure_gridcall inbefore(:suite)hook
runs
test_environment.rb
Add grid health checks and auto-restart logicrb/spec/integration/selenium/webdriver/spec_support/test_environment.rb
remote_server.stopin error handling to prevent failures fromblocking cleanup
remote_server?to checkstatus_ok?instead of nil check foractual health verification
ensure_gridmethod that restarts grid if it's not healthyensure_gridinremote_drivermethod before creating remote driverinstances
server.rbs
Update type signatures for status_ok?rb/sig/lib/selenium/server.rbs
status_ok?method returning boolean