Intermittent AboutIntegrationTest.test_0001_about page integration test failures
The About page integration tests are failing semi-regularly on test_develop with timeouts. One specifically listed the following:
Capybara::Poltergeist::StatusFailError: Request to 'http://127.0.0.1:37939/about' failed to reach server, check DNS and/or server status - Timed out with the following resources still waiting http://127.0.0.1:37939/compute_resources/304431216-another-ec2/ping,http://127.0.0.1:37939/compute_resources/980190962-bigcompute/ping,http://127.0.0.1:37939/compute_resources/30517511-gce123/ping,http://127.0.0.1:37939/compute_resources/367690737-mycompute/ping,http://127.0.0.1:37939/compute_resources/628705878-openstackcr/ping,http://127.0.0.1:37939/compute_resources/510899777-Ovirt/ping,http://127.0.0.1:37939/compute_resources/305613588-Vmware/ping,http://127.0.0.1:37939/compute_resources/932571420-yourcompute/ping,http://127.0.0.1:37939/assets/patternfly/PatternFlyIcons-webfont.ttf...
Others fail with:
RuntimeError: Requests did not finish in 60 seconds test/integration_test_helper.rb:104:in `block in <class:IntegrationTest>' (RuntimeError) /usr/local/rvm/gems/ruby-2.2.3@test_develop-2/gems/capybara-2.9.1/lib/capybara/server.rb:93
Another unrelated test (RoutingIntegrationTest.test_0001_should go to v1 controller for /v1/ passed in URL) failed with a compute resource ping timeout:
Excon::Error::Timeout: connect_write timeout reached app/models/compute_resources/foreman/model/ec2.rb:68:in `regions' app/models/compute_resources/foreman/model/ec2.rb:77:in `test_connection' app/models/compute_resource.rb:104:in `ping' app/controllers/compute_resources_controller.rb:84:in `block (2 levels) in ping' app/controllers/compute_resources_controller.rb:83:in `ping' app/controllers/concerns/application_shared.rb:14:in `set_timezone' app/models/concerns/foreman/thread_session.rb:32:in `clear_thread' lib/middleware/catch_json_parse_errors.rb:8:in `call' lib/middleware/tagged_logging.rb:18:in `call' (Excon::Error::Timeout) /usr/local/rvm/gems/ruby-2.3.0@test_develop-1/gems/excon-0.52.0/lib/excon/socket.rb:267
It looks likely that the smart proxies and compute resources being pinged from the about page via AJAX are not stubbed, so suffer from network timeouts.
fixes #16700 - change CatchJsonParseErrors test to cleanup driver
On completion, the Capybara driver was left unset causing the next test
to execute with the JS driver and introducing AJAX concurrency issues.
Using the integration test helpers ensures it's reset correctly.
The AboutIntegrationTest now uses the JS driver explicitly to test its
AJAX features, and stubs the network-based ping calls.
#2 Updated by Dominic Cleal over 3 years ago
The JS driver is usually unset during JS test teardown back to the default Capybara driver, but I think #16557 caused the JS driver to be left selected from a previous test. Probably because #16557 removed the separate rake task for the "lib" tests, the JS driver is being left selected after test/unit/middleware/catch_json_parse_errors_test.rb is executed. Previously this was only run in the separate "lib" rake task in another process.
The catch_json_parse_errors_test should probably be moved to use the proper integration test case classes if possible so it receives the same cleanup. At worst, it should reset the driver when complete.
The about page integration tests should also probably use the JS driver anyway to test the AJAX functionality, but with proper stubbing and waiting.