Flaky test: ee/spec/features/markdown/metrics_spec.rb
As seen in https://gitlab.com/gitlab-org/gitlab/-/jobs/740821671:
Failures:
1) Metrics rendering for GitLab-managed alerting rules unlicensed shows no embedded metrics
Failure/Error: httparty_perform_request(http_method, path, options_with_timeouts, &block)
WebMock::NetConnectNotAllowedError:
Real HTTP connections are disabled. Unregistered request: GET https://prometheus.example.com/api/v1/query_range?end=2020-09-16T12:33:51.553Z&query=sum(rate(nginx_server_requests%7Bcode=~%225.*%22,%20host=%22*%22,%20container_name!=%22POD%22,environment=%22environment5%22%20%7D%5B2m%5D))%20/%20sum(rate(nginx_server_requests%7Bcode=%22total%22,%20host=%22*%22,%20container_name!=%22POD%22,environment=%22environment5%22%20%7D%5B2m%5D))%20*%20100&start=2020-09-16T04:33:51.553Z&step=60 with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}
You can stub this request with the following snippet:
stub_request(:get, "https://prometheus.example.com/api/v1/query_range?end=2020-09-16T12:33:51.553Z&query=sum(rate(nginx_server_requests%7Bcode=~%225.*%22,%20host=%22*%22,%20container_name!=%22POD%22,environment=%22environment5%22%20%7D%5B2m%5D))%20/%20sum(rate(nginx_server_requests%7Bcode=%22total%22,%20host=%22*%22,%20container_name!=%22POD%22,environment=%22environment5%22%20%7D%5B2m%5D))%20*%20100&start=2020-09-16T04:33:51.553Z&step=60").
with(
headers: {
'Accept'=>'*/*',
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
'User-Agent'=>'Ruby'
}).
to_return(status: 200, body: "", headers: {})
============================================================
# ./vendor/ruby/2.6.0/gems/webmock-3.5.1/lib/webmock/http_lib_adapters/net_http.rb:114:in `request'
# ./vendor/ruby/2.6.0/gems/httparty-0.16.4/lib/httparty/request.rb:146:in `perform'
# ./vendor/ruby/2.6.0/gems/httparty-0.16.4/lib/httparty.rb:573:in `perform_request'
# ./lib/gitlab/http.rb:44:in `perform_request'
# ./vendor/ruby/2.6.0/gems/httparty-0.16.4/lib/httparty.rb:491:in `get'
# ./lib/gitlab/prometheus_client.rb:140:in `get'
# ./lib/gitlab/prometheus_client.rb:47:in `proxy'
# ./app/services/prometheus/proxy_service.rb:86:in `calculate_reactive_cache'
# ./app/models/concerns/reactive_caching.rb:94:in `block (2 levels) in exclusively_update_reactive_cache!'
# ./app/models/concerns/reactive_caching.rb:153:in `enqueuing_update'
# ./app/models/concerns/reactive_caching.rb:93:in `block in exclusively_update_reactive_cache!'
# ./app/models/concerns/reactive_caching.rb:143:in `locking_reactive_cache'
# ./app/models/concerns/reactive_caching.rb:89:in `exclusively_update_reactive_cache!'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/core_ext/object/try.rb:15:in `public_send'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/core_ext/object/try.rb:15:in `try'
# ./app/workers/concerns/reactive_cacheable_worker.rb:30:in `perform'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/testing.rb:301:in `execute_job'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/testing.rb:296:in `block in process_job'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:128:in `block in invoke'
# ./spec/support/sidekiq_middleware.rb:29:in `call'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
# ./lib/gitlab/sidekiq_middleware/duplicate_jobs/strategies/until_executing.rb:32:in `perform'
# ./lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb:40:in `perform'
# ./lib/gitlab/sidekiq_middleware/duplicate_jobs/server.rb:8:in `call'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
# ./lib/gitlab/sidekiq_middleware/worker_context.rb:9:in `wrap_in_optional_context'
# ./lib/gitlab/sidekiq_middleware/worker_context/server.rb:16:in `call'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
# ./lib/gitlab/sidekiq_status/server_middleware.rb:7:in `call'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
# ./lib/gitlab/sidekiq_versioning/middleware.rb:9:in `call'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
# ./lib/gitlab/sidekiq_middleware/admin_mode/server.rb:13:in `call'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
# ./lib/gitlab/sidekiq_middleware/instrumentation_logger.rb:7:in `call'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
# ./vendor/ruby/2.6.0/gems/gitlab-labkit-0.12.1/lib/labkit/middleware/sidekiq/server.rb:21:in `block in call'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:128:in `block in invoke'
# ./vendor/ruby/2.6.0/gems/gitlab-labkit-0.12.1/lib/labkit/middleware/sidekiq/context/server.rb:14:in `block in call'
# ./vendor/ruby/2.6.0/gems/gitlab-labkit-0.12.1/lib/labkit/context.rb:32:in `with_context'
# ./vendor/ruby/2.6.0/gems/gitlab-labkit-0.12.1/lib/labkit/middleware/sidekiq/context/server.rb:13:in `call'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:133:in `invoke'
# ./vendor/ruby/2.6.0/gems/gitlab-labkit-0.12.1/lib/labkit/middleware/sidekiq/server.rb:20:in `call'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
# ./lib/gitlab/sidekiq_middleware/batch_loader.rb:7:in `call'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
# ./lib/gitlab/sidekiq_middleware/extra_done_log_metadata.rb:7:in `call'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
# ./spec/support/sidekiq_middleware.rb:42:in `call'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
# ./lib/gitlab/sidekiq_middleware/request_store_middleware.rb:10:in `block in call'
# ./lib/gitlab/with_request_store.rb:8:in `with_request_store'
# ./lib/gitlab/sidekiq_middleware/request_store_middleware.rb:9:in `call'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
# ./lib/gitlab/sidekiq_middleware/monitor.rb:8:in `block in call'
# ./lib/gitlab/sidekiq_daemon/monitor.rb:49:in `within_job'
# ./lib/gitlab/sidekiq_middleware/monitor.rb:7:in `call'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/middleware/chain.rb:133:in `invoke'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/testing.rb:295:in `process_job'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/testing.rb:89:in `block in raw_push'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/testing.rb:85:in `each'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/testing.rb:85:in `raw_push'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/client.rb:74:in `push'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/worker.rb:149:in `client_push'
# ./vendor/ruby/2.6.0/gems/sidekiq-5.2.9/lib/sidekiq/worker.rb:93:in `perform_async'
# ./config/initializers/forbid_sidekiq_in_transactions.rb:36:in `block (2 levels) in <module:NoEnqueueingFromTransactions>'
# ./app/models/concerns/reactive_caching.rb:122:in `refresh_reactive_cache!'
# ./app/models/concerns/reactive_caching.rb:47:in `with_reactive_cache'
# ./app/services/prometheus/proxy_service.rb:78:in `execute'
# ./app/controllers/concerns/metrics/dashboard/prometheus_api_proxy.rb:24:in `prometheus_proxy'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/abstract_controller/base.rb:195:in `process_action'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:112:in `block in run_callbacks'
# ./ee/lib/gitlab/ip_address_state.rb:10:in `with'
# ./ee/app/controllers/ee/application_controller.rb:44:in `set_current_ip_address'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
# ./lib/gitlab/auth/current_user_mode.rb:56:in `with_current_admin'
# ./app/controllers/application_controller.rb:494:in `set_current_admin'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
# ./lib/gitlab/session.rb:11:in `with_session'
# ./app/controllers/application_controller.rb:482:in `set_session_storage'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
# ./lib/gitlab/i18n.rb:73:in `with_locale'
# ./lib/gitlab/i18n.rb:79:in `with_user_locale'
# ./app/controllers/application_controller.rb:476:in `set_locale'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
# ./lib/gitlab/error_tracking.rb:52:in `with_context'
# ./app/controllers/application_controller.rb:541:in `sentry_context'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
# ./vendor/ruby/2.6.0/gems/marginalia-1.9.0/lib/marginalia.rb:111:in `record_query_comment'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
# ./vendor/ruby/2.6.0/gems/sentry-raven-3.0.4/lib/raven/integrations/rails/controller_transaction.rb:7:in `block in included'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `instance_exec'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
# ./app/controllers/application_controller.rb:469:in `block in set_current_context'
# ./lib/gitlab/application_context.rb:52:in `block in use'
# ./vendor/ruby/2.6.0/gems/gitlab-labkit-0.12.1/lib/labkit/context.rb:32:in `with_context'
# ./lib/gitlab/application_context.rb:52:in `use'
# ./lib/gitlab/application_context.rb:20:in `with_context'
# ./app/controllers/application_controller.rb:462:in `set_current_context'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:139:in `run_callbacks'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/notifications.rb:180:in `block in instrument'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/notifications.rb:180:in `instrument'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
# ./vendor/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/abstract_controller/base.rb:136:in `process'
# ./vendor/ruby/2.6.0/gems/actionview-6.0.3.1/lib/action_view/rendering.rb:39:in `process'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_controller/metal.rb:190:in `dispatch'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_controller/metal.rb:254:in `dispatch'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/routing/route_set.rb:33:in `serve'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/routing/mapper.rb:48:in `serve'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/journey/router.rb:49:in `block in serve'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/journey/router.rb:32:in `each'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/journey/router.rb:32:in `serve'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/routing/route_set.rb:834:in `call'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:420:in `call_app!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:274:in `mock_call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:186:in `call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:420:in `call_app!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:274:in `mock_call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:186:in `call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:420:in `call_app!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:274:in `mock_call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:186:in `call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:420:in `call_app!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:274:in `mock_call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:186:in `call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:420:in `call_app!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:274:in `mock_call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:186:in `call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:420:in `call_app!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:274:in `mock_call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:186:in `call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:420:in `call_app!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:274:in `mock_call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:186:in `call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:420:in `call_app!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:274:in `mock_call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:186:in `call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:420:in `call_app!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:274:in `mock_call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:186:in `call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:420:in `call_app!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:274:in `mock_call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:186:in `call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:420:in `call_app!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:274:in `mock_call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:186:in `call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:420:in `call_app!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:274:in `mock_call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:186:in `call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:420:in `call_app!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:274:in `mock_call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:186:in `call!'
# ./vendor/ruby/2.6.0/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
# ./lib/gitlab/request_profiler/middleware.rb:17:in `call'
# ./lib/gitlab/query_limiting/middleware.rb:17:in `block in call'
# ./lib/gitlab/query_limiting/transaction.rb:39:in `run'
# ./lib/gitlab/query_limiting/middleware.rb:16:in `call'
# ./vendor/ruby/2.6.0/gems/gitlab-labkit-0.12.1/lib/labkit/middleware/rack.rb:19:in `block in call'
# ./vendor/ruby/2.6.0/gems/gitlab-labkit-0.12.1/lib/labkit/context.rb:32:in `with_context'
# ./vendor/ruby/2.6.0/gems/gitlab-labkit-0.12.1/lib/labkit/middleware/rack.rb:18:in `call'
# ./lib/gitlab/jira/middleware.rb:19:in `call'
# ./lib/gitlab/middleware/go.rb:20:in `call'
# ./lib/gitlab/etag_caching/middleware.rb:13:in `call'
# ./vendor/ruby/2.6.0/gems/batch-loader-1.4.0/lib/batch_loader/middleware.rb:11:in `call'
# ./vendor/ruby/2.6.0/gems/bullet-6.1.0/lib/bullet/rack.rb:12:in `call'
# ./vendor/ruby/2.6.0/gems/rack-attack-6.3.0/lib/rack/attack.rb:97:in `call'
# ./vendor/ruby/2.6.0/gems/apollo_upload_server-2.0.2/lib/apollo_upload_server/middleware.rb:20:in `call'
# ./lib/gitlab/middleware/multipart.rb:142:in `call'
# ./vendor/ruby/2.6.0/gems/rack-attack-6.3.0/lib/rack/attack.rb:111:in `call'
# ./vendor/ruby/2.6.0/gems/warden-1.2.8/lib/warden/manager.rb:36:in `block in call'
# ./vendor/ruby/2.6.0/gems/warden-1.2.8/lib/warden/manager.rb:34:in `catch'
# ./vendor/ruby/2.6.0/gems/warden-1.2.8/lib/warden/manager.rb:34:in `call'
# ./vendor/ruby/2.6.0/gems/rack-cors-1.0.6/lib/rack/cors.rb:98:in `call'
# ./vendor/ruby/2.6.0/gems/rack-2.0.9/lib/rack/tempfile_reaper.rb:15:in `call'
# ./vendor/ruby/2.6.0/gems/rack-2.0.9/lib/rack/etag.rb:25:in `call'
# ./vendor/ruby/2.6.0/gems/rack-2.0.9/lib/rack/conditional_get.rb:25:in `call'
# ./vendor/ruby/2.6.0/gems/rack-2.0.9/lib/rack/head.rb:12:in `call'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
# ./lib/gitlab/middleware/read_only/controller.rb:51:in `call'
# ./lib/gitlab/middleware/read_only.rb:18:in `call'
# ./vendor/ruby/2.6.0/gems/rack-2.0.9/lib/rack/session/abstract/id.rb:259:in `context'
# ./vendor/ruby/2.6.0/gems/rack-2.0.9/lib/rack/session/abstract/id.rb:253:in `call'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/cookies.rb:648:in `call'
# ./lib/gitlab/middleware/same_site_cookies.rb:27:in `call'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:101:in `run_callbacks'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
# ./lib/gitlab/middleware/basic_health_check.rb:25:in `call'
# ./vendor/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/rack/logger.rb:37:in `call_app'
# ./vendor/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/rack/logger.rb:26:in `block in call'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/tagged_logging.rb:80:in `block in tagged'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/tagged_logging.rb:28:in `tagged'
# ./vendor/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/tagged_logging.rb:80:in `tagged'
# ./vendor/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/rack/logger.rb:26:in `call'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
# ./lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'
# ./lib/gitlab/middleware/request_context.rb:23:in `call'
# ./vendor/ruby/2.6.0/gems/request_store-1.5.0/lib/request_store/middleware.rb:19:in `call'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/request_id.rb:27:in `call'
# ./vendor/ruby/2.6.0/gems/rack-2.0.9/lib/rack/method_override.rb:22:in `call'
# ./vendor/ruby/2.6.0/gems/rack-2.0.9/lib/rack/runtime.rb:22:in `call'
# ./config/initializers/fix_local_cache_middleware.rb:9:in `call'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/static.rb:126:in `call'
# ./lib/gitlab/middleware/static.rb:11:in `call'
# ./lib/gitlab/testing/clear_process_memory_cache_middleware.rb:13:in `call'
# ./lib/gitlab/testing/request_inspector_middleware.rb:33:in `call'
# ./lib/gitlab/testing/robots_blocker_middleware.rb:30:in `call'
# ./lib/gitlab/testing/request_blocker_middleware.rb:47:in `call'
# ./vendor/ruby/2.6.0/gems/rack-2.0.9/lib/rack/sendfile.rb:111:in `call'
# ./vendor/ruby/2.6.0/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/host_authorization.rb:76:in `call'
# ./lib/gitlab/metrics/requests_rack_middleware.rb:60:in `call'
# ./vendor/ruby/2.6.0/gems/sentry-raven-3.0.4/lib/raven/integrations/rack.rb:51:in `call'
# ./vendor/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/engine.rb:527:in `call'
# ./vendor/ruby/2.6.0/gems/rack-2.0.9/lib/rack/urlmap.rb:68:in `block in call'
# ./vendor/ruby/2.6.0/gems/rack-2.0.9/lib/rack/urlmap.rb:53:in `each'
# ./vendor/ruby/2.6.0/gems/rack-2.0.9/lib/rack/urlmap.rb:53:in `call'
# ./vendor/ruby/2.6.0/gems/capybara-3.33.0/lib/capybara/server/middleware.rb:58:in `call'
# ./vendor/ruby/2.6.0/gems/gitlab-puma-4.3.5.gitlab.3/lib/puma/configuration.rb:228:in `call'
# ./vendor/ruby/2.6.0/gems/gitlab-puma-4.3.5.gitlab.3/lib/puma/server.rb:722:in `handle_request'
# ./vendor/ruby/2.6.0/gems/gitlab-puma-4.3.5.gitlab.3/lib/puma/server.rb:481:in `process_client'
# ./vendor/ruby/2.6.0/gems/gitlab-puma-4.3.5.gitlab.3/lib/puma/server.rb:335:in `block in run'
# ./vendor/ruby/2.6.0/gems/gitlab-puma-4.3.5.gitlab.3/lib/puma/thread_pool.rb:138:in `block in spawn_thread'
Finished in 13 minutes 27 seconds (files took 56.84 seconds to load)
158 examples, 1 failure, 6 pending
Failed examples:
rspec ./ee/spec/features/markdown/metrics_spec.rb:71 # Metrics rendering for GitLab-managed alerting rules unlicensed shows no embedded metrics
SimpleCov failed with exit 1
I've been able to reproduce a similar issue pretty consistently via the following, though I'm not sure if it's an order-dependent spec but rather just a timing one:
bundle exec rspec ee/spec/features/projects/members/invite_group_and_members_spec.rb ee/spec/features/markdown/metrics_spec.rb
It looks like this has something to do with the WebMock changes in !30422 (merged). https://github.com/bblimke/webmock/blob/master/README.md#connecting-on-nethttpstart and https://github.com/teamcapybara/capybara/issues/2322#issuecomment-619321520 have for more details.
When I reproduced the failure, it almost seemed as the HTTP requests happened after the example finished, as though some Ajax request or Sidekiq task was finished. I see this error:
2020-09-16 09:24:42 -0700: Rack app error handling request { GET /namespace1/project15/-/clusters/3/prometheus/api/v1/query_range }
I'm wondering if this is occuring because WebMock stopped mocking outside the example.
I also noticed that the example issued a GET request to https://kubernetes.example.com/api/v1
9 or 10 times! Memoizing didn't help; I suspect we make one HTTP call per Prometheus query?