Commit 27636084 authored by Mark Lapierre's avatar Mark Lapierre Committed by Chloe Liu

Wait until project imports before proceeding

We wait so that the project repository is created before we
try to use it.
parent d5c05af3
......@@ -105,7 +105,16 @@ module QA
def fabricate_via_api!
resource_web_url(api_get)
rescue ResourceNotFoundError
super
response = super
# If a project is being imported, wait until it completes before we let the test continue.
# Otherwise we see Git repository errors
# See https://gitlab.com/gitlab-org/gitlab/-/issues/356101
Support::Retrier.retry_until(max_duration: 60, sleep_interval: 5) do
%w[none finished].include?(reload!.api_resource[:import_status])
end
response
end
def api_get_path
......
# frozen_string_literal: true
module QA
RSpec.describe 'Create' do
describe 'Create a new project from a template' do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'templated-project'
project.template_name = 'dotnetcore'
end
end
it 'commits via the api' do
expect do
Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = project
commit.update_files(
[
{
file_path: '.gitlab-ci.yml',
content: 'script'
}
]
)
commit.add_files(
[
{
file_path: 'foo',
content: 'bar'
}
]
)
end
end.not_to raise_exception
end
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