Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-23 12:06:03 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-23 12:06:03 +0300
commitb3e4ec8e8adf4fe96c982124e91b6a05021a9cda (patch)
tree5fda0011a7cc7de000186e465e61f893d478a1c8 /spec/lib
parent90cdc9391171e1be29b2b57a2e2aad0c02c2a7a9 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/backup/repository_spec.rb2
-rw-r--r--spec/lib/gitlab/background_migration/schedule_calculate_wiki_sizes_spec.rb2
-rw-r--r--spec/lib/gitlab/badge/pipeline/status_spec.rb2
-rw-r--r--spec/lib/gitlab/bare_repository_import/importer_spec.rb2
-rw-r--r--spec/lib/gitlab/checks/lfs_integrity_spec.rb2
-rw-r--r--spec/lib/gitlab/cycle_analytics/events_spec.rb6
-rw-r--r--spec/lib/gitlab/cycle_analytics/usage_data_spec.rb2
-rw-r--r--spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb10
-rw-r--r--spec/lib/gitlab/hashed_storage/migrator_spec.rb8
-rw-r--r--spec/lib/gitlab/import_export/fork_spec.rb2
-rw-r--r--spec/lib/gitlab/phabricator_import/project_creator_spec.rb2
-rw-r--r--spec/lib/gitlab/shell_spec.rb62
-rw-r--r--spec/lib/gitlab/sidekiq_middleware/correlation_logger_spec.rb2
-rw-r--r--spec/lib/gitlab/tracking_spec.rb16
-rw-r--r--spec/lib/gitlab/user_access_spec.rb2
15 files changed, 51 insertions, 71 deletions
diff --git a/spec/lib/backup/repository_spec.rb b/spec/lib/backup/repository_spec.rb
index bf827fb3914..5f120f258cd 100644
--- a/spec/lib/backup/repository_spec.rb
+++ b/spec/lib/backup/repository_spec.rb
@@ -70,7 +70,7 @@ describe Backup::Repository do
end
context 'restoring object pools' do
- it 'schedules restoring of the pool' do
+ it 'schedules restoring of the pool', :sidekiq_might_not_need_inline do
pool_repository = create(:pool_repository, :failed)
pool_repository.delete_object_pool
diff --git a/spec/lib/gitlab/background_migration/schedule_calculate_wiki_sizes_spec.rb b/spec/lib/gitlab/background_migration/schedule_calculate_wiki_sizes_spec.rb
index f877e8cc1b8..399db4ac259 100644
--- a/spec/lib/gitlab/background_migration/schedule_calculate_wiki_sizes_spec.rb
+++ b/spec/lib/gitlab/background_migration/schedule_calculate_wiki_sizes_spec.rb
@@ -33,7 +33,7 @@ describe ScheduleCalculateWikiSizes, :migration, :sidekiq do
end
end
- it 'calculates missing wiki sizes' do
+ it 'calculates missing wiki sizes', :sidekiq_might_not_need_inline do
expect(project_statistics.find_by(id: 2).wiki_size).to be_nil
expect(project_statistics.find_by(id: 3).wiki_size).to be_nil
diff --git a/spec/lib/gitlab/badge/pipeline/status_spec.rb b/spec/lib/gitlab/badge/pipeline/status_spec.rb
index 684c6829879..ab8d1f0ec5b 100644
--- a/spec/lib/gitlab/badge/pipeline/status_spec.rb
+++ b/spec/lib/gitlab/badge/pipeline/status_spec.rb
@@ -26,7 +26,7 @@ describe Gitlab::Badge::Pipeline::Status do
end
end
- context 'pipeline exists' do
+ context 'pipeline exists', :sidekiq_might_not_need_inline do
let!(:pipeline) { create_pipeline(project, sha, branch) }
context 'pipeline success' do
diff --git a/spec/lib/gitlab/bare_repository_import/importer_spec.rb b/spec/lib/gitlab/bare_repository_import/importer_spec.rb
index 2fb9f1a0a08..ddb1d3cea21 100644
--- a/spec/lib/gitlab/bare_repository_import/importer_spec.rb
+++ b/spec/lib/gitlab/bare_repository_import/importer_spec.rb
@@ -90,7 +90,7 @@ describe Gitlab::BareRepositoryImport::Importer, :seed_helper do
hook_path = File.join(repo_path, 'hooks')
expect(gitlab_shell.repository_exists?(project.repository_storage, repo_path)).to be(true)
- expect(gitlab_shell.exists?(project.repository_storage, hook_path)).to be(true)
+ expect(TestEnv.storage_dir_exists?(project.repository_storage, hook_path)).to be(true)
end
context 'hashed storage enabled' do
diff --git a/spec/lib/gitlab/checks/lfs_integrity_spec.rb b/spec/lib/gitlab/checks/lfs_integrity_spec.rb
index 88e8f5d74d1..505f117034e 100644
--- a/spec/lib/gitlab/checks/lfs_integrity_spec.rb
+++ b/spec/lib/gitlab/checks/lfs_integrity_spec.rb
@@ -58,7 +58,7 @@ describe Gitlab::Checks::LfsIntegrity do
end
end
- context 'for forked project' do
+ context 'for forked project', :sidekiq_might_not_need_inline do
let(:parent_project) { create(:project, :repository) }
let(:project) { fork_project(parent_project, nil, repository: true) }
diff --git a/spec/lib/gitlab/cycle_analytics/events_spec.rb b/spec/lib/gitlab/cycle_analytics/events_spec.rb
index a163de07967..9eee7e89062 100644
--- a/spec/lib/gitlab/cycle_analytics/events_spec.rb
+++ b/spec/lib/gitlab/cycle_analytics/events_spec.rb
@@ -129,7 +129,7 @@ describe 'cycle analytics events' do
end
end
- describe '#test_events' do
+ describe '#test_events', :sidekiq_might_not_need_inline do
let(:stage) { :test }
let(:merge_request) { MergeRequest.first }
@@ -234,7 +234,7 @@ describe 'cycle analytics events' do
end
end
- describe '#staging_events' do
+ describe '#staging_events', :sidekiq_might_not_need_inline do
let(:stage) { :staging }
let(:merge_request) { MergeRequest.first }
@@ -306,7 +306,7 @@ describe 'cycle analytics events' do
end
end
- describe '#production_events' do
+ describe '#production_events', :sidekiq_might_not_need_inline do
let(:stage) { :production }
let!(:context) { create(:issue, project: project, created_at: 2.days.ago) }
diff --git a/spec/lib/gitlab/cycle_analytics/usage_data_spec.rb b/spec/lib/gitlab/cycle_analytics/usage_data_spec.rb
index e568ea633db..d4ab9bc225b 100644
--- a/spec/lib/gitlab/cycle_analytics/usage_data_spec.rb
+++ b/spec/lib/gitlab/cycle_analytics/usage_data_spec.rb
@@ -71,7 +71,7 @@ describe Gitlab::CycleAnalytics::UsageData do
}
end
- it 'returns the aggregated usage data of every selected project' do
+ it 'returns the aggregated usage data of every selected project', :sidekiq_might_not_need_inline do
result = subject.to_json
expect(result).to have_key(:avg_cycle_analytics)
diff --git a/spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb b/spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb
index 1dfca0b056c..da307754243 100644
--- a/spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb
+++ b/spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb
@@ -43,7 +43,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do
verification_status: 'verified'
end
- it 'assigns the gpg key to the signature when the missing gpg key is added' do
+ it 'assigns the gpg key to the signature when the missing gpg key is added', :sidekiq_might_not_need_inline do
# InvalidGpgSignatureUpdater is called by the after_create hook
gpg_key = create :gpg_key,
key: GpgHelpers::User1.public_key,
@@ -86,7 +86,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do
verification_status: 'unknown_key'
end
- it 'updates the signature to being valid when the missing gpg key is added' do
+ it 'updates the signature to being valid when the missing gpg key is added', :sidekiq_might_not_need_inline do
# InvalidGpgSignatureUpdater is called by the after_create hook
gpg_key = create :gpg_key,
key: GpgHelpers::User1.public_key,
@@ -133,7 +133,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do
verification_status: 'unknown_key'
end
- it 'updates the signature to being valid when the user updates the email address' do
+ it 'updates the signature to being valid when the user updates the email address', :sidekiq_might_not_need_inline do
gpg_key = create :gpg_key,
key: GpgHelpers::User1.public_key,
user: user
@@ -152,7 +152,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do
)
end
- it 'keeps the signature at being invalid when the changed email address is still unrelated' do
+ it 'keeps the signature at being invalid when the changed email address is still unrelated', :sidekiq_might_not_need_inline do
gpg_key = create :gpg_key,
key: GpgHelpers::User1.public_key,
user: user
@@ -192,7 +192,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do
verification_status: 'unknown_key'
end
- it 'updates the signature to being valid when the missing gpg key is added' do
+ it 'updates the signature to being valid when the missing gpg key is added', :sidekiq_might_not_need_inline do
# InvalidGpgSignatureUpdater is called by the after_create hook
gpg_key = create(:gpg_key, key: GpgHelpers::User3.public_key, user: user)
subkey = gpg_key.subkeys.last
diff --git a/spec/lib/gitlab/hashed_storage/migrator_spec.rb b/spec/lib/gitlab/hashed_storage/migrator_spec.rb
index 8e253b51597..ce7f2c4530d 100644
--- a/spec/lib/gitlab/hashed_storage/migrator_spec.rb
+++ b/spec/lib/gitlab/hashed_storage/migrator_spec.rb
@@ -42,7 +42,7 @@ describe Gitlab::HashedStorage::Migrator, :sidekiq, :redis do
subject.bulk_migrate(start: ids.min, finish: ids.max)
end
- it 'has all projects migrated and set as writable' do
+ it 'has all projects migrated and set as writable', :sidekiq_might_not_need_inline do
perform_enqueued_jobs do
subject.bulk_migrate(start: ids.min, finish: ids.max)
end
@@ -79,7 +79,7 @@ describe Gitlab::HashedStorage::Migrator, :sidekiq, :redis do
subject.bulk_rollback(start: ids.min, finish: ids.max)
end
- it 'has all projects rolledback and set as writable' do
+ it 'has all projects rolledback and set as writable', :sidekiq_might_not_need_inline do
perform_enqueued_jobs do
subject.bulk_rollback(start: ids.min, finish: ids.max)
end
@@ -108,7 +108,7 @@ describe Gitlab::HashedStorage::Migrator, :sidekiq, :redis do
expect { subject.migrate(project) }.not_to raise_error
end
- it 'migrates project storage' do
+ it 'migrates project storage', :sidekiq_might_not_need_inline do
perform_enqueued_jobs do
subject.migrate(project)
end
@@ -154,7 +154,7 @@ describe Gitlab::HashedStorage::Migrator, :sidekiq, :redis do
expect { subject.rollback(project) }.not_to raise_error
end
- it 'rolls-back project storage' do
+ it 'rolls-back project storage', :sidekiq_might_not_need_inline do
perform_enqueued_jobs do
subject.rollback(project)
end
diff --git a/spec/lib/gitlab/import_export/fork_spec.rb b/spec/lib/gitlab/import_export/fork_spec.rb
index 71fd5a51c3b..5752fd8fa0d 100644
--- a/spec/lib/gitlab/import_export/fork_spec.rb
+++ b/spec/lib/gitlab/import_export/fork_spec.rb
@@ -47,7 +47,7 @@ describe 'forked project import' do
end
end
- it 'can access the MR' do
+ it 'can access the MR', :sidekiq_might_not_need_inline do
project.merge_requests.first.fetch_ref!
expect(project.repository.ref_exists?('refs/merge-requests/1/head')).to be_truthy
diff --git a/spec/lib/gitlab/phabricator_import/project_creator_spec.rb b/spec/lib/gitlab/phabricator_import/project_creator_spec.rb
index e9455b866ac..fd17284eea2 100644
--- a/spec/lib/gitlab/phabricator_import/project_creator_spec.rb
+++ b/spec/lib/gitlab/phabricator_import/project_creator_spec.rb
@@ -11,7 +11,7 @@ describe Gitlab::PhabricatorImport::ProjectCreator do
subject(:creator) { described_class.new(user, params) }
describe '#execute' do
- it 'creates a project correctly and schedule an import' do
+ it 'creates a project correctly and schedule an import', :sidekiq_might_not_need_inline do
expect_next_instance_of(Gitlab::PhabricatorImport::Importer) do |importer|
expect(importer).to receive(:execute)
end
diff --git a/spec/lib/gitlab/shell_spec.rb b/spec/lib/gitlab/shell_spec.rb
index a17e9a31212..79ad1c0b43f 100644
--- a/spec/lib/gitlab/shell_spec.rb
+++ b/spec/lib/gitlab/shell_spec.rb
@@ -310,18 +310,18 @@ describe Gitlab::Shell do
let(:disk_path) { "#{project.disk_path}.git" }
it 'returns true when the command succeeds' do
- expect(gitlab_shell.exists?(project.repository_storage, disk_path)).to be(true)
+ expect(TestEnv.storage_dir_exists?(project.repository_storage, disk_path)).to be(true)
expect(gitlab_shell.remove_repository(project.repository_storage, project.disk_path)).to be(true)
- expect(gitlab_shell.exists?(project.repository_storage, disk_path)).to be(false)
+ expect(TestEnv.storage_dir_exists?(project.repository_storage, disk_path)).to be(false)
end
it 'keeps the namespace directory' do
gitlab_shell.remove_repository(project.repository_storage, project.disk_path)
- expect(gitlab_shell.exists?(project.repository_storage, disk_path)).to be(false)
- expect(gitlab_shell.exists?(project.repository_storage, project.disk_path.gsub(project.name, ''))).to be(true)
+ expect(TestEnv.storage_dir_exists?(project.repository_storage, disk_path)).to be(false)
+ expect(TestEnv.storage_dir_exists?(project.repository_storage, project.disk_path.gsub(project.name, ''))).to be(true)
end
end
@@ -332,18 +332,18 @@ describe Gitlab::Shell do
old_path = project2.disk_path
new_path = "project/new_path"
- expect(gitlab_shell.exists?(project2.repository_storage, "#{old_path}.git")).to be(true)
- expect(gitlab_shell.exists?(project2.repository_storage, "#{new_path}.git")).to be(false)
+ expect(TestEnv.storage_dir_exists?(project2.repository_storage, "#{old_path}.git")).to be(true)
+ expect(TestEnv.storage_dir_exists?(project2.repository_storage, "#{new_path}.git")).to be(false)
expect(gitlab_shell.mv_repository(project2.repository_storage, old_path, new_path)).to be_truthy
- expect(gitlab_shell.exists?(project2.repository_storage, "#{old_path}.git")).to be(false)
- expect(gitlab_shell.exists?(project2.repository_storage, "#{new_path}.git")).to be(true)
+ expect(TestEnv.storage_dir_exists?(project2.repository_storage, "#{old_path}.git")).to be(false)
+ expect(TestEnv.storage_dir_exists?(project2.repository_storage, "#{new_path}.git")).to be(true)
end
it 'returns false when the command fails' do
expect(gitlab_shell.mv_repository(project2.repository_storage, project2.disk_path, '')).to be_falsy
- expect(gitlab_shell.exists?(project2.repository_storage, "#{project2.disk_path}.git")).to be(true)
+ expect(TestEnv.storage_dir_exists?(project2.repository_storage, "#{project2.disk_path}.git")).to be(true)
end
end
@@ -403,56 +403,32 @@ describe Gitlab::Shell do
it 'creates a namespace' do
subject.add_namespace(storage, "mepmep")
- expect(subject.exists?(storage, "mepmep")).to be(true)
+ expect(TestEnv.storage_dir_exists?(storage, "mepmep")).to be(true)
end
end
- describe '#exists?' do
- context 'when the namespace does not exist' do
+ describe '#repository_exists?' do
+ context 'when the repository does not exist' do
it 'returns false' do
- expect(subject.exists?(storage, "non-existing")).to be(false)
+ expect(subject.repository_exists?(storage, "non-existing.git")).to be(false)
end
end
- context 'when the namespace exists' do
+ context 'when the repository exists' do
it 'returns true' do
- subject.add_namespace(storage, "mepmep")
+ project = create(:project, :repository, :legacy_storage)
- expect(subject.exists?(storage, "mepmep")).to be(true)
+ expect(subject.repository_exists?(storage, project.repository.disk_path + ".git")).to be(true)
end
end
end
- describe '#repository_exists?' do
- context 'when the storage path does not exist' do
- subject { described_class.new.repository_exists?(storage, "non-existing.git") }
-
- it { is_expected.to be_falsey }
- end
-
- context 'when the repository does not exist' do
- let(:project) { create(:project, :repository, :legacy_storage) }
-
- subject { described_class.new.repository_exists?(storage, "#{project.repository.disk_path}-some-other-repo.git") }
-
- it { is_expected.to be_falsey }
- end
-
- context 'when the repository exists' do
- let(:project) { create(:project, :repository, :legacy_storage) }
-
- subject { described_class.new.repository_exists?(storage, "#{project.repository.disk_path}.git") }
-
- it { is_expected.to be_truthy }
- end
- end
-
describe '#remove' do
it 'removes the namespace' do
subject.add_namespace(storage, "mepmep")
subject.rm_namespace(storage, "mepmep")
- expect(subject.exists?(storage, "mepmep")).to be(false)
+ expect(TestEnv.storage_dir_exists?(storage, "mepmep")).to be(false)
end
end
@@ -461,8 +437,8 @@ describe Gitlab::Shell do
subject.add_namespace(storage, "mepmep")
subject.mv_namespace(storage, "mepmep", "2mep")
- expect(subject.exists?(storage, "mepmep")).to be(false)
- expect(subject.exists?(storage, "2mep")).to be(true)
+ expect(TestEnv.storage_dir_exists?(storage, "mepmep")).to be(false)
+ expect(TestEnv.storage_dir_exists?(storage, "2mep")).to be(true)
end
end
end
diff --git a/spec/lib/gitlab/sidekiq_middleware/correlation_logger_spec.rb b/spec/lib/gitlab/sidekiq_middleware/correlation_logger_spec.rb
index 8410467ef1f..27eea963402 100644
--- a/spec/lib/gitlab/sidekiq_middleware/correlation_logger_spec.rb
+++ b/spec/lib/gitlab/sidekiq_middleware/correlation_logger_spec.rb
@@ -19,7 +19,7 @@ describe Gitlab::SidekiqMiddleware::CorrelationLogger do
end
end
- it 'injects into payload the correlation id' do
+ it 'injects into payload the correlation id', :sidekiq_might_not_need_inline do
expect_any_instance_of(described_class).to receive(:call).and_call_original
expect_any_instance_of(TestWorker).to receive(:perform).with(1234) do
diff --git a/spec/lib/gitlab/tracking_spec.rb b/spec/lib/gitlab/tracking_spec.rb
index 50488dba48c..4615599be7e 100644
--- a/spec/lib/gitlab/tracking_spec.rb
+++ b/spec/lib/gitlab/tracking_spec.rb
@@ -13,14 +13,17 @@ describe Gitlab::Tracking do
describe '.snowplow_options' do
it 'returns useful client options' do
- expect(described_class.snowplow_options(nil)).to eq(
+ expected_fields = {
namespace: 'gl',
hostname: 'gitfoo.com',
cookieDomain: '.gitfoo.com',
appId: '_abc123_',
formTracking: true,
- linkClickTracking: true
- )
+ linkClickTracking: true,
+ userId: nil
+ }
+
+ expect(subject.snowplow_options(nil, nil)).to match(expected_fields)
end
it 'enables features using feature flags' do
@@ -29,11 +32,12 @@ describe Gitlab::Tracking do
:additional_snowplow_tracking,
'_group_'
).and_return(false)
-
- expect(described_class.snowplow_options('_group_')).to include(
+ addition_feature_fields = {
formTracking: false,
linkClickTracking: false
- )
+ }
+
+ expect(subject.snowplow_options('_group_', nil)).to include(addition_feature_fields)
end
end
diff --git a/spec/lib/gitlab/user_access_spec.rb b/spec/lib/gitlab/user_access_spec.rb
index c25bd14fcba..4e7c43a6856 100644
--- a/spec/lib/gitlab/user_access_spec.rb
+++ b/spec/lib/gitlab/user_access_spec.rb
@@ -148,7 +148,7 @@ describe Gitlab::UserAccess do
)
end
- it 'allows users that have push access to the canonical project to push to the MR branch' do
+ it 'allows users that have push access to the canonical project to push to the MR branch', :sidekiq_might_not_need_inline do
canonical_project.add_developer(user)
expect(access.can_push_to_branch?('awesome-feature')).to be_truthy