Commit ab5c97b1 authored by Dylan Griffith's avatar Dylan Griffith

Fix race condition in spec/features/projects/clusters/applications_spec.rb

This was not happening very often but with the previous changes to
create SSL certs for helm tiller it takes long enough to be created that
we see the test failing a lot more
parent 11edbccc
......@@ -46,12 +46,14 @@ describe 'Clusters Applications', :js do
end
end
it 'he sees status transition' do
it 'they see status transition' do
page.within('.js-cluster-application-row-helm') do
# FE sends request and gets the response, then the buttons is "Install"
expect(page.find(:css, '.js-cluster-application-install-button')['disabled']).to eq('true')
expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Install')
wait_until_helm_created!
Clusters::Cluster.last.application_helm.make_installing!
# FE starts polling and update the buttons to "Installing"
......@@ -83,7 +85,7 @@ describe 'Clusters Applications', :js do
end
end
it 'he sees status transition' do
it 'they see status transition' do
page.within('.js-cluster-application-row-ingress') do
# FE sends request and gets the response, then the buttons is "Install"
expect(page).to have_css('.js-cluster-application-install-button[disabled]')
......@@ -116,4 +118,12 @@ describe 'Clusters Applications', :js do
end
end
end
def wait_until_helm_created!
retries = 0
while Clusters::Cluster.last.application_helm.nil? do
raise "Timed out waiting for helm application to be created in DB" if (retries += 1) > 3
sleep(1)
end
end
end
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