summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/api/3_create/gitaly/automatic_failover_and_recovery_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-09-19 23:18:09 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-19 23:18:09 +0000
commit6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch)
treedc4d20fe6064752c0bd323187252c77e0a89144b /qa/qa/specs/features/api/3_create/gitaly/automatic_failover_and_recovery_spec.rb
parent9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff)
downloadgitlab-ce-6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde.tar.gz
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'qa/qa/specs/features/api/3_create/gitaly/automatic_failover_and_recovery_spec.rb')
-rw-r--r--qa/qa/specs/features/api/3_create/gitaly/automatic_failover_and_recovery_spec.rb93
1 files changed, 0 insertions, 93 deletions
diff --git a/qa/qa/specs/features/api/3_create/gitaly/automatic_failover_and_recovery_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/automatic_failover_and_recovery_spec.rb
deleted file mode 100644
index 55ae0d215cf..00000000000
--- a/qa/qa/specs/features/api/3_create/gitaly/automatic_failover_and_recovery_spec.rb
+++ /dev/null
@@ -1,93 +0,0 @@
-# frozen_string_literal: true
-
-module QA
- RSpec.describe 'Create' do
- context 'Gitaly automatic failover and recovery', :orchestrated, :gitaly_cluster do
- # Variables shared between contexts. They're used and shared between
- # contexts so they can't be `let` variables.
- praefect_manager = Service::PraefectManager.new
- project = nil
-
- let(:intial_commit_message) { 'Initial commit' }
- let(:first_added_commit_message) { 'first_added_commit_message to primary gitaly node' }
- let(:second_added_commit_message) { 'second_added_commit_message to failover node' }
-
- before(:context) do
- praefect_manager.start_all_nodes
-
- project = Resource::Project.fabricate! do |project|
- project.name = "gitaly_cluster"
- project.initialize_with_readme = true
- end
- # We need to ensure that the the project is replicated to all nodes before proceeding with this test
- praefect_manager.wait_for_replication(project.id)
- end
-
- it 'automatically fails over', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347830' do
- # stop other nodes, so we can control which node the commit is sent to
- praefect_manager.stop_secondary_node
- praefect_manager.stop_tertiary_node
-
- Resource::Repository::ProjectPush.fabricate! do |push|
- push.project = project
- push.commit_message = first_added_commit_message
- push.new_branch = false
- push.file_content = 'This file created on gitaly1 while gitaly2/gitaly3 not running'
- end
-
- praefect_manager.start_all_nodes
- praefect_manager.wait_for_replication(project.id)
-
- # Stop the primary node to trigger failover, and then wait
- # for Gitaly to be ready for writes again
- praefect_manager.stop_primary_node
- praefect_manager.wait_for_primary_node_health_check_failure
-
- Resource::Repository::Commit.fabricate_via_api! do |commit|
- commit.project = project
- commit.commit_message = second_added_commit_message
- commit.add_files([
- {
- file_path: "file-#{SecureRandom.hex(8)}",
- content: 'This is created on gitaly2/gitaly3 while gitaly1 is unavailable'
- }
- ])
- end
-
- # Confirm that we have access to the repo after failover,
- # including the commit we just added
- expect(project.commits.map { |commit| commit[:message].chomp })
- .to include(intial_commit_message)
- .and include(first_added_commit_message)
- .and include(second_added_commit_message)
- end
-
- context 'when recovering from dataloss after failover' do
- it 'automatically reconciles', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347831' do
- # Start the old primary node again
- praefect_manager.start_primary_node
- praefect_manager.wait_for_primary_node_health_check
-
- # Confirm automatic reconciliation
- expect(praefect_manager.replicated?(project.id)).to be true
-
- # Confirm that all commits are available after reconciliation
- expect(project.commits.map { |commit| commit[:message].chomp })
- .to include(intial_commit_message)
- .and include(first_added_commit_message)
- .and include(second_added_commit_message)
-
- # Restore the original primary node
- praefect_manager.start_all_nodes
-
- # Check that all commits are still available even though the primary
- # node was offline when one was made
- expect(project.commits.map { |commit| commit[:message].chomp })
- .to include(intial_commit_message)
- .and include(first_added_commit_message)
- .and include(second_added_commit_message)
- end
- end
- end
- end
-end