Commit 3d2f580c authored by Thong Kuah's avatar Thong Kuah

Fix hanging specs when decomposed

This is due to a Rails bug causing where FactoryBot thread, and Puma
thread are stuck with each other waiting for the
load_interlock_aware_monitor lock.

The fix is to ensure no Puma threads ocurr when FactoryBot factories are
being created. Here it is done by moving the visits to within the spec,
after the factory creation.

Previously the visits were in the before hook, which meant async
requests ran concurrently with factories.
parent 274e902f
......@@ -18,7 +18,6 @@ RSpec.describe 'Environment > Metrics' do
stub_any_prometheus_request
sign_in(user)
visit_environment(environment)
end
around do |example|
......@@ -27,6 +26,7 @@ RSpec.describe 'Environment > Metrics' do
shared_examples 'has environment selector' do
it 'has a working environment selector', :js do
visit_environment(environment)
click_link 'Monitoring'
expect(page).to have_current_path(project_metrics_dashboard_path(project, environment: environment.id))
......@@ -56,6 +56,7 @@ RSpec.describe 'Environment > Metrics' do
end
it 'shows metrics', :js do
visit_environment(environment)
click_link 'Monitoring'
expect(page).to have_css('[data-qa-selector="prometheus_graphs"]') # rubocop:disable QA/SelectorUsage
......
......@@ -15,11 +15,10 @@ RSpec.describe 'User browses a job', :js do
stub_feature_flags(bootstrap_confirmation_modals: false)
sign_in(user)
visit(project_job_path(project, build))
end
it 'erases the job log', :js do
visit(project_job_path(project, build))
wait_for_requests
expect(page).to have_content("Job #{build.name}")
......@@ -41,6 +40,7 @@ RSpec.describe 'User browses a job', :js do
let!(:build) { create(:ci_build, :success, :unarchived_trace_artifact, :coverage, pipeline: pipeline) }
it 'shows no trace message', :js do
visit(project_job_path(project, build))
wait_for_requests
expect(page).to have_content('This job does not have a trace.')
......@@ -51,6 +51,7 @@ RSpec.describe 'User browses a job', :js do
let!(:build) { create(:ci_build, :failed, :trace_live, pipeline: pipeline) }
it 'displays the failure reason' do
visit(project_job_path(project, build))
wait_for_all_requests
within('.builds-container') do
expect(page).to have_selector(
......@@ -62,6 +63,7 @@ RSpec.describe 'User browses a job', :js do
let!(:artifact) { create(:ci_job_artifact, :unarchived_trace_artifact, job: build) }
it 'displays the failure reason from the live trace' do
visit(project_job_path(project, build))
wait_for_all_requests
within('.builds-container') do
expect(page).to have_selector(
......@@ -75,6 +77,7 @@ RSpec.describe 'User browses a job', :js do
let!(:build_retried) { create(:ci_build, :failed, :retried, :trace_artifact, pipeline: pipeline) }
it 'displays the failure reason and retried label' do
visit(project_job_path(project, build))
wait_for_all_requests
within('.builds-container') do
expect(page).to have_selector(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment