Commit c52c1ea7 authored by Jennifer Louie's avatar Jennifer Louie Committed by Mark Lapierre

Add initial wiki HTTP push to primary node

This initial push also happens in project http push to secondary spec
parent b83380f3
...@@ -2,25 +2,24 @@ ...@@ -2,25 +2,24 @@
module QA module QA
# https://gitlab.com/gitlab-org/gitlab/issues/35706 # https://gitlab.com/gitlab-org/gitlab/issues/35706
context 'Geo', :orchestrated, :geo, :quarantine do context 'Geo', :orchestrated, :geo do
describe 'GitLab Geo Wiki HTTP push secondary' do describe 'GitLab Geo Wiki HTTP push secondary' do
let(:wiki_content) { 'This tests wiki pushes via HTTP to secondary.' } let(:wiki_content) { 'This tests wiki pushes via HTTP to secondary.' }
let(:push_content) { 'This is from the Geo wiki push to secondary!' } let(:push_content_primary) { 'This is from the Geo wiki push to primary!' }
let(:push_content_secondary) { 'This is from the Geo wiki push to secondary!' }
let(:project_name) { "geo-wiki-project-#{SecureRandom.hex(8)}" } let(:project_name) { "geo-wiki-project-#{SecureRandom.hex(8)}" }
let(:git_push_http_path_prefix) { '/-/push_from_secondary' } let(:git_push_http_path_prefix) { '/-/push_from_secondary' }
wiki = nil
after do after do
Runtime::Browser.visit(:geo_secondary, QA::Page::Dashboard::Projects) do Runtime::Browser.visit(:geo_secondary, QA::Page::Dashboard::Projects)
Page::Main::Menu.perform do |menu| Page::Main::Menu.perform do |menu|
menu.sign_out if menu.has_personal_area?(wait: 0) menu.sign_out if menu.has_personal_area?(wait: 0)
end end
end end
end
context 'wiki commit' do
it 'is redirected to the primary and ultimately replicated to the secondary' do
wiki = nil
before do
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
# Visit the primary node and login # Visit the primary node and login
Page::Main::Login.perform(&:sign_in_using_credentials) Page::Main::Login.perform(&:sign_in_using_credentials)
...@@ -39,10 +38,21 @@ module QA ...@@ -39,10 +38,21 @@ module QA
end end
expect(wiki).to have_content(wiki_content) expect(wiki).to have_content(wiki_content)
# 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::WikiPush.fabricate! do |push|
push.wiki = wiki
push.file_name = 'Readme.md'
push.file_content = push_content_primary
push.commit_message = 'Update Readme.md'
end
end
end end
it 'is redirected to the primary and ultimately replicated to the secondary' do
Runtime::Browser.visit(:geo_secondary, QA::Page::Main::Login) do Runtime::Browser.visit(:geo_secondary, QA::Page::Main::Login) do
# Visit the secondary node and login
Page::Main::Login.perform(&:sign_in_using_credentials) Page::Main::Login.perform(&:sign_in_using_credentials)
EE::Page::Main::Banner.perform do |banner| EE::Page::Main::Banner.perform do |banner|
...@@ -74,12 +84,13 @@ module QA ...@@ -74,12 +84,13 @@ module QA
push.wiki = wiki push.wiki = wiki
push.repository_http_uri = secondary_location.uri push.repository_http_uri = secondary_location.uri
push.file_name = 'Home.md' push.file_name = 'Home.md'
push.file_content = push_content push.file_content = push_content_secondary
push.commit_message = 'Update Home.md' push.commit_message = 'Update Home.md'
end end
# Check that the git cli produces the 'warning: redirecting to..(primary node)' output # Check that the git cli produces the 'warning: redirecting to..(primary node)' output
primary_uri = wiki.repository_http_location.uri primary_uri = wiki.repository_http_location.uri
primary_uri.user = nil
# The secondary inserts a special path prefix. # The secondary inserts a special path prefix.
# See `Gitlab::Geo::GitPushHttp::PATH_PREFIX`. # See `Gitlab::Geo::GitPushHttp::PATH_PREFIX`.
...@@ -92,11 +103,10 @@ module QA ...@@ -92,11 +103,10 @@ module QA
Page::Project::Menu.perform(&:click_wiki) Page::Project::Menu.perform(&:click_wiki)
Page::Project::Wiki::Show.perform do |show| Page::Project::Wiki::Show.perform do |show|
show.wait_for_repository_replication_with(push_content) show.wait_for_repository_replication_with(push_content_secondary)
show.refresh show.refresh
expect(show).to have_content(push_content) expect(show).to have_content(push_content_secondary)
end
end 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