Commit beb228e4 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'qa-jl-geo-wiki-http-2ndry-spec' into 'master'

Test wiki HTTP push to secondary Geo node

See merge request gitlab-org/gitlab-ee!16085
parents 08e5ea86 e19fb5bd
......@@ -93,6 +93,10 @@ module QA
end
end
module Wiki
autoload :Show, 'qa/ee/page/project/wiki/show'
end
module Settings
autoload :ProtectedBranches, 'qa/ee/page/project/settings/protected_branches'
autoload :MirroringRepositories, 'qa/ee/page/project/settings/mirroring_repositories'
......
# frozen_string_literal: true
module QA
module EE
module Page
module Project
module Wiki
module Show
def wait_for_repository_replication(max_wait: Runtime::Geo.max_file_replication_time)
wait_until_geo_max_replication_time(max_wait: max_wait) do
has_no_text?(/No repository|The wiki for this project is empty/)
end
end
def wait_for_repository_replication_with(text, max_wait: Runtime::Geo.max_file_replication_time)
wait_until_geo_max_replication_time(max_wait: max_wait) do
page.has_text?(text)
end
end
def wait_until_geo_max_replication_time(max_wait: Runtime::Geo.max_file_replication_time)
wait(max: max_wait) { yield }
end
end
end
end
end
end
end
......@@ -19,3 +19,5 @@ module QA
end
end
end
QA::Page::Project::Wiki::Show.prepend_if_ee('QA::EE::Page::Project::Wiki::Show')
# frozen_string_literal: true
module QA
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(:project_name) { "geo-wiki-project-#{SecureRandom.hex(8)}" }
context 'wiki commit' do
it 'is redirected to the primary and ultimately replicated to the secondary' do
wiki = nil
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
# Visit the primary node and login
Page::Main::Login.perform(&:sign_in_using_credentials)
# Create a new project and wiki
project = Resource::Project.fabricate_via_api! do |project|
project.name = project_name
project.description = 'Geo test project'
end
wiki = Resource::Wiki.fabricate! do |wiki|
wiki.project = project
wiki.title = 'Geo wiki'
wiki.content = wiki_content
wiki.message = 'First wiki commit'
end
expect(wiki).to have_content(wiki_content)
end
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|
expect(banner).to have_secondary_read_only_banner
end
Page::Main::Menu.perform(&:go_to_projects)
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(project_name)
dashboard.go_to_project(project_name)
end
Page::Project::Menu.perform(&:click_wiki)
# Perform a git push over HTTP at the secondary
Resource::Repository::WikiPush.fabricate! do |push|
push.wiki = wiki
push.file_name = 'Home.md'
push.file_content = push_content
push.commit_message = 'Update Home.md'
end
# Validate git push worked and new content is visible
Page::Project::Menu.perform(&:click_wiki)
Page::Project::Wiki::Show.perform do |show|
show.wait_for_repository_replication_with(push_content)
show.refresh
expect(show).to have_content(push_content)
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