Commit 9d17fe16 authored by Sanad Liaquat's avatar Sanad Liaquat

Merge branch 'jsl-geo-attachment-and-api-use-updates' into 'master'

Refactor Geo end-to-end specs

See merge request gitlab-org/gitlab!25381
parents ceffcc4c dbe50cdb
...@@ -78,6 +78,17 @@ module QA ...@@ -78,6 +78,17 @@ module QA
def weight_no_value_content def weight_no_value_content
find_element(:weight_no_value_content) find_element(:weight_no_value_content)
end end
def wait_for_attachment_replication(image_url, max_wait: Runtime::Geo.max_file_replication_time)
QA::Runtime::Logger.debug(%Q[#{self.class.name} - wait_for_attachment_replication])
wait_until_geo_max_replication_time(max_wait: max_wait) do
asset_exists?(image_url)
end
end
def wait_until_geo_max_replication_time(max_wait: Runtime::Geo.max_file_replication_time)
wait_until(max_duration: max_wait) { yield }
end
end end
end end
end end
......
...@@ -7,12 +7,12 @@ module QA ...@@ -7,12 +7,12 @@ module QA
it 'user uploads attachment to the primary node' do it 'user uploads attachment to the primary node' do
QA::Flow::Login.while_signed_in(address: :geo_primary) do QA::Flow::Login.while_signed_in(address: :geo_primary) do
@project = Resource::Project.fabricate! do |project| @project = Resource::Project.fabricate_via_api! do |project|
project.name = 'project-for-issues' project.name = 'project-for-issues'
project.description = 'project for adding issues' project.description = 'project for adding issues'
end end
@issue = Resource::Issue.fabricate! do |issue| @issue = Resource::Issue.fabricate_via_api! do |issue|
issue.title = 'My geo issue' issue.title = 'My geo issue'
issue.project = @project issue.project = @project
end end
...@@ -52,10 +52,7 @@ module QA ...@@ -52,10 +52,7 @@ module QA
image_url = find('a[href$="banana_sample.gif"]')[:href] image_url = find('a[href$="banana_sample.gif"]')[:href]
Page::Project::Issue::Show.perform do |show| Page::Project::Issue::Show.perform do |show|
# Wait for attachment replication found = show.wait_for_attachment_replication(image_url)
found = show.wait_until(reload: false) do
show.asset_exists?(image_url)
end
expect(found).to be_truthy expect(found).to be_truthy
end end
......
...@@ -12,7 +12,7 @@ module QA ...@@ -12,7 +12,7 @@ module QA
QA::Flow::Login.while_signed_in(address: :geo_primary) do QA::Flow::Login.while_signed_in(address: :geo_primary) do
# Create a new Project # Create a new Project
project = Resource::Project.fabricate! do |project| project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-project' project.name = 'geo-project'
project.description = 'Geo test project' project.description = 'Geo test project'
end end
...@@ -66,7 +66,7 @@ module QA ...@@ -66,7 +66,7 @@ module QA
project = nil project = nil
QA::Flow::Login.while_signed_in(address: :geo_primary) do QA::Flow::Login.while_signed_in(address: :geo_primary) do
project = Resource::Project.fabricate! do |project| project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-project' project.name = 'geo-project'
project.description = 'Geo test project' project.description = 'Geo test project'
end end
......
...@@ -15,7 +15,7 @@ module QA ...@@ -15,7 +15,7 @@ module QA
QA::Flow::Login.while_signed_in(address: :geo_primary) do QA::Flow::Login.while_signed_in(address: :geo_primary) do
# Create a new Project # Create a new Project
project = Resource::Project.fabricate! do |project| project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-project' project.name = 'geo-project'
project.description = 'Geo test project' project.description = 'Geo test project'
end end
...@@ -96,7 +96,7 @@ module QA ...@@ -96,7 +96,7 @@ module QA
QA::Flow::Login.while_signed_in(address: :geo_primary) do QA::Flow::Login.while_signed_in(address: :geo_primary) do
# Create a new Project # Create a new Project
project = Resource::Project.fabricate! do |project| project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-project' project.name = 'geo-project'
project.description = 'Geo test project' project.description = 'Geo test project'
end end
......
...@@ -4,21 +4,24 @@ module QA ...@@ -4,21 +4,24 @@ module QA
context 'Geo', :orchestrated, :geo do context 'Geo', :orchestrated, :geo do
describe 'GitLab Geo project rename replication' do describe 'GitLab Geo project rename replication' do
it 'user renames project' do it 'user renames project' do
original_project_name = 'geo-before-rename'
original_readme_content = "The original project name was #{original_project_name}"
readme_file_name = 'README.md'
# create the project and push code # create the project and push code
QA::Flow::Login.while_signed_in(address: :geo_primary) do QA::Flow::Login.while_signed_in(address: :geo_primary) do
project = Resource::Project.fabricate! do |project| project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-before-rename' project.name = original_project_name
project.description = 'Geo project to be renamed' project.description = 'Geo project to be renamed'
end end
geo_project_name = project.name geo_project_name = project.name
expect(project.name).to include 'geo-before-rename'
Resource::Repository::ProjectPush.fabricate! do |push| Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project push.project = project
push.file_name = 'README.md' push.file_name = readme_file_name
push.file_content = '# This is Geo project!' push.file_content = original_readme_content
push.commit_message = 'Add README.md' push.commit_message = "Add #{readme_file_name}"
end end
# rename the project # rename the project
...@@ -62,8 +65,8 @@ module QA ...@@ -62,8 +65,8 @@ module QA
Page::Project::Show.perform do |show| Page::Project::Show.perform do |show|
show.wait_for_repository_replication show.wait_for_repository_replication
expect(page).to have_content 'README.md' expect(page).to have_content readme_file_name
expect(page).to have_content 'This is Geo project!' expect(page).to have_content original_readme_content
end end
end end
end end
......
...@@ -19,7 +19,7 @@ module QA ...@@ -19,7 +19,7 @@ module QA
end end
# Create a new Project # Create a new Project
project = Resource::Project.fabricate! do |project| project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-project' project.name = 'geo-project'
project.description = 'Geo test project' project.description = 'Geo test project'
end end
...@@ -88,7 +88,7 @@ module QA ...@@ -88,7 +88,7 @@ module QA
end end
# Create a new Project # Create a new Project
project = Resource::Project.fabricate! do |project| project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-project' project.name = 'geo-project'
project.description = 'Geo test project' project.description = 'Geo test project'
end end
......
...@@ -20,7 +20,7 @@ module QA ...@@ -20,7 +20,7 @@ module QA
end end
# Create a new Project # Create a new Project
project = Resource::Project.fabricate! do |project| project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-project' project.name = 'geo-project'
project.description = 'Geo test project' project.description = 'Geo test project'
end end
...@@ -110,7 +110,7 @@ module QA ...@@ -110,7 +110,7 @@ module QA
end end
# Create a new Project # Create a new Project
project = Resource::Project.fabricate! do |project| project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-project' project.name = 'geo-project'
project.description = 'Geo test project' project.description = 'Geo test project'
end end
......
...@@ -12,7 +12,7 @@ module QA ...@@ -12,7 +12,7 @@ module QA
# Create new wiki and push wiki commit # Create new wiki and push wiki commit
QA::Flow::Login.while_signed_in(address: :geo_primary) do QA::Flow::Login.while_signed_in(address: :geo_primary) do
project = Resource::Project.fabricate! do |project| project = Resource::Project.fabricate_via_api! do |project|
project.name = project_name project.name = project_name
project.description = 'Geo project for wiki repo test' project.description = 'Geo project for wiki repo test'
end end
......
...@@ -20,7 +20,7 @@ module QA ...@@ -20,7 +20,7 @@ module QA
end end
# Create a new project and wiki # Create a new project and wiki
project = Resource::Project.fabricate! do |project| project = Resource::Project.fabricate_via_api! do |project|
project.name = project_name project.name = project_name
project.description = 'Geo project for wiki ssh spec' project.description = 'Geo project for wiki ssh spec'
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