Commit 01c27ab5 authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'fix-geo-wiki-http-secondary-spec' into 'master'

Add initial wiki HTTP push to primary node

Closes #35706

See merge request gitlab-org/gitlab!20253
parents b83380f3 c52c1ea7
......@@ -2,25 +2,24 @@
module QA
# 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
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(:git_push_http_path_prefix) { '/-/push_from_secondary' }
wiki = nil
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|
menu.sign_out if menu.has_personal_area?(wait: 0)
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
# Visit the primary node and login
Page::Main::Login.perform(&:sign_in_using_credentials)
......@@ -39,10 +38,21 @@ module QA
end
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
it 'is redirected to the primary and ultimately replicated to the secondary' 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)
EE::Page::Main::Banner.perform do |banner|
......@@ -74,12 +84,13 @@ module QA
push.wiki = wiki
push.repository_http_uri = secondary_location.uri
push.file_name = 'Home.md'
push.file_content = push_content
push.file_content = push_content_secondary
push.commit_message = 'Update Home.md'
end
# Check that the git cli produces the 'warning: redirecting to..(primary node)' output
primary_uri = wiki.repository_http_location.uri
primary_uri.user = nil
# The secondary inserts a special path prefix.
# See `Gitlab::Geo::GitPushHttp::PATH_PREFIX`.
......@@ -92,11 +103,10 @@ module QA
Page::Project::Menu.perform(&:click_wiki)
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
expect(show).to have_content(push_content)
end
expect(show).to have_content(push_content_secondary)
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