Project

General

Profile

Bug #16700

Intermittent AboutIntegrationTest.test_0001_about page integration test failures

Added by Dominic Cleal over 3 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Tests
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

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.


Related issues

Related to Foreman - Refactor #16557: Move tests into test/models, controllers, helpers dirs.Closed2016-09-14
Related to Foreman - Bug #18239: Intermittent AboutIntegrationTest.test_0002_about page failures, AJAX expectations not satisfiedClosed2017-01-25

Associated revisions

Revision 3b35e692 (diff)
Added by Dominic Cleal over 3 years ago

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.

History

#1 Updated by Dominic Cleal over 3 years ago

  • Status changed from New to Assigned
  • Assignee set to Dominic Cleal

#2 Updated by Dominic Cleal over 3 years ago

What appears to be happening is that the AboutIntegrationTest is actually executed with the Capybara JavaScript driver rather than the regular non-JS driver. This causes the AJAX requests to be made and since there's no wait_for_ajax or stubbing of the CR/proxy pings, this causes the test to overrun and fail.

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.

#3 Updated by Dominic Cleal over 3 years ago

  • Related to Refactor #16557: Move tests into test/models, controllers, helpers dirs. added

#4 Updated by Dominic Cleal over 3 years ago

Run the tests together with ruby -Itest -e "require 'unit/middleware/catch_json_parse_errors_test.rb'; require 'integration/about_test.rb'" to see in the test log the about page AJAX requests being made after catch_json_parse_errors runs.

#5 Updated by The Foreman Bot over 3 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3899 added

#6 Updated by Dominic Cleal over 3 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#7 Updated by Dominic Cleal over 3 years ago

  • Legacy Backlogs Release (now unused) set to 189

#8 Updated by Dominic Cleal about 3 years ago

  • Related to Bug #18239: Intermittent AboutIntegrationTest.test_0002_about page failures, AJAX expectations not satisfied added

Also available in: Atom PDF