Commit 0e697050 authored by Ramya Authappan's avatar Ramya Authappan

Merge branch 'ml-more-mirroring-test-updates' into 'master'

Mirroring test fixes

See merge request gitlab-org/gitlab!82166
parents 2072d057 526002a3
......@@ -121,6 +121,8 @@ module QA
end
def has_file?(name)
return false unless has_element?(:file_tree_table)
within_element(:file_tree_table) do
has_element?(:file_name_link, text: name)
end
......
......@@ -373,6 +373,18 @@ module QA
api_post_to(api_wikis_path, title: title, content: content)
end
# Uses the API to wait until a pull mirroring update is successful (pull mirroring is treated as an import)
def wait_for_pull_mirroring
mirror_succeeded = Support::Retrier.retry_until(max_duration: 180, raise_on_failure: false, sleep_interval: 1) do
reload!
api_resource[:import_status] == "finished"
end
unless mirror_succeeded
raise "Mirroring failed with error: #{api_resource[:import_error]}"
end
end
protected
# Return subset of fields for comparing projects
......
......@@ -38,7 +38,7 @@ module QA
# Check that the target project has the commit from the source
target_project.visit!
Page::Project::Show.perform do |project_page|
expect { project_page.has_file?('README.md') }.to eventually_be_truthy.within(max_duration: 60), "Expected a file named README.md but it did not appear."
expect { project_page.has_file?('README.md') }.to eventually_be_truthy.within(max_duration: 60, reload_page: page), "Expected a file named README.md but it did not appear."
expect(project_page).to have_readme_content('The rendered file could not be displayed because it is stored in LFS')
end
end
......
......@@ -29,7 +29,8 @@ module QA
mirror_settings.authentication_method = 'Password'
mirror_settings.password = Runtime::User.password
mirror_settings.mirror_repository
mirror_settings.update target_project_uri # rubocop:disable Rails/SaveBang
mirror_settings.update(target_project_uri) # rubocop:disable Rails/SaveBang
mirror_settings.verify_update(target_project_uri)
end
end
......@@ -37,7 +38,7 @@ module QA
target_project.visit!
Page::Project::Show.perform do |project|
expect { project.has_file?('README.md') }.to eventually_be_truthy.within(max_duration: 60), "Expected a file named README.md but it did not appear."
expect { project.has_file?('README.md') }.to eventually_be_truthy.within(max_duration: 60, reload_page: page), "Expected a file named README.md but it did not appear."
expect(project).to have_content('This is a test project')
end
end
......
......@@ -29,7 +29,11 @@ module QA
mirror_settings.authentication_method = 'Password'
mirror_settings.password = Runtime::User.admin_password
mirror_settings.mirror_repository
mirror_settings.update source_project_uri # rubocop:disable Rails/SaveBang
mirror_settings.update(source_project_uri) # rubocop:disable Rails/SaveBang
target_project.wait_for_pull_mirroring
mirror_settings.verify_update(source_project_uri)
end
end
......@@ -37,7 +41,7 @@ module QA
target_project.visit!
Page::Project::Show.perform do |project|
expect { project.has_file?('README.md') }.to eventually_be_truthy.within(max_duration: 60), "Expected a file named README.md but it did not appear."
expect { project.has_file?('README.md') }.to eventually_be_truthy.within(max_duration: 60, reload_page: page), "Expected a file named README.md but it did not appear."
expect(project).to have_readme_content('This is a pull mirroring test project')
expect(project).to have_text("Mirrored from #{masked_url(source_project_uri)}")
end
......
......@@ -60,15 +60,7 @@ module QA
settings.expand_mirroring_repositories do |mirror_settings|
mirror_settings.update(source_project_uri) # rubocop:disable Rails/SaveBang
# Use the API to wait until the update was successful (pull mirroring is treated as an import)
mirror_succeeded = mirror_settings.wait_until(reload: false, max_duration: 180, sleep_interval: 1, raise_on_failure: false) do
target_project.reload!
target_project.api_resource[:import_status] == "finished"
end
unless mirror_succeeded
raise "Mirroring failed with error: #{target_project.api_resource[:import_error]}"
end
target_project.wait_for_pull_mirroring
mirror_settings.verify_update(source_project_uri)
end
......@@ -77,7 +69,7 @@ module QA
# Check that the target project has the commit from the source
target_project.visit!
Page::Project::Show.perform do |project|
expect { project.has_file?('README.md') }.to eventually_be_truthy.within(max_duration: 60), "Expected a file named README.md but it did not appear."
expect { project.has_file?('README.md') }.to eventually_be_truthy.within(max_duration: 60, reload_page: page), "Expected a file named README.md but it did not appear."
expect(project).to have_readme_content('This is a pull mirroring test project')
expect(project).to have_text("Mirrored from #{masked_url(source_project_uri)}")
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