Commit 54657afc authored by Ash McKenzie's avatar Ash McKenzie

Geo: LFS tests for HTTP & SSH

parent 181d9377
......@@ -3,58 +3,124 @@
module QA
context 'Geo', :orchestrated, :geo do
describe 'GitLab HTTP push' do
it 'is replicated to the secondary' do
file_name = 'README.md'
file_content = 'This is a Geo project! Commit from primary.'
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
# Visit the primary node and login
Page::Main::Login.act { sign_in_using_credentials }
# Create a new Project
project = Resource::Project.fabricate! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
let(:file_name) { 'README.md' }
# Perform a git push over HTTP directly to the primary
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.file_name = file_name
push.file_content = "# #{file_content}"
push.commit_message = 'Add README.md'
end
project.visit!
context 'regular git commit' do
it 'is replicated to the secondary' do
file_content = 'This is a Geo project! Commit from primary.'
# Validate git push worked and file exists with content
Page::Project::Show.perform do |show|
show.wait_for_repository_replication
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
# Visit the primary node and login
Page::Main::Login.act { sign_in_using_credentials }
expect(page).to have_content(file_name)
expect(page).to have_content(file_content)
end
# Create a new Project
project = Resource::Project.fabricate! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
Runtime::Browser.visit(:geo_secondary, QA::Page::Main::Login) do
# Visit the secondary node and login
Page::Main::OAuth.act { authorize! if needs_authorization? }
# Perform a git push over HTTP directly to the primary
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.file_name = file_name
push.file_content = "# #{file_content}"
push.commit_message = 'Add README.md'
end
project.visit!
# Validate git push worked and file exists with content
Page::Project::Show.perform do |show|
show.wait_for_repository_replication
EE::Page::Main::Banner.perform do |banner|
expect(banner).to have_secondary_read_only_banner
expect(page).to have_content(file_name)
expect(page).to have_content(file_content)
end
Page::Main::Menu.perform { |menu| menu.go_to_projects }
Runtime::Browser.visit(:geo_secondary, QA::Page::Main::Login) do
# Visit the secondary node and login
Page::Main::OAuth.act { authorize! if needs_authorization? }
EE::Page::Main::Banner.perform do |banner|
expect(banner).to have_secondary_read_only_banner
end
Page::Main::Menu.perform { |menu| menu.go_to_projects }
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(project.name)
dashboard.go_to_project(project.name)
end
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(project.name)
dashboard.go_to_project(project.name)
# Validate the content has been sync'd from the primary
Page::Project::Show.perform do |show|
show.wait_for_repository_replication_with(file_name)
expect(page).to have_content(file_name)
expect(page).to have_content(file_content)
end
end
end
end
end
# Validate the content has been sync'd from the primary
context 'git-lfs commit' do
it 'is replicated to the secondary' do
file_content = 'This is a Geo project!'
lfs_file_content = 'The rendered file could not be displayed because it is stored in LFS.'
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
# Visit the primary node and login
Page::Main::Login.act { sign_in_using_credentials }
# Create a new Project
project = Resource::Project.fabricate! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
# Perform a git push over HTTP directly to the primary
push = Resource::Repository::ProjectPush.fabricate! do |push|
push.use_lfs = true
push.project = project
push.file_name = file_name
push.file_content = "# #{file_content}"
push.commit_message = 'Add README.md'
end
project.visit!
expect(push.output).to match(/Locking support detected on remote/)
expect(push.output).to match(%r{Uploading LFS objects: 100% \(1/1\)})
# Validate git push worked and file exists with content
Page::Project::Show.perform do |show|
show.wait_for_repository_replication_with(file_name)
show.wait_for_repository_replication
expect(page).to have_content(file_name)
expect(page).to have_content(file_content)
expect(page).to have_content(lfs_file_content)
end
Runtime::Browser.visit(:geo_secondary, QA::Page::Main::Login) do
# Visit the secondary node and login
Page::Main::OAuth.act { authorize! if needs_authorization? }
EE::Page::Main::Banner.perform do |banner|
expect(banner).to have_secondary_read_only_banner
end
Page::Main::Menu.perform { |menu| menu.go_to_projects }
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(project.name)
dashboard.go_to_project(project.name)
end
# Validate the content has been sync'd from the primary
Page::Project::Show.perform do |show|
show.wait_for_repository_replication_with(file_name)
expect(page).to have_content(file_name)
expect(page).to have_content(lfs_file_content)
end
end
end
end
......
......@@ -2,71 +2,164 @@
module QA
context 'Geo', :orchestrated, :geo do
describe 'GitLab HTTP push to secondary' do
it 'is redirected to the primary and ultimately replicated to the secondary' do
file_name = 'README.md'
file_content_primary = 'This is a Geo project! Commit from primary.'
file_content_secondary = 'This is a Geo project! Commit from secondary.'
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
# Visit the primary node and login
Page::Main::Login.act { sign_in_using_credentials }
# Create a new Project
project = Resource::Project.fabricate! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
describe 'GitLab Geo HTTP push secondary' do
let(:file_content_primary) { 'This is a Geo project! Commit from primary.' }
let(:file_content_secondary) { 'This is a Geo project! Commit from secondary.' }
# Perform a git push over HTTP directly to the primary
#
# This push is required to ensure we have the primary credentials
# written out to the .netrc
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.file_name = file_name
push.file_content = "# #{file_content_primary}"
push.commit_message = "Add #{file_name}"
end
project.visit!
context 'regular git commit' do
it 'is redirected to the primary and ultimately replicated to the secondary' do
file_name = 'README.md'
Runtime::Browser.visit(:geo_secondary, QA::Page::Main::Login) do
# Visit the secondary node and login
Page::Main::OAuth.act { authorize! if needs_authorization? }
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
# Visit the primary node and login
Page::Main::Login.act { sign_in_using_credentials }
EE::Page::Main::Banner.perform do |banner|
expect(banner).to have_secondary_read_only_banner
# Create a new Project
project = Resource::Project.fabricate! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
Page::Main::Menu.perform { |menu| menu.go_to_projects }
# Perform a git push over HTTP directly to the primary
#
# This push is required to ensure we have the primary credentials
# written out to the .netrc
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.file_name = file_name
push.file_content = "# #{file_content_primary}"
push.commit_message = "Add #{file_name}"
end
project.visit!
Runtime::Browser.visit(:geo_secondary, QA::Page::Main::Login) do
# Visit the secondary node and login
Page::Main::OAuth.act { authorize! if needs_authorization? }
EE::Page::Main::Banner.perform do |banner|
expect(banner).to have_secondary_read_only_banner
end
Page::Main::Menu.perform { |menu| menu.go_to_projects }
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(project.name)
dashboard.go_to_project(project.name)
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(project.name)
dashboard.go_to_project(project.name)
end
# Grab the HTTP URI for the secondary and store as 'location'
location = Page::Project::Show.act do
choose_repository_clone_http
repository_location
end
# Perform a git push over HTTP at the secondary
push = Resource::Repository::Push.fabricate! do |push|
push.new_branch = false
push.repository_http_uri = location.uri
push.file_name = file_name
push.file_content = "# #{file_content_secondary}"
push.commit_message = "Update #{file_name}"
end
# We need to strip off the user from the URI, otherwise we won't
# get the correct output produced from the git CLI.
primary_uri = project.repository_http_location.uri
primary_uri.user = nil
# The git cli produces the 'warning: redirecting to..' output
# internally.
expect(push.output).to match(/warning: redirecting to #{primary_uri.to_s}/)
# Validate git push worked and new content is visible
Page::Project::Show.perform do |show|
show.wait_for_repository_replication_with(file_content_secondary)
show.refresh
expect(page).to have_content(file_name)
expect(page).to have_content(file_content_secondary)
end
end
end
end
end
context 'git-lfs commit' do
it 'is redirected to the primary and ultimately replicated to the secondary' do
file_name_primary = 'README.md'
file_name_secondary = 'README_MORE.md'
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
# Visit the primary node and login
Page::Main::Login.act { sign_in_using_credentials }
# Grab the HTTP URI for the secondary and store as 'location'
location = Page::Project::Show.act do
choose_repository_clone_http
repository_location
# Create a new Project
project = Resource::Project.fabricate! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
# Perform a git push over HTTP at the secondary
# Perform a git push over HTTP directly to the primary
#
# This push is required to ensure we have the primary credentials
# written out to the .netrc
Resource::Repository::Push.fabricate! do |push|
push.new_branch = false
push.repository_http_uri = location.uri
push.file_name = file_name
push.file_content = "# #{file_content_secondary}"
push.commit_message = "Update #{file_name}"
push.use_lfs = true
push.repository_http_uri = project.repository_http_location.uri
push.file_name = file_name_primary
push.file_content = "# #{file_content_primary}"
push.commit_message = "Add #{file_name_primary}"
end
# Validate git push worked and new content is visible
Page::Project::Show.perform do |show|
show.wait_for_repository_replication_with(file_content)
show.refresh
Runtime::Browser.visit(:geo_secondary, QA::Page::Main::Login) do
# Visit the secondary node and login
Page::Main::OAuth.act { authorize! if needs_authorization? }
EE::Page::Main::Banner.perform do |banner|
expect(banner).to have_secondary_read_only_banner
end
Page::Main::Menu.perform { |menu| menu.go_to_projects }
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(project.name)
dashboard.go_to_project(project.name)
end
# Grab the HTTP URI for the secondary and store as 'location'
location = Page::Project::Show.act do
choose_repository_clone_http
repository_location
end
# Perform a git push over HTTP at the secondary
push = Resource::Repository::Push.fabricate! do |push|
push.use_lfs = true
push.new_branch = false
push.repository_http_uri = location.uri
push.file_name = file_name_secondary
push.file_content = "# #{file_content_secondary}"
push.commit_message = "Add #{file_name_secondary}"
end
# We need to strip off the user from the URI, otherwise we won't
# get the correct output produced from the git CLI.
primary_uri = project.repository_http_location.uri
primary_uri.user = nil
# The git cli produces the 'warning: redirecting to..' output
# internally.
expect(push.output).to match(/warning: redirecting to #{primary_uri.to_s}/)
expect(push.output).to match(/Locking support detected on remote "#{location.uri.to_s}"/)
expect(push.output).to match(%r{Uploading LFS objects: 100% \(2/2\)})
# Validate git push worked and new content is visible
Page::Project::Show.perform do |show|
show.wait_for_repository_replication_with(file_name_secondary)
show.refresh
expect(page).to have_content(file_name)
expect(page).to have_content(file_content)
expect(page).to have_content(file_name_secondary)
end
end
end
end
......
......@@ -3,73 +3,152 @@
module QA
context 'Geo', :orchestrated, :geo do
describe 'GitLab SSH push' do
it "is replicated to the secondary" do
file_name = 'README.md'
key_title = "key for ssh tests #{Time.now.to_f}"
file_content = 'This is a Geo project! Commit from primary.'
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
# Visit the primary node and login
Page::Main::Login.act { sign_in_using_credentials }
# Create a new SSH key for the user
key = Resource::SSHKey.fabricate! do |resource|
resource.title = key_title
end
let(:file_name) { 'README.md' }
# Create a new Project
project = Resource::Project.fabricate! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
context 'regular git commit' do
it "is replicated to the secondary" do
key_title = "key for ssh tests #{Time.now.to_f}"
file_content = 'This is a Geo project! Commit from primary.'
# Perform a git push over SSH directly to the primary
Resource::Repository::ProjectPush.fabricate! do |push|
push.ssh_key = key
push.project = project
push.file_name = file_name
push.file_content = "# #{file_content}"
push.commit_message = 'Add README.md'
end
project.visit!
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
# Visit the primary node and login
Page::Main::Login.act { sign_in_using_credentials }
# Validate git push worked and file exists with content
Page::Project::Show.perform do |show|
show.wait_for_repository_replication
# Create a new SSH key for the user
key = Resource::SSHKey.fabricate! do |resource|
resource.title = key_title
end
expect(page).to have_content(file_name)
expect(page).to have_content(file_content)
end
# Create a new Project
project = Resource::Project.fabricate! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
# Perform a git push over SSH directly to the primary
Resource::Repository::ProjectPush.fabricate! do |push|
push.ssh_key = key
push.project = project
push.file_name = file_name
push.file_content = "# #{file_content}"
push.commit_message = 'Add README.md'
end
project.visit!
Runtime::Browser.visit(:geo_secondary, QA::Page::Main::Login) do
# Visit the secondary node and login
Page::Main::OAuth.act { authorize! if needs_authorization? }
# Validate git push worked and file exists with content
Page::Project::Show.perform do |show|
show.wait_for_repository_replication
EE::Page::Main::Banner.perform do |banner|
expect(banner).to have_secondary_read_only_banner
expect(page).to have_content(file_name)
expect(page).to have_content(file_content)
end
# Ensure the SSH key has replicated
Page::Main::Menu.act { go_to_profile_settings }
Page::Profile::Menu.act { click_ssh_keys }
Runtime::Browser.visit(:geo_secondary, QA::Page::Main::Login) do
# Visit the secondary node and login
Page::Main::OAuth.act { authorize! if needs_authorization? }
EE::Page::Main::Banner.perform do |banner|
expect(banner).to have_secondary_read_only_banner
end
# Ensure the SSH key has replicated
Page::Main::Menu.act { go_to_profile_settings }
Page::Profile::Menu.act { click_ssh_keys }
expect(page).to have_content(key_title)
expect(page).to have_content(key.fingerprint)
expect(page).to have_content(key_title)
expect(page).to have_content(key.fingerprint)
# Ensure project has replicated
Page::Main::Menu.perform { |menu| menu.go_to_projects }
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(project.name)
dashboard.go_to_project(project.name)
end
# Ensure project has replicated
Page::Main::Menu.perform { |menu| menu.go_to_projects }
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(project.name)
dashboard.go_to_project(project.name)
# Validate the content has been sync'd from the primary
Page::Project::Show.perform do |show|
show.wait_for_repository_replication_with(file_content)
expect(page).to have_content(file_name)
expect(page).to have_content(file_content)
end
end
end
end
end
# Validate the content has been sync'd from the primary
context 'git-lfs commit' do
it "is replicated to the secondary" do
key_title = "key for ssh tests #{Time.now.to_f}"
file_content = 'The rendered file could not be displayed because it is stored in LFS.'
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
# Visit the primary node and login
Page::Main::Login.act { sign_in_using_credentials }
# Create a new SSH key for the user
key = Resource::SSHKey.fabricate! do |resource|
resource.title = key_title
end
# Create a new Project
project = Resource::Project.fabricate! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
# Perform a git push over SSH directly to the primary
push = Resource::Repository::ProjectPush.fabricate! do |push|
push.use_lfs = true
push.ssh_key = key
push.project = project
push.file_name = file_name
push.file_content = "# #{file_content}"
push.commit_message = 'Add README.md'
end
project.visit!
expect(push.output).to match(/Locking support detected on remote/)
expect(push.output).to match(%r{Uploading LFS objects: 100% \(1/1\)})
# Validate git push worked and file exists with content
Page::Project::Show.perform do |show|
show.wait_for_repository_replication_with(file_content)
show.wait_for_repository_replication
expect(page).to have_content(file_name)
expect(page).to have_content(file_content)
end
Runtime::Browser.visit(:geo_secondary, QA::Page::Main::Login) do
# Visit the secondary node and login
Page::Main::OAuth.act { authorize! if needs_authorization? }
EE::Page::Main::Banner.perform do |banner|
expect(banner).to have_secondary_read_only_banner
end
# Ensure the SSH key has replicated
Page::Main::Menu.act { go_to_profile_settings }
Page::Profile::Menu.act { click_ssh_keys }
expect(page).to have_content(key_title)
expect(page).to have_content(key.fingerprint)
# Ensure project has replicated
Page::Main::Menu.perform { |menu| menu.go_to_projects }
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(project.name)
dashboard.go_to_project(project.name)
end
# Validate the content has been sync'd from the primary
Page::Project::Show.perform do |show|
show.wait_for_repository_replication_with(file_name)
expect(page).to have_content(file_name)
expect(page).to have_content(file_content)
end
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