summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/api/3_create
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 12:26:25 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 12:26:25 +0000
commita09983ae35713f5a2bbb100981116d31ce99826e (patch)
tree2ee2af7bd104d57086db360a7e6d8c9d5d43667a /qa/qa/specs/features/api/3_create
parent18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff)
downloadgitlab-ce-a09983ae35713f5a2bbb100981116d31ce99826e.tar.gz
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'qa/qa/specs/features/api/3_create')
-rw-r--r--qa/qa/specs/features/api/3_create/repository/changing_repository_storage_spec.rb10
-rw-r--r--qa/qa/specs/features/api/3_create/repository/files_spec.rb2
-rw-r--r--qa/qa/specs/features/api/3_create/repository/praefect_replication_queue_spec.rb64
-rw-r--r--qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb21
4 files changed, 83 insertions, 14 deletions
diff --git a/qa/qa/specs/features/api/3_create/repository/changing_repository_storage_spec.rb b/qa/qa/specs/features/api/3_create/repository/changing_repository_storage_spec.rb
index d5ab6a3544d..11e7db5b097 100644
--- a/qa/qa/specs/features/api/3_create/repository/changing_repository_storage_spec.rb
+++ b/qa/qa/specs/features/api/3_create/repository/changing_repository_storage_spec.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module QA
- context 'Create' do
- describe 'Changing Gitaly repository storage', :orchestrated, :requires_admin do
+ RSpec.describe 'Create' do
+ describe 'Changing Gitaly repository storage', :requires_admin do
shared_examples 'repository storage move' do
it 'confirms a `finished` status after moving project repository storage' do
expect(project).to have_file('README.md')
@@ -24,7 +24,7 @@ module QA
end
end
- context 'when moving from one Gitaly storage to another', :repository_storage do
+ context 'when moving from one Gitaly storage to another', :orchestrated, :repository_storage do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'repo-storage-move-status'
@@ -36,7 +36,9 @@ module QA
it_behaves_like 'repository storage move'
end
- context 'when moving from Gitaly to Gitaly Cluster', :requires_praefect do
+ # Note: This test doesn't have the :orchestrated tag because it runs in the Test::Integration::Praefect
+ # scenario with other tests that aren't considered orchestrated.
+ context 'when moving from Gitaly to Gitaly Cluster', :requires_praefect, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/227127', type: :investigating } do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'repo-storage-move'
diff --git a/qa/qa/specs/features/api/3_create/repository/files_spec.rb b/qa/qa/specs/features/api/3_create/repository/files_spec.rb
index 92858ba4107..1a74b2c9da7 100644
--- a/qa/qa/specs/features/api/3_create/repository/files_spec.rb
+++ b/qa/qa/specs/features/api/3_create/repository/files_spec.rb
@@ -4,7 +4,7 @@ require 'airborne'
require 'securerandom'
module QA
- describe 'API basics' do
+ RSpec.describe 'API basics' do
before(:context) do
@api_client = Runtime::API::Client.new(:gitlab)
end
diff --git a/qa/qa/specs/features/api/3_create/repository/praefect_replication_queue_spec.rb b/qa/qa/specs/features/api/3_create/repository/praefect_replication_queue_spec.rb
new file mode 100644
index 00000000000..a4040a46b84
--- /dev/null
+++ b/qa/qa/specs/features/api/3_create/repository/praefect_replication_queue_spec.rb
@@ -0,0 +1,64 @@
+# frozen_string_literal: true
+
+require 'parallel'
+
+module QA
+ RSpec.describe 'Create' do
+ context 'Gitaly Cluster replication queue', :orchestrated, :gitaly_ha, :skip_live_env do
+ let(:praefect_manager) { Service::PraefectManager.new }
+ let(:project) do
+ Resource::Project.fabricate! do |project|
+ project.name = "gitaly_cluster"
+ project.initialize_with_readme = true
+ end
+ end
+
+ after do
+ praefect_manager.reset_cluster
+ praefect_manager.clear_replication_queue
+ end
+
+ it 'allows replication of different repository after interruption' do
+ # We want to fill the replication queue with 10 `in_progress` jobs,
+ # while a lock has been acquired, which is when the problem occurred
+ # as reported in https://gitlab.com/gitlab-org/gitaly/-/issues/2801
+ #
+ # We'll do this by creating 10 branches and pushing them all at once,
+ # and then stop Praefect when a lock is acquired, set all the jobs
+ # to `in_progress`, and create a job lock for each one.
+ queue_size_target = 10
+
+ Git::Repository.perform do |repository|
+ repository.uri = project.repository_http_location.uri
+ repository.use_default_credentials
+ repository.clone
+ repository.configure_identity('GitLab QA', 'root@gitlab.com')
+ 1.upto(queue_size_target) do |i|
+ repository.checkout("branch#{i}", new_branch: true)
+ repository.commit_file("file#{i}", SecureRandom.random_bytes(10000000), "Add file#{i}")
+ end
+ repository.push_all_branches
+ end
+
+ count = 0
+ while count < 1
+ count = praefect_manager.replication_queue_lock_count
+ QA::Runtime::Logger.debug("Lock count: #{count}")
+ end
+
+ praefect_manager.stop_praefect
+ praefect_manager.create_stalled_replication_queue
+
+ praefect_manager.start_praefect
+ praefect_manager.wait_for_reliable_connection
+
+ # Create a new project, push to it, and check that replication occurs
+ project_push = Resource::Repository::ProjectPush.fabricate! do |push|
+ push.project_name = "gitaly_cluster"
+ end
+
+ expect(praefect_manager.replicated?(project_push.project.id)).to be true
+ end
+ end
+ end
+end
diff --git a/qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb b/qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb
index 3ad56e21ad4..e66e8f8c9d4 100644
--- a/qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb
+++ b/qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb
@@ -5,33 +5,36 @@ require 'securerandom'
require 'digest'
module QA
- context 'Create' do
+ RSpec.describe 'Create' do
describe 'Compare archives of different user projects with the same name and check they\'re different' do
include Support::Api
+ let(:project_name) { "project-archive-download-#{SecureRandom.hex(8)}" }
- before do
- @project_name = "project-archive-download-#{SecureRandom.hex(8)}"
- @archive_types = %w(tar.gz tar.bz2 tar zip)
- @users = {
+ let(:archive_types) { %w(tar.gz tar.bz2 tar zip) }
+
+ let(:users) do
+ {
user1: { username: Runtime::Env.gitlab_qa_username_1, password: Runtime::Env.gitlab_qa_password_1 },
user2: { username: Runtime::Env.gitlab_qa_username_2, password: Runtime::Env.gitlab_qa_password_2 }
}
+ end
- @users.each do |_, user_info|
+ before do
+ users.each do |_, user_info|
user_info[:user] = Resource::User.fabricate_or_use(user_info[:username], user_info[:password])
user_info[:api_client] = Runtime::API::Client.new(:gitlab, user: user_info[:user])
user_info[:api_client].personal_access_token
- user_info[:project] = create_project(user_info[:user], user_info[:api_client], @project_name)
+ user_info[:project] = create_project(user_info[:user], user_info[:api_client], project_name)
end
end
it 'download archives of each user project then check they are different' do
archive_checksums = {}
- @users.each do |user_key, user_info|
+ users.each do |user_key, user_info|
archive_checksums[user_key] = {}
- @archive_types.each do |type|
+ archive_types.each do |type|
archive_path = download_project_archive_via_api(user_info[:api_client], user_info[:project], type).path
archive_checksums[user_key][type] = Digest::MD5.hexdigest(File.read(archive_path))
end