Commit 9e940e46 authored by Dan Davison's avatar Dan Davison

Merge branch 'ml-update-gitaly-cluster-e2e-tests' into 'master'

Update Gitaly Cluster E2E tests

See merge request gitlab-org/gitlab!45734
parents c31c2e5c 3e4bb127
...@@ -206,14 +206,14 @@ module QA ...@@ -206,14 +206,14 @@ module QA
def wait_for_new_primary_node(node) def wait_for_new_primary_node(node)
QA::Runtime::Logger.info("Wait until #{node} is the primary node") QA::Runtime::Logger.info("Wait until #{node} is the primary node")
with_praefect_log do |log| with_praefect_log(max_duration: 120) do |log|
break true if log['msg'] == 'primary node changed' && log['newPrimary'] == node break true if log['msg'] == 'primary node changed' && log['newPrimary'] == node
end end
end end
def wait_for_new_primary def wait_for_new_primary
QA::Runtime::Logger.info("Wait until a new primary node is selected") QA::Runtime::Logger.info("Wait until a new primary node is selected")
with_praefect_log do |log| with_praefect_log(max_duration: 120) do |log|
break true if log['msg'] == 'primary node changed' break true if log['msg'] == 'primary node changed'
end end
end end
...@@ -406,8 +406,8 @@ module QA ...@@ -406,8 +406,8 @@ module QA
end end
end end
def with_praefect_log def with_praefect_log(**kwargs)
wait_until_shell_command("docker exec #{@praefect} bash -c 'tail -n 1 /var/log/gitlab/praefect/current'") do |line| wait_until_shell_command("docker exec #{@praefect} bash -c 'tail -n 1 /var/log/gitlab/praefect/current'", **kwargs) do |line|
QA::Runtime::Logger.debug(line.chomp) QA::Runtime::Logger.debug(line.chomp)
yield JSON.parse(line) yield JSON.parse(line)
end end
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module QA module QA
RSpec.describe 'Create' do RSpec.describe 'Create' do
context 'Gitaly automatic failover and manual recovery', :orchestrated, :gitaly_cluster, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/238953', type: :flaky } do context 'Gitaly automatic failover and recovery', :orchestrated, :gitaly_cluster, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/238953', type: :flaky } do
# Variables shared between contexts. They're used and shared between # Variables shared between contexts. They're used and shared between
# contexts so they can't be `let` variables. # contexts so they can't be `let` variables.
praefect_manager = Service::PraefectManager.new praefect_manager = Service::PraefectManager.new
...@@ -66,17 +66,13 @@ module QA ...@@ -66,17 +66,13 @@ module QA
end end
context 'when recovering from dataloss after failover' do context 'when recovering from dataloss after failover' do
it 'allows reconciliation', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/238187', type: :stale }, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/977' do it 'automatically reconciles', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/238187', type: :stale }, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/977' do
# Start the old primary node again # Start the old primary node again
praefect_manager.start_primary_node praefect_manager.start_primary_node
praefect_manager.wait_for_health_check_current_primary_node praefect_manager.wait_for_health_check_current_primary_node
# Confirm dataloss (i.e., inconsistent nodes) # Confirm automatic reconciliation
expect(praefect_manager.replicated?(project.id)).to be false expect(praefect_manager.replicated?(project.id)).to be true
# Reconcile nodes to recover from dataloss
praefect_manager.reconcile_nodes
praefect_manager.wait_for_replication(project.id)
# Confirm that all commits are available after reconciliation # Confirm that all commits are available after reconciliation
expect(project.commits.map { |commit| commit[:message].chomp }) expect(project.commits.map { |commit| commit[:message].chomp })
......
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