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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-12-21 18:12:00 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-21 18:12:00 +0300
commit6323146895db2be6f04846b3c98060b7349207b9 (patch)
tree9b29de45421be0a9a6126001bd920d780467b1db /spec
parent2779809e45970e7660521b94dbebcf24ed00d60d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/factories/ci/job_artifacts.rb9
-rw-r--r--spec/features/projects/environments/environment_spec.rb2
-rw-r--r--spec/fixtures/security_reports/master/gl-common-scanning-report-with-unicode-null-character.json79
-rw-r--r--spec/lib/api/entities/merge_request_basic_spec.rb2
-rw-r--r--spec/lib/gitlab/bitbucket_server_import/importers/users_importer_spec.rb7
-rw-r--r--spec/lib/gitlab/checks/changes_access_spec.rb6
-rw-r--r--spec/lib/gitlab/checks/diff_check_spec.rb2
-rw-r--r--spec/lib/gitlab/checks/lfs_check_spec.rb2
-rw-r--r--spec/lib/gitlab/checks/lfs_integrity_spec.rb2
-rw-r--r--spec/lib/gitlab/ci/build/policy/changes_spec.rb2
-rw-r--r--spec/lib/gitlab/ci/parsers/security/common_spec.rb14
-rw-r--r--spec/lib/gitlab/ci/pipeline/chain/command_spec.rb2
-rw-r--r--spec/lib/gitlab/data_builder/push_spec.rb4
-rw-r--r--spec/lib/gitlab/diff/file_spec.rb2
-rw-r--r--spec/lib/gitlab/git/commit_spec.rb2
-rw-r--r--spec/lib/gitlab/git/push_spec.rb14
-rw-r--r--spec/lib/gitlab/git/repository_cleaner_spec.rb4
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb18
-rw-r--r--spec/lib/gitlab/git/tag_spec.rb2
-rw-r--r--spec/lib/gitlab/git_access_project_spec.rb4
-rw-r--r--spec/lib/gitlab/git_access_spec.rb8
-rw-r--r--spec/lib/gitlab/git_spec.rb2
-rw-r--r--spec/lib/gitlab/github_gists_import/importer/gists_importer_spec.rb4
-rw-r--r--spec/lib/gitlab/github_import/importer/collaborators_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/issue_events_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/issues_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/lfs_objects_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/notes_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/protected_branches_importer_spec.rb4
-rw-r--r--spec/lib/gitlab/github_import/importer/pull_requests/review_requests_importer_spec.rb6
-rw-r--r--spec/lib/gitlab/github_import/importer/pull_requests/reviews_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/single_endpoint_diff_notes_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/single_endpoint_issue_events_importer_spec.rb6
-rw-r--r--spec/lib/gitlab/github_import/importer/single_endpoint_issue_notes_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/single_endpoint_merge_request_notes_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/parallel_scheduling_spec.rb85
-rw-r--r--spec/lib/gitlab/import/page_counter_spec.rb (renamed from spec/lib/gitlab/github_import/page_counter_spec.rb)4
-rw-r--r--spec/mailers/notify_spec.rb91
-rw-r--r--spec/models/ci/pipeline_spec.rb6
-rw-r--r--spec/models/commit_collection_spec.rb2
-rw-r--r--spec/models/commit_status_spec.rb2
-rw-r--r--spec/models/deployment_spec.rb2
-rw-r--r--spec/models/design_management/design_spec.rb2
-rw-r--r--spec/models/integrations/chat_message/push_message_spec.rb8
-rw-r--r--spec/models/integrations/teamcity_spec.rb2
-rw-r--r--spec/models/merge_request_diff_spec.rb2
-rw-r--r--spec/models/note_diff_file_spec.rb2
-rw-r--r--spec/models/repository_spec.rb6
-rw-r--r--spec/requests/api/internal/base_spec.rb2
-rw-r--r--spec/serializers/profile/event_entity_spec.rb2
-rw-r--r--spec/services/design_management/save_designs_service_spec.rb2
-rw-r--r--spec/services/git/base_hooks_service_spec.rb2
-rw-r--r--spec/services/git/branch_hooks_service_spec.rb18
-rw-r--r--spec/services/git/branch_push_service_spec.rb2
-rw-r--r--spec/services/git/process_ref_changes_service_spec.rb26
-rw-r--r--spec/services/git/tag_hooks_service_spec.rb2
-rw-r--r--spec/services/git/tag_push_service_spec.rb2
-rw-r--r--spec/services/git/wiki_push_service_spec.rb2
-rw-r--r--spec/services/merge_requests/conflicts/list_service_spec.rb2
-rw-r--r--spec/services/merge_requests/get_urls_service_spec.rb6
-rw-r--r--spec/services/merge_requests/push_options_handler_service_spec.rb8
-rw-r--r--spec/services/merge_requests/refresh_service_spec.rb4
-rw-r--r--spec/services/post_receive_service_spec.rb2
-rw-r--r--spec/services/projects/cleanup_service_spec.rb2
-rw-r--r--spec/services/projects/fork_service_spec.rb2
-rw-r--r--spec/services/push_event_payload_service_spec.rb12
-rw-r--r--spec/support/helpers/cycle_analytics_helpers.rb2
-rw-r--r--spec/support/rspec_order_todo.yml2
-rw-r--r--spec/support/shared_examples/models/concerns/integrations/base_slack_notification_shared_examples.rb2
-rw-r--r--spec/support/shared_examples/models/concerns/integrations/slack_mattermost_notifier_shared_examples.rb2
-rw-r--r--spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb2
-rw-r--r--spec/workers/emails_on_push_worker_spec.rb4
-rw-r--r--spec/workers/gitlab/bitbucket_server_import/stage/import_users_worker_spec.rb15
75 files changed, 376 insertions, 196 deletions
diff --git a/spec/factories/ci/job_artifacts.rb b/spec/factories/ci/job_artifacts.rb
index 1c418f646f6..292138d76db 100644
--- a/spec/factories/ci/job_artifacts.rb
+++ b/spec/factories/ci/job_artifacts.rb
@@ -403,6 +403,15 @@ FactoryBot.define do
end
end
+ trait :common_security_report_with_unicode_null_character do
+ common_security_report
+
+ after(:build) do |artifact, _|
+ artifact.file = fixture_file_upload(
+ Rails.root.join('spec/fixtures/security_reports/master/gl-common-scanning-report-with-unicode-null-character.json'), 'application/json')
+ end
+ end
+
trait :sast_with_corrupted_data do
file_type { :sast }
file_format { :raw }
diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb
index de4ce3a23b6..57eaef2621e 100644
--- a/spec/features/projects/environments/environment_spec.rb
+++ b/spec/features/projects/environments/environment_spec.rb
@@ -319,7 +319,7 @@ RSpec.describe 'Environment', feature_category: :environment_management do
params = {
change: {
oldrev: project.commit(branch).id,
- newrev: Gitlab::Git::BLANK_SHA,
+ newrev: Gitlab::Git::SHA1_BLANK_SHA,
ref: "refs/heads/#{branch}"
}
}
diff --git a/spec/fixtures/security_reports/master/gl-common-scanning-report-with-unicode-null-character.json b/spec/fixtures/security_reports/master/gl-common-scanning-report-with-unicode-null-character.json
new file mode 100644
index 00000000000..852327fc084
--- /dev/null
+++ b/spec/fixtures/security_reports/master/gl-common-scanning-report-with-unicode-null-character.json
@@ -0,0 +1,79 @@
+{
+ "vulnerabilities": [
+ {
+ "id": "vulnerability-1",
+ "category": "dependency_scanning",
+ "name": "Vulnerability for remediation testing 1",
+ "message": "This vulnerability should have ONE remediation",
+ "description": "",
+ "severity": "High",
+ "solution": "Upgrade to latest version.\u0000",
+ "scanner": {
+ "id": "gemnasium",
+ "name": "Gemnasium"
+ },
+ "cvss_vectors": [
+ {
+ "vendor": "GitLab",
+ "vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
+ }
+ ],
+ "location": {
+ "file": "some/kind/of/file.c",
+ "dependency": {
+ "package": {
+ "name": "io.netty/netty"
+ },
+ "version": "3.9.1.Final"
+ }
+ },
+ "identifiers": [
+ {
+ "type": "GitLab",
+ "name": "Foo vulnerability",
+ "value": "foo"
+ }
+ ],
+ "links": [
+ {
+ "url": "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-2137"
+ }
+ ],
+ "details": {
+ "commit": {
+ "name": "the commit",
+ "description": "description",
+ "type": "commit",
+ "value": "41df7b7eb3be2b5be2c406c2f6d28cd6631eeb19"
+ }
+ }
+ }
+ ],
+ "remediations": [],
+ "dependency_files": [],
+ "scan": {
+ "analyzer": {
+ "id": "common-analyzer",
+ "name": "Common Analyzer",
+ "url": "https://site.com/analyzer/common",
+ "version": "2.0.1",
+ "vendor": {
+ "name": "Common"
+ }
+ },
+ "scanner": {
+ "id": "gemnasium",
+ "name": "Gemnasium top-level",
+ "url": "https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven",
+ "vendor": {
+ "name": "GitLab"
+ },
+ "version": "2.18.0"
+ },
+ "type": "dependency_scanning",
+ "start_time": "2022-08-10T21:37:00",
+ "end_time": "2022-08-10T21:38:00",
+ "status": "success"
+ },
+ "version": "14.0.2"
+}
diff --git a/spec/lib/api/entities/merge_request_basic_spec.rb b/spec/lib/api/entities/merge_request_basic_spec.rb
index 0cf0a57fa87..621d57b49cd 100644
--- a/spec/lib/api/entities/merge_request_basic_spec.rb
+++ b/spec/lib/api/entities/merge_request_basic_spec.rb
@@ -41,7 +41,7 @@ RSpec.describe ::API::Entities::MergeRequestBasic, feature_category: :code_revie
# stub the `head_commit_sha` as it will trigger a
# backward compatibility query that is out-of-scope
# for this test whenever it is `nil`
- allow_any_instance_of(MergeRequestDiff).to receive(:head_commit_sha).and_return(Gitlab::Git::BLANK_SHA)
+ allow_any_instance_of(MergeRequestDiff).to receive(:head_commit_sha).and_return(Gitlab::Git::SHA1_BLANK_SHA)
query = scope.all
batch = ActiveRecord::QueryRecorder.new do
diff --git a/spec/lib/gitlab/bitbucket_server_import/importers/users_importer_spec.rb b/spec/lib/gitlab/bitbucket_server_import/importers/users_importer_spec.rb
index 33d6ab94513..79010390628 100644
--- a/spec/lib/gitlab/bitbucket_server_import/importers/users_importer_spec.rb
+++ b/spec/lib/gitlab/bitbucket_server_import/importers/users_importer_spec.rb
@@ -52,6 +52,13 @@ RSpec.describe Gitlab::BitbucketServerImport::Importers::UsersImporter, feature_
expect(logger).to receive(:info).with(hash_including(message: 'importing page 3 using batch size 2'))
expect(logger).to receive(:info).with(hash_including(message: 'finished'))
+ expect_next_instance_of(Gitlab::Import::PageCounter) do |page_counter|
+ expect(page_counter).to receive(:current).and_call_original.once
+ expect(page_counter).to receive(:set).with(2).and_call_original.once
+ expect(page_counter).to receive(:set).with(3).and_call_original.once
+ expect(page_counter).to receive(:expire!).and_call_original.once
+ end
+
expect(Gitlab::Cache::Import::Caching).to receive(:write_multiple).and_call_original.twice
importer.execute
diff --git a/spec/lib/gitlab/checks/changes_access_spec.rb b/spec/lib/gitlab/checks/changes_access_spec.rb
index 854c04dd581..d20399cf7cf 100644
--- a/spec/lib/gitlab/checks/changes_access_spec.rb
+++ b/spec/lib/gitlab/checks/changes_access_spec.rb
@@ -78,13 +78,13 @@ RSpec.describe Gitlab::Checks::ChangesAccess, feature_category: :source_code_man
end
context 'with oldrev' do
- let(:changes) { [{ oldrev: oldrev, newrev: newrev }, { newrev: '' }, { newrev: Gitlab::Git::BLANK_SHA }] }
+ let(:changes) { [{ oldrev: oldrev, newrev: newrev }, { newrev: '' }, { newrev: Gitlab::Git::SHA1_BLANK_SHA }] }
it_behaves_like 'returns only commits with non empty revisions'
end
context 'without oldrev' do
- let(:changes) { [{ newrev: newrev }, { newrev: '' }, { newrev: Gitlab::Git::BLANK_SHA }] }
+ let(:changes) { [{ newrev: newrev }, { newrev: '' }, { newrev: Gitlab::Git::SHA1_BLANK_SHA }] }
it_behaves_like 'returns only commits with non empty revisions'
end
@@ -94,7 +94,7 @@ RSpec.describe Gitlab::Checks::ChangesAccess, feature_category: :source_code_man
describe '#commits_for' do
let(:new_commits) { [] }
let(:expected_commits) { [] }
- let(:oldrev) { Gitlab::Git::BLANK_SHA }
+ let(:oldrev) { Gitlab::Git::SHA1_BLANK_SHA }
shared_examples 'a listing of new commits' do
it 'returns expected commits' do
diff --git a/spec/lib/gitlab/checks/diff_check_spec.rb b/spec/lib/gitlab/checks/diff_check_spec.rb
index 20c6ad8a6e8..8056611b5bd 100644
--- a/spec/lib/gitlab/checks/diff_check_spec.rb
+++ b/spec/lib/gitlab/checks/diff_check_spec.rb
@@ -63,7 +63,7 @@ RSpec.describe Gitlab::Checks::DiffCheck, feature_category: :source_code_managem
end
context 'when deletion is true' do
- let(:newrev) { Gitlab::Git::BLANK_SHA }
+ let(:newrev) { Gitlab::Git::SHA1_BLANK_SHA }
it 'does not call find_changed_paths' do
expect(project.repository).not_to receive(:find_changed_paths)
diff --git a/spec/lib/gitlab/checks/lfs_check_spec.rb b/spec/lib/gitlab/checks/lfs_check_spec.rb
index 9f001dd1941..f00915bc1ec 100644
--- a/spec/lib/gitlab/checks/lfs_check_spec.rb
+++ b/spec/lib/gitlab/checks/lfs_check_spec.rb
@@ -61,7 +61,7 @@ RSpec.describe Gitlab::Checks::LfsCheck, feature_category: :source_code_manageme
context 'with blank newrev' do
it_behaves_like 'a skipped integrity check' do
- let(:changes) { [{ oldrev: oldrev, newrev: Gitlab::Git::BLANK_SHA, ref: ref }] }
+ let(:changes) { [{ oldrev: oldrev, newrev: Gitlab::Git::SHA1_BLANK_SHA, ref: ref }] }
end
end
end
diff --git a/spec/lib/gitlab/checks/lfs_integrity_spec.rb b/spec/lib/gitlab/checks/lfs_integrity_spec.rb
index 0aecf26f42f..4f844f10f34 100644
--- a/spec/lib/gitlab/checks/lfs_integrity_spec.rb
+++ b/spec/lib/gitlab/checks/lfs_integrity_spec.rb
@@ -66,7 +66,7 @@ RSpec.describe Gitlab::Checks::LfsIntegrity, feature_category: :source_code_mana
end
context 'deletion' do
- let(:newrevs) { [Gitlab::Git::BLANK_SHA] }
+ let(:newrevs) { [Gitlab::Git::SHA1_BLANK_SHA] }
it 'skips integrity check' do
expect_any_instance_of(Gitlab::Git::LfsChanges).not_to receive(:new_pointers)
diff --git a/spec/lib/gitlab/ci/build/policy/changes_spec.rb b/spec/lib/gitlab/ci/build/policy/changes_spec.rb
index 00e44650d44..4ee8903dcd3 100644
--- a/spec/lib/gitlab/ci/build/policy/changes_spec.rb
+++ b/spec/lib/gitlab/ci/build/policy/changes_spec.rb
@@ -134,7 +134,7 @@ RSpec.describe Gitlab::Ci::Build::Policy::Changes do
ref: 'feature',
source: source,
sha: '0b4bc9a4',
- before_sha: Gitlab::Git::BLANK_SHA,
+ before_sha: Gitlab::Git::SHA1_BLANK_SHA,
merge_request: merge_request
)
end
diff --git a/spec/lib/gitlab/ci/parsers/security/common_spec.rb b/spec/lib/gitlab/ci/parsers/security/common_spec.rb
index 431a6d94c48..bfcc87179af 100644
--- a/spec/lib/gitlab/ci/parsers/security/common_spec.rb
+++ b/spec/lib/gitlab/ci/parsers/security/common_spec.rb
@@ -476,6 +476,20 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Common, feature_category: :vulnera
end
end
end
+
+ describe 'handling the unicode null characters' do
+ let(:artifact) { build(:ci_job_artifact, :common_security_report_with_unicode_null_character) }
+
+ it 'escapes the unicode null characters while parsing the report' do
+ finding = report.findings.first
+
+ expect(finding.solution).to eq('Upgrade to latest version.\u0000')
+ end
+
+ it 'adds warning to report' do
+ expect(report.warnings).to include({ type: 'Parsing', message: 'Report artifact contained unicode null characters which are escaped during the ingestion.' })
+ end
+ end
end
end
end
diff --git a/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb
index 68158503628..37535b80cd4 100644
--- a/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb
+++ b/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb
@@ -200,7 +200,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Command do
let(:command) { described_class.new(project: project) }
it 'uses BLANK_SHA' do
- is_expected.to eq(Gitlab::Git::BLANK_SHA)
+ is_expected.to eq(Gitlab::Git::SHA1_BLANK_SHA)
end
end
end
diff --git a/spec/lib/gitlab/data_builder/push_spec.rb b/spec/lib/gitlab/data_builder/push_spec.rb
index 02dc596c5eb..2d2beaff339 100644
--- a/spec/lib/gitlab/data_builder/push_spec.rb
+++ b/spec/lib/gitlab/data_builder/push_spec.rb
@@ -89,13 +89,13 @@ RSpec.describe Gitlab::DataBuilder::Push do
described_class.build(
project: project,
user: user,
- oldrev: Gitlab::Git::BLANK_SHA,
+ oldrev: Gitlab::Git::SHA1_BLANK_SHA,
newrev: '8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b',
ref: 'refs/tags/v1.1.0')
end
it { expect(data).to be_a(Hash) }
- it { expect(data[:before]).to eq(Gitlab::Git::BLANK_SHA) }
+ it { expect(data[:before]).to eq(Gitlab::Git::SHA1_BLANK_SHA) }
it { expect(data[:checkout_sha]).to eq('5937ac0a7beb003549fc5fd26fc247adbce4a52e') }
it { expect(data[:after]).to eq('8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b') }
it { expect(data[:ref]).to eq('refs/tags/v1.1.0') }
diff --git a/spec/lib/gitlab/diff/file_spec.rb b/spec/lib/gitlab/diff/file_spec.rb
index 2cd27472440..9e5d3ab0a20 100644
--- a/spec/lib/gitlab/diff/file_spec.rb
+++ b/spec/lib/gitlab/diff/file_spec.rb
@@ -820,7 +820,7 @@ RSpec.describe Gitlab::Diff::File do
end
context 'when neither blob exists' do
- let(:blank_diff_refs) { Gitlab::Diff::DiffRefs.new(base_sha: Gitlab::Git::BLANK_SHA, head_sha: Gitlab::Git::BLANK_SHA) }
+ let(:blank_diff_refs) { Gitlab::Diff::DiffRefs.new(base_sha: Gitlab::Git::SHA1_BLANK_SHA, head_sha: Gitlab::Git::SHA1_BLANK_SHA) }
let(:diff_file) { described_class.new(diff, diff_refs: blank_diff_refs, repository: project.repository) }
describe '#blob' do
diff --git a/spec/lib/gitlab/git/commit_spec.rb b/spec/lib/gitlab/git/commit_spec.rb
index 6c8634281ae..a924137b8ec 100644
--- a/spec/lib/gitlab/git/commit_spec.rb
+++ b/spec/lib/gitlab/git/commit_spec.rb
@@ -522,7 +522,7 @@ RSpec.describe Gitlab::Git::Commit, feature_category: :source_code_management do
end
context 'when the commit cannot be found' do
- let(:commit_id) { Gitlab::Git::BLANK_SHA }
+ let(:commit_id) { Gitlab::Git::SHA1_BLANK_SHA }
it 'returns nil' do
expect(subject).to be_nil
diff --git a/spec/lib/gitlab/git/push_spec.rb b/spec/lib/gitlab/git/push_spec.rb
index a0a4a22699b..f249e8316da 100644
--- a/spec/lib/gitlab/git/push_spec.rb
+++ b/spec/lib/gitlab/git/push_spec.rb
@@ -55,13 +55,13 @@ RSpec.describe Gitlab::Git::Push do
end
context 'when old revision is blank' do
- let(:oldrev) { Gitlab::Git::BLANK_SHA }
+ let(:oldrev) { Gitlab::Git::SHA1_BLANK_SHA }
it { is_expected.not_to be_branch_updated }
end
context 'when it is not a branch push' do
- let(:newrev) { Gitlab::Git::BLANK_SHA }
+ let(:newrev) { Gitlab::Git::SHA1_BLANK_SHA }
it { is_expected.not_to be_branch_updated }
end
@@ -105,7 +105,7 @@ RSpec.describe Gitlab::Git::Push do
end
context 'when old revision is not defined' do
- let(:oldrev) { Gitlab::Git::BLANK_SHA }
+ let(:oldrev) { Gitlab::Git::SHA1_BLANK_SHA }
it { is_expected.to be_branch_added }
end
@@ -117,7 +117,7 @@ RSpec.describe Gitlab::Git::Push do
end
context 'when new revision is not defined' do
- let(:newrev) { Gitlab::Git::BLANK_SHA }
+ let(:newrev) { Gitlab::Git::SHA1_BLANK_SHA }
it { is_expected.to be_branch_removed }
end
@@ -136,7 +136,7 @@ RSpec.describe Gitlab::Git::Push do
end
context 'when a push is not a branch update' do
- let(:oldrev) { Gitlab::Git::BLANK_SHA }
+ let(:oldrev) { Gitlab::Git::SHA1_BLANK_SHA }
it 'raises an error' do
expect { subject.modified_paths }.to raise_error(ArgumentError)
@@ -155,7 +155,7 @@ RSpec.describe Gitlab::Git::Push do
let(:oldrev) { nil }
it 'returns blank SHA' do
- expect(subject.oldrev).to eq Gitlab::Git::BLANK_SHA
+ expect(subject.oldrev).to eq Gitlab::Git::SHA1_BLANK_SHA
end
end
end
@@ -171,7 +171,7 @@ RSpec.describe Gitlab::Git::Push do
let(:newrev) { nil }
it 'returns blank SHA' do
- expect(subject.newrev).to eq Gitlab::Git::BLANK_SHA
+ expect(subject.newrev).to eq Gitlab::Git::SHA1_BLANK_SHA
end
end
end
diff --git a/spec/lib/gitlab/git/repository_cleaner_spec.rb b/spec/lib/gitlab/git/repository_cleaner_spec.rb
index 9f1bf9e48ee..a9ba87ad5b5 100644
--- a/spec/lib/gitlab/git/repository_cleaner_spec.rb
+++ b/spec/lib/gitlab/git/repository_cleaner_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe Gitlab::Git::RepositoryCleaner do
let(:project) { create(:project, :repository) }
let(:repository) { project.repository }
let(:head_sha) { repository.head_commit.id }
- let(:object_map_data) { "#{head_sha} #{Gitlab::Git::BLANK_SHA}" }
+ let(:object_map_data) { "#{head_sha} #{Gitlab::Git::SHA1_BLANK_SHA}" }
let(:clean_refs) { %W[refs/environments/1 refs/merge-requests/1 refs/keep-around/#{head_sha}] }
let(:keep_refs) { %w[refs/heads/_keep refs/tags/_keep] }
@@ -35,7 +35,7 @@ RSpec.describe Gitlab::Git::RepositoryCleaner do
Gitaly::ApplyBfgObjectMapStreamResponse::Entry.new(
type: :COMMIT,
old_oid: head_sha,
- new_oid: Gitlab::Git::BLANK_SHA
+ new_oid: Gitlab::Git::SHA1_BLANK_SHA
)
)
end
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index cc07a16d362..ca3c058968a 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -566,7 +566,7 @@ RSpec.describe Gitlab::Git::Repository, feature_category: :source_code_managemen
[
{
old_sha: sha,
- new_sha: Gitlab::Git::BLANK_SHA,
+ new_sha: Gitlab::Git::SHA1_BLANK_SHA,
reference: tmp_ref
}
]
@@ -1155,7 +1155,7 @@ RSpec.describe Gitlab::Git::Repository, feature_category: :source_code_managemen
end
context 'blank revisions' do
- let(:revisions) { [::Gitlab::Git::BLANK_SHA] }
+ let(:revisions) { [::Gitlab::Git::SHA1_BLANK_SHA] }
let(:expected_blobs) { 0 }
before do
@@ -1278,7 +1278,7 @@ RSpec.describe Gitlab::Git::Repository, feature_category: :source_code_managemen
end
context 'with partially blank revisions' do
- let(:newrevs) { [nil, commit, Gitlab::Git::BLANK_SHA] }
+ let(:newrevs) { [nil, commit, Gitlab::Git::SHA1_BLANK_SHA] }
let(:expected_newrevs) { ['--not', '--all', '--not', commit] }
let(:expected_blobs) do
[
@@ -1326,7 +1326,7 @@ RSpec.describe Gitlab::Git::Repository, feature_category: :source_code_managemen
end
context 'with a single zero newrev' do
- let(:newrevs) { Gitlab::Git::BLANK_SHA }
+ let(:newrevs) { Gitlab::Git::SHA1_BLANK_SHA }
it_behaves_like '#new_blobs without revisions'
end
@@ -1338,7 +1338,7 @@ RSpec.describe Gitlab::Git::Repository, feature_category: :source_code_managemen
end
context 'with array containing only empty refs' do
- let(:newrevs) { [nil, Gitlab::Git::BLANK_SHA] }
+ let(:newrevs) { [nil, Gitlab::Git::SHA1_BLANK_SHA] }
it_behaves_like '#new_blobs without revisions'
end
@@ -1400,7 +1400,7 @@ RSpec.describe Gitlab::Git::Repository, feature_category: :source_code_managemen
let(:changes) { repository.raw_changes_between(old_rev, new_rev) }
context 'initial commit' do
- let(:old_rev) { Gitlab::Git::BLANK_SHA }
+ let(:old_rev) { Gitlab::Git::SHA1_BLANK_SHA }
let(:new_rev) { '1a0b36b3cdad1d2ee32457c102a8c0b7056fa863' }
it 'returns the changes' do
@@ -1681,11 +1681,11 @@ RSpec.describe Gitlab::Git::Repository, feature_category: :source_code_managemen
expect(collection.to_a).to be_empty
end
- it 'returns no Gitaly::DiffStats when there is a BLANK_SHA' do
+ it 'returns no Gitaly::DiffStats when there is a SHA1_BLANK_SHA' do
expect_any_instance_of(Gitlab::GitalyClient::CommitService)
.not_to receive(:diff_stats)
- collection = repository.diff_stats(Gitlab::Git::BLANK_SHA, 'master')
+ collection = repository.diff_stats(Gitlab::Git::SHA1_BLANK_SHA, 'master')
expect(collection).to be_a(Gitlab::Git::DiffStatsCollection)
expect(collection).to be_a(Enumerable)
@@ -2222,7 +2222,7 @@ RSpec.describe Gitlab::Git::Repository, feature_category: :source_code_managemen
end
it 'returns empty for unknown ID' do
- expect(repository.refs_by_oid(oid: Gitlab::Git::BLANK_SHA, limit: 0)).to eq([])
+ expect(repository.refs_by_oid(oid: Gitlab::Git::SHA1_BLANK_SHA, limit: 0)).to eq([])
end
it 'returns empty for an empty repo' do
diff --git a/spec/lib/gitlab/git/tag_spec.rb b/spec/lib/gitlab/git/tag_spec.rb
index a15c74a058d..7f1887f519b 100644
--- a/spec/lib/gitlab/git/tag_spec.rb
+++ b/spec/lib/gitlab/git/tag_spec.rb
@@ -91,7 +91,7 @@ RSpec.describe Gitlab::Git::Tag, feature_category: :source_code_management do
end
context 'when the tag cannot be found' do
- let(:tag_id) { Gitlab::Git::BLANK_SHA }
+ let(:tag_id) { Gitlab::Git::SHA1_BLANK_SHA }
it 'raises GRPC::Internal' do
expect { subject }.to raise_error(GRPC::Internal)
diff --git a/spec/lib/gitlab/git_access_project_spec.rb b/spec/lib/gitlab/git_access_project_spec.rb
index ad593cbf005..abcc5c5863e 100644
--- a/spec/lib/gitlab/git_access_project_spec.rb
+++ b/spec/lib/gitlab/git_access_project_spec.rb
@@ -141,7 +141,9 @@ RSpec.describe Gitlab::GitAccessProject do
end
context 'when check contains actual changes' do
- let(:changes) { "#{Gitlab::Git::BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/new_branch" }
+ let(:changes) do
+ "#{Gitlab::Git::SHA1_BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/new_branch"
+ end
it_behaves_like 'no project is created'
end
diff --git a/spec/lib/gitlab/git_access_spec.rb b/spec/lib/gitlab/git_access_spec.rb
index 975e8bdd3ac..71f9a7d0f0e 100644
--- a/spec/lib/gitlab/git_access_spec.rb
+++ b/spec/lib/gitlab/git_access_spec.rb
@@ -802,13 +802,13 @@ RSpec.describe Gitlab::GitAccess, :aggregate_failures, feature_category: :system
let(:changes) do
{ any: Gitlab::GitAccess::ANY,
- push_new_branch: "#{Gitlab::Git::BLANK_SHA} 570e7b2ab refs/heads/wow",
+ push_new_branch: "#{Gitlab::Git::SHA1_BLANK_SHA} 570e7b2ab refs/heads/wow",
push_master: '6f6d7e7ed 570e7b2ab refs/heads/master',
push_protected_branch: '6f6d7e7ed 570e7b2ab refs/heads/feature',
- push_remove_protected_branch: "570e7b2ab #{Gitlab::Git::BLANK_SHA} "\
+ push_remove_protected_branch: "570e7b2ab #{Gitlab::Git::SHA1_BLANK_SHA} "\
'refs/heads/feature',
push_tag: '6f6d7e7ed 570e7b2ab refs/tags/v1.0.0',
- push_new_tag: "#{Gitlab::Git::BLANK_SHA} 570e7b2ab refs/tags/v7.8.9",
+ push_new_tag: "#{Gitlab::Git::SHA1_BLANK_SHA} 570e7b2ab refs/tags/v7.8.9",
push_all: ['6f6d7e7ed 570e7b2ab refs/heads/master', '6f6d7e7ed 570e7b2ab refs/heads/feature'],
merge_into_protected_branch: "0b4bc9a #{merge_into_protected_branch} refs/heads/feature" }
end
@@ -1018,7 +1018,7 @@ RSpec.describe Gitlab::GitAccess, :aggregate_failures, feature_category: :system
context 'when pushing to a project' do
let(:project) { create(:project, :public, :repository) }
- let(:changes) { "#{Gitlab::Git::BLANK_SHA} 570e7b2ab refs/heads/wow" }
+ let(:changes) { "#{Gitlab::Git::SHA1_BLANK_SHA} 570e7b2ab refs/heads/wow" }
before do
project.add_developer(user)
diff --git a/spec/lib/gitlab/git_spec.rb b/spec/lib/gitlab/git_spec.rb
index 0f6ef55b4b1..61f66c9cd0c 100644
--- a/spec/lib/gitlab/git_spec.rb
+++ b/spec/lib/gitlab/git_spec.rb
@@ -32,7 +32,7 @@ RSpec.describe Gitlab::Git do
'zzz25dc642cb6eb9a060e54bf8d69288fbee4904' | false
'4b825dc642cb6eb9a060e54bf8d69288fbee4904' | true
- Gitlab::Git::BLANK_SHA | true
+ Gitlab::Git::SHA1_BLANK_SHA | true
end
with_them do
diff --git a/spec/lib/gitlab/github_gists_import/importer/gists_importer_spec.rb b/spec/lib/gitlab/github_gists_import/importer/gists_importer_spec.rb
index d555a847ea5..b6a57ef8b57 100644
--- a/spec/lib/gitlab/github_gists_import/importer/gists_importer_spec.rb
+++ b/spec/lib/gitlab/github_gists_import/importer/gists_importer_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe Gitlab::GithubGistsImport::Importer::GistsImporter, feature_categ
let_it_be(:user) { create(:user) }
let(:client) { instance_double('Gitlab::GithubImport::Client', rate_limit_resets_in: 5) }
let(:token) { 'token' }
- let(:page_counter) { instance_double('Gitlab::GithubImport::PageCounter', current: 1, set: true, expire!: true) }
+ let(:page_counter) { instance_double('Gitlab::Import::PageCounter', current: 1, set: true, expire!: true) }
let(:page) { instance_double('Gitlab::GithubImport::Client::Page', objects: [gist], number: 1) }
let(:url) { 'https://gist.github.com/foo/bar.git' }
let(:waiter) { Gitlab::JobWaiter.new(0, 'some-job-key') }
@@ -62,7 +62,7 @@ RSpec.describe Gitlab::GithubGistsImport::Importer::GistsImporter, feature_categ
.with(token, parallel: true)
.and_return(client)
- allow(Gitlab::GithubImport::PageCounter)
+ allow(Gitlab::Import::PageCounter)
.to receive(:new)
.with(user, :gists, 'github-gists-importer')
.and_return(page_counter)
diff --git a/spec/lib/gitlab/github_import/importer/collaborators_importer_spec.rb b/spec/lib/gitlab/github_import/importer/collaborators_importer_spec.rb
index c1e9bed5681..d0d3e6c6da8 100644
--- a/spec/lib/gitlab/github_import/importer/collaborators_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/collaborators_importer_spec.rb
@@ -83,7 +83,7 @@ RSpec.describe Gitlab::GithubImport::Importer::CollaboratorsImporter, feature_ca
it 'imports each collaborator in parallel' do
expect(Gitlab::GithubImport::ImportCollaboratorWorker).to receive(:perform_in)
- .with(1, project.id, an_instance_of(Hash), an_instance_of(String))
+ .with(an_instance_of(Float), project.id, an_instance_of(Hash), an_instance_of(String))
waiter = importer.parallel_import
diff --git a/spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb b/spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb
index 1eb146ea958..ed74e978f16 100644
--- a/spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb
@@ -102,7 +102,7 @@ RSpec.describe Gitlab::GithubImport::Importer::DiffNotesImporter, feature_catego
.and_yield(github_comment)
expect(Gitlab::GithubImport::ImportDiffNoteWorker).to receive(:perform_in)
- .with(1, project.id, an_instance_of(Hash), an_instance_of(String))
+ .with(an_instance_of(Float), project.id, an_instance_of(Hash), an_instance_of(String))
waiter = importer.parallel_import
diff --git a/spec/lib/gitlab/github_import/importer/issue_events_importer_spec.rb b/spec/lib/gitlab/github_import/importer/issue_events_importer_spec.rb
index 174cc720717..7e926b3af46 100644
--- a/spec/lib/gitlab/github_import/importer/issue_events_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/issue_events_importer_spec.rb
@@ -82,7 +82,7 @@ RSpec.describe Gitlab::GithubImport::Importer::IssueEventsImporter, feature_cate
allow(importer).to receive(:each_object_to_import).and_yield(issue_event)
expect(Gitlab::GithubImport::ImportIssueEventWorker).to receive(:perform_in).with(
- 1, project.id, an_instance_of(Hash), an_instance_of(String)
+ an_instance_of(Float), project.id, an_instance_of(Hash), an_instance_of(String)
)
waiter = importer.parallel_import
diff --git a/spec/lib/gitlab/github_import/importer/issues_importer_spec.rb b/spec/lib/gitlab/github_import/importer/issues_importer_spec.rb
index 9451d1dfc37..93466497ceb 100644
--- a/spec/lib/gitlab/github_import/importer/issues_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/issues_importer_spec.rb
@@ -96,7 +96,7 @@ RSpec.describe Gitlab::GithubImport::Importer::IssuesImporter, feature_category:
expect(Gitlab::GithubImport::ImportIssueWorker)
.to receive(:perform_in)
- .with(1, project.id, an_instance_of(Hash), an_instance_of(String))
+ .with(an_instance_of(Float), project.id, an_instance_of(Hash), an_instance_of(String))
waiter = importer.parallel_import
diff --git a/spec/lib/gitlab/github_import/importer/lfs_objects_importer_spec.rb b/spec/lib/gitlab/github_import/importer/lfs_objects_importer_spec.rb
index a5ec39b4177..eaf4d41df43 100644
--- a/spec/lib/gitlab/github_import/importer/lfs_objects_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/lfs_objects_importer_spec.rb
@@ -123,7 +123,7 @@ RSpec.describe Gitlab::GithubImport::Importer::LfsObjectsImporter, feature_categ
end
expect(Gitlab::GithubImport::ImportLfsObjectWorker).to receive(:perform_in)
- .with(1, project.id, an_instance_of(Hash), an_instance_of(String))
+ .with(an_instance_of(Float), project.id, an_instance_of(Hash), an_instance_of(String))
waiter = importer.parallel_import
diff --git a/spec/lib/gitlab/github_import/importer/notes_importer_spec.rb b/spec/lib/gitlab/github_import/importer/notes_importer_spec.rb
index 92d3071c826..722470cbc1d 100644
--- a/spec/lib/gitlab/github_import/importer/notes_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/notes_importer_spec.rb
@@ -88,7 +88,7 @@ RSpec.describe Gitlab::GithubImport::Importer::NotesImporter, feature_category:
.and_yield(github_comment)
expect(Gitlab::GithubImport::ImportNoteWorker).to receive(:perform_in)
- .with(1, project.id, an_instance_of(Hash), an_instance_of(String))
+ .with(an_instance_of(Float), project.id, an_instance_of(Hash), an_instance_of(String))
waiter = importer.parallel_import
diff --git a/spec/lib/gitlab/github_import/importer/protected_branches_importer_spec.rb b/spec/lib/gitlab/github_import/importer/protected_branches_importer_spec.rb
index b0892767fb3..b2fc1bea39e 100644
--- a/spec/lib/gitlab/github_import/importer/protected_branches_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/protected_branches_importer_spec.rb
@@ -145,7 +145,7 @@ RSpec.describe Gitlab::GithubImport::Importer::ProtectedBranchesImporter, featur
it 'imports each protected branch in parallel' do
expect(Gitlab::GithubImport::ImportProtectedBranchWorker)
.to receive(:perform_in)
- .with(1, project.id, an_instance_of(Hash), an_instance_of(String))
+ .with(an_instance_of(Float), project.id, an_instance_of(Hash), an_instance_of(String))
expect(Gitlab::GithubImport::ObjectCounter)
.to receive(:increment).with(project, :protected_branch, :fetched)
@@ -166,7 +166,7 @@ RSpec.describe Gitlab::GithubImport::Importer::ProtectedBranchesImporter, featur
# when user has no admin rights on repo
let(:unknown_protection_branch) { branch_struct.new(name: 'development', protection: nil) }
- let(:page_counter) { instance_double(Gitlab::GithubImport::PageCounter) }
+ let(:page_counter) { instance_double(Gitlab::Import::PageCounter) }
before do
allow(client).to receive(:branches).with(project.import_source)
diff --git a/spec/lib/gitlab/github_import/importer/pull_requests/review_requests_importer_spec.rb b/spec/lib/gitlab/github_import/importer/pull_requests/review_requests_importer_spec.rb
index 1977815e3a0..7ba88b4fa79 100644
--- a/spec/lib/gitlab/github_import/importer/pull_requests/review_requests_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/pull_requests/review_requests_importer_spec.rb
@@ -116,10 +116,10 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequests::ReviewRequestsImpor
it 'schedule import for each merge request reviewers' do
expect(Gitlab::GithubImport::PullRequests::ImportReviewRequestWorker)
- .to receive(:perform_in).with(1, *expected_worker_payload.first)
+ .to receive(:perform_in).with(an_instance_of(Float), *expected_worker_payload.first)
expect(Gitlab::GithubImport::PullRequests::ImportReviewRequestWorker)
- .to receive(:perform_in).with(1, *expected_worker_payload.second)
+ .to receive(:perform_in).with(an_instance_of(Float), *expected_worker_payload.second)
expect(Gitlab::GithubImport::ObjectCounter)
.to receive(:increment).twice.with(project, :pull_request_review_request, :fetched)
@@ -137,7 +137,7 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequests::ReviewRequestsImpor
it "doesn't schedule import this merge request reviewers" do
expect(Gitlab::GithubImport::PullRequests::ImportReviewRequestWorker)
- .to receive(:perform_in).with(1, *expected_worker_payload.second)
+ .to receive(:perform_in).with(an_instance_of(Float), *expected_worker_payload.second)
expect(Gitlab::GithubImport::ObjectCounter)
.to receive(:increment).once.with(project, :pull_request_review_request, :fetched)
diff --git a/spec/lib/gitlab/github_import/importer/pull_requests/reviews_importer_spec.rb b/spec/lib/gitlab/github_import/importer/pull_requests/reviews_importer_spec.rb
index f5779f300b8..94248f60a0b 100644
--- a/spec/lib/gitlab/github_import/importer/pull_requests/reviews_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/pull_requests/reviews_importer_spec.rb
@@ -69,7 +69,7 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequests::ReviewsImporter, fe
end
it 'skips cached pages' do
- Gitlab::GithubImport::PageCounter
+ Gitlab::Import::PageCounter
.new(project, "merge_request/#{merge_request.id}/pull_request_reviews")
.set(2)
diff --git a/spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb b/spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb
index 1a0adbbe3a3..4c6b6a81d35 100644
--- a/spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb
@@ -106,7 +106,7 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequestsImporter, feature_cat
expect(Gitlab::GithubImport::ImportPullRequestWorker)
.to receive(:perform_in)
- .with(1, project.id, an_instance_of(Hash), an_instance_of(String))
+ .with(an_instance_of(Float), project.id, an_instance_of(Hash), an_instance_of(String))
waiter = importer.parallel_import
diff --git a/spec/lib/gitlab/github_import/importer/single_endpoint_diff_notes_importer_spec.rb b/spec/lib/gitlab/github_import/importer/single_endpoint_diff_notes_importer_spec.rb
index 6fe0494d7cd..d2e63eba954 100644
--- a/spec/lib/gitlab/github_import/importer/single_endpoint_diff_notes_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/single_endpoint_diff_notes_importer_spec.rb
@@ -53,7 +53,7 @@ RSpec.describe Gitlab::GithubImport::Importer::SingleEndpointDiffNotesImporter d
end
it 'skips cached pages' do
- Gitlab::GithubImport::PageCounter
+ Gitlab::Import::PageCounter
.new(project, "merge_request/#{merge_request.id}/pull_request_comments")
.set(2)
diff --git a/spec/lib/gitlab/github_import/importer/single_endpoint_issue_events_importer_spec.rb b/spec/lib/gitlab/github_import/importer/single_endpoint_issue_events_importer_spec.rb
index ab51ecf7d61..93fcda8a4f0 100644
--- a/spec/lib/gitlab/github_import/importer/single_endpoint_issue_events_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/single_endpoint_issue_events_importer_spec.rb
@@ -102,7 +102,7 @@ RSpec.describe Gitlab::GithubImport::Importer::SingleEndpointIssueEventsImporter
)
end
- let(:page_counter) { instance_double(Gitlab::GithubImport::PageCounter) }
+ let(:page_counter) { instance_double(Gitlab::Import::PageCounter) }
let(:extended_events) { true }
@@ -161,7 +161,7 @@ RSpec.describe Gitlab::GithubImport::Importer::SingleEndpointIssueEventsImporter
end
it 'triggers page number increment' do
- expect(Gitlab::GithubImport::PageCounter)
+ expect(Gitlab::Import::PageCounter)
.to receive(:new).with(project, 'issues/1/issue_timeline')
.and_return(page_counter)
expect(page_counter).to receive(:current).and_return(1)
@@ -175,7 +175,7 @@ RSpec.describe Gitlab::GithubImport::Importer::SingleEndpointIssueEventsImporter
context 'when page is already processed' do
before do
- page_counter = Gitlab::GithubImport::PageCounter.new(
+ page_counter = Gitlab::Import::PageCounter.new(
project, subject.page_counter_id(issuable)
)
page_counter.set(page.number)
diff --git a/spec/lib/gitlab/github_import/importer/single_endpoint_issue_notes_importer_spec.rb b/spec/lib/gitlab/github_import/importer/single_endpoint_issue_notes_importer_spec.rb
index 88613244c8b..c0f0d86d625 100644
--- a/spec/lib/gitlab/github_import/importer/single_endpoint_issue_notes_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/single_endpoint_issue_notes_importer_spec.rb
@@ -52,7 +52,7 @@ RSpec.describe Gitlab::GithubImport::Importer::SingleEndpointIssueNotesImporter
end
it 'skips cached pages' do
- Gitlab::GithubImport::PageCounter
+ Gitlab::Import::PageCounter
.new(project, "issue/#{issue.id}/issue_comments")
.set(2)
diff --git a/spec/lib/gitlab/github_import/importer/single_endpoint_merge_request_notes_importer_spec.rb b/spec/lib/gitlab/github_import/importer/single_endpoint_merge_request_notes_importer_spec.rb
index 601cd7a8f15..2d981a3d14f 100644
--- a/spec/lib/gitlab/github_import/importer/single_endpoint_merge_request_notes_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/single_endpoint_merge_request_notes_importer_spec.rb
@@ -53,7 +53,7 @@ RSpec.describe Gitlab::GithubImport::Importer::SingleEndpointMergeRequestNotesIm
end
it 'skips cached pages' do
- Gitlab::GithubImport::PageCounter
+ Gitlab::Import::PageCounter
.new(project, "merge_request/#{merge_request.id}/issue_comments")
.set(2)
diff --git a/spec/lib/gitlab/github_import/parallel_scheduling_spec.rb b/spec/lib/gitlab/github_import/parallel_scheduling_spec.rb
index 3188206de5b..2418c2e08af 100644
--- a/spec/lib/gitlab/github_import/parallel_scheduling_spec.rb
+++ b/spec/lib/gitlab/github_import/parallel_scheduling_spec.rb
@@ -279,26 +279,53 @@ RSpec.describe Gitlab::GithubImport::ParallelScheduling, feature_category: :impo
allow(importer).to receive(:representation_class).and_return(repr_class)
allow(importer).to receive(:sidekiq_worker_class).and_return(worker_class)
allow(repr_class).to receive(:from_api_response).with(object, {})
- .and_return({ title: 'One' }, { title: 'Two' }, { title: 'Three' })
+ .and_return({ title: 'One' }, { title: 'Two' }, { title: 'Three' }, { title: 'Four' })
end
it 'imports data in parallel with delays respecting parallel_import_batch definition and return job waiter' do
- allow(::Gitlab::JobWaiter).to receive(:generate_key).and_return('waiter-key')
- allow(importer).to receive(:parallel_import_batch).and_return({ size: 2, delay: 1.minute })
-
- expect(importer).to receive(:each_object_to_import)
- .and_yield(object).and_yield(object).and_yield(object)
- expect(worker_class).to receive(:perform_in)
- .with(1, project.id, { 'title' => 'One' }, 'waiter-key').ordered
- expect(worker_class).to receive(:perform_in)
- .with(1, project.id, { 'title' => 'Two' }, 'waiter-key').ordered
- expect(worker_class).to receive(:perform_in)
- .with(61, project.id, { 'title' => 'Three' }, 'waiter-key').ordered
-
- job_waiter = importer.parallel_import
-
- expect(job_waiter.key).to eq('waiter-key')
- expect(job_waiter.jobs_remaining).to eq(3)
+ freeze_time do
+ allow(::Gitlab::JobWaiter).to receive(:generate_key).and_return('waiter-key')
+ allow(importer).to receive(:parallel_import_batch).and_return({ size: 2, delay: 1.minute })
+
+ expect(importer).to receive(:each_object_to_import)
+ .and_yield(object).and_yield(object).and_yield(object).and_yield(object)
+ expect(worker_class).to receive(:perform_in)
+ .with(1.0, project.id, { 'title' => 'One' }, 'waiter-key').ordered
+ expect(worker_class).to receive(:perform_in)
+ .with(31.0, project.id, { 'title' => 'Two' }, 'waiter-key').ordered
+ expect(worker_class).to receive(:perform_in)
+ .with(61.0, project.id, { 'title' => 'Three' }, 'waiter-key').ordered
+ expect(worker_class).to receive(:perform_in)
+ .with(91.0, project.id, { 'title' => 'Four' }, 'waiter-key').ordered
+
+ job_waiter = importer.parallel_import
+
+ expect(job_waiter.key).to eq('waiter-key')
+ expect(job_waiter.jobs_remaining).to eq(4)
+ end
+ end
+
+ context 'when job is running for a long time' do
+ it 'deducts the job runtime from the delay' do
+ freeze_time do
+ allow(::Gitlab::JobWaiter).to receive(:generate_key).and_return('waiter-key')
+ allow(importer).to receive(:parallel_import_batch).and_return({ size: 2, delay: 1.minute })
+ allow(importer).to receive(:job_started_at).and_return(45.seconds.ago)
+ allow(importer).to receive(:each_object_to_import)
+ .and_yield(object).and_yield(object).and_yield(object).and_yield(object)
+
+ expect(worker_class).to receive(:perform_in)
+ .with(1.0, project.id, { 'title' => 'One' }, 'waiter-key').ordered
+ expect(worker_class).to receive(:perform_in)
+ .with(1.0, project.id, { 'title' => 'Two' }, 'waiter-key').ordered
+ expect(worker_class).to receive(:perform_in)
+ .with(16.0, project.id, { 'title' => 'Three' }, 'waiter-key').ordered
+ expect(worker_class).to receive(:perform_in)
+ .with(46.0, project.id, { 'title' => 'Four' }, 'waiter-key').ordered
+
+ importer.parallel_import
+ end
+ end
end
context 'when job restarts due to API rate limit or Sidekiq interruption' do
@@ -313,21 +340,23 @@ RSpec.describe Gitlab::GithubImport::ParallelScheduling, feature_category: :impo
end
it "restores job waiter's key and jobs_remaining" do
- allow(importer).to receive(:parallel_import_batch).and_return({ size: 1, delay: 1.minute })
+ freeze_time do
+ allow(importer).to receive(:parallel_import_batch).and_return({ size: 1, delay: 1.minute })
- expect(importer).to receive(:each_object_to_import).and_yield(object).and_yield(object).and_yield(object)
+ expect(importer).to receive(:each_object_to_import).and_yield(object).and_yield(object).and_yield(object)
- expect(worker_class).to receive(:perform_in)
- .with(1, project.id, { 'title' => 'One' }, 'waiter-key').ordered
- expect(worker_class).to receive(:perform_in)
- .with(61, project.id, { 'title' => 'Two' }, 'waiter-key').ordered
- expect(worker_class).to receive(:perform_in)
- .with(121, project.id, { 'title' => 'Three' }, 'waiter-key').ordered
+ expect(worker_class).to receive(:perform_in)
+ .with(1.0, project.id, { 'title' => 'One' }, 'waiter-key').ordered
+ expect(worker_class).to receive(:perform_in)
+ .with(61.0, project.id, { 'title' => 'Two' }, 'waiter-key').ordered
+ expect(worker_class).to receive(:perform_in)
+ .with(121.0, project.id, { 'title' => 'Three' }, 'waiter-key').ordered
- job_waiter = importer.parallel_import
+ job_waiter = importer.parallel_import
- expect(job_waiter.key).to eq('waiter-key')
- expect(job_waiter.jobs_remaining).to eq(6)
+ expect(job_waiter.key).to eq('waiter-key')
+ expect(job_waiter.jobs_remaining).to eq(6)
+ end
end
end
end
diff --git a/spec/lib/gitlab/github_import/page_counter_spec.rb b/spec/lib/gitlab/import/page_counter_spec.rb
index ddb62cc8fad..a7a4e301aa3 100644
--- a/spec/lib/gitlab/github_import/page_counter_spec.rb
+++ b/spec/lib/gitlab/import/page_counter_spec.rb
@@ -2,8 +2,8 @@
require 'spec_helper'
-RSpec.describe Gitlab::GithubImport::PageCounter, :clean_gitlab_redis_cache, feature_category: :importers do
- let(:project) { double(:project, id: 1) }
+RSpec.describe Gitlab::Import::PageCounter, :clean_gitlab_redis_cache, feature_category: :importers do
+ let(:project) { instance_double(Project, id: 1) }
let(:counter) { described_class.new(project, :issues) }
describe '#initialize' do
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index 21878bc9b6d..e835681a233 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
require 'email_spec'
-RSpec.describe Notify do
+RSpec.describe Notify, feature_category: :code_review_workflow do
include EmailSpec::Helpers
include EmailSpec::Matchers
include EmailHelpers
@@ -20,7 +20,10 @@ RSpec.describe Notify do
let_it_be(:assignee, reload: true) { create(:user, email: 'assignee@example.com', name: 'John Doe') }
let_it_be(:reviewer, reload: true) { create(:user, email: 'reviewer@example.com', name: 'Jane Doe') }
- let_it_be(:merge_request) do
+ let(:previous_assignee1) { create(:user, name: 'Previous Assignee 1') }
+ let(:previous_assignee_ids) { [previous_assignee1.id] }
+
+ let_it_be(:merge_request, reload: true) do
create(
:merge_request,
source_project: project,
@@ -84,11 +87,43 @@ RSpec.describe Notify do
end
end
+ shared_examples 'an assignee email with previous assignees' do
+ context 'when all assignees are removed' do
+ before do
+ resource.update!(assignees: [])
+ end
+
+ it_behaves_like 'email with default notification reason'
+
+ it 'uses fixed copy "All assignees were removed"' do
+ is_expected.to have_body_text("<p> All assignees were removed. </p>")
+ is_expected.to have_plain_text_content("All assignees were removed.")
+ end
+ end
+
+ context 'with multiple previous assignees' do
+ let(:previous_assignee2) { create(:user, name: 'Previous Assignee 2') }
+ let(:previous_assignee_ids) { [previous_assignee1.id, previous_assignee2.id] }
+
+ it_behaves_like 'email with default notification reason'
+
+ it 'has the correct subject and body' do
+ aggregate_failures do
+ is_expected.to have_referable_subject(resource, reply: true)
+ is_expected.to have_body_text("<p> <strong>#{assignee.name}</strong> was added as an assignee. </p> <p> <strong>#{previous_assignee1.name} and #{previous_assignee2.name}</strong> were removed as assignees. </p>")
+ is_expected.to have_plain_text_content("#{assignee.name} was added as an assignee.")
+ is_expected.to have_plain_text_content("#{previous_assignee1.name} and #{previous_assignee2.name} were removed as assignees.")
+ end
+ end
+ end
+ end
+
context 'for issues', feature_category: :team_planning do
describe 'that are new' do
subject { described_class.new_issue_email(issue.assignees.first.id, issue.id) }
it_behaves_like 'an assignee email'
+
it_behaves_like 'an email starting a new thread with reply-by-email enabled' do
let(:model) { issue }
end
@@ -142,9 +177,7 @@ RSpec.describe Notify do
end
describe 'that are reassigned' do
- let(:previous_assignee) { create(:user, name: 'Previous Assignee') }
-
- subject { described_class.reassigned_issue_email(recipient.id, issue.id, [previous_assignee.id], current_user.id) }
+ subject { described_class.reassigned_issue_email(recipient.id, issue.id, previous_assignee_ids, current_user.id) }
it_behaves_like 'a multiple recipients email'
it_behaves_like 'an answer to an existing thread with reply-by-email enabled' do
@@ -165,23 +198,14 @@ RSpec.describe Notify do
it 'has the correct subject and body' do
aggregate_failures do
is_expected.to have_referable_subject(issue, reply: true)
- is_expected.to have_body_text("Assignee changed from <strong>#{previous_assignee.name}</strong> to <strong>#{assignee.name}</strong>")
- is_expected.to have_plain_text_content("Assignee changed from #{previous_assignee.name} to #{assignee.name}")
+ is_expected.to have_body_text("<p> <strong>#{assignee.name}</strong> was added as an assignee. </p> <p> <strong>#{previous_assignee1.name}</strong> was removed as an assignee. </p>")
+ is_expected.to have_plain_text_content("#{assignee.name} was added as an assignee.")
+ is_expected.to have_plain_text_content("#{previous_assignee1.name} was removed as an assignee.")
end
end
- context 'without new assignee' do
- before do
- issue.update!(assignees: [])
- end
-
- it_behaves_like 'email with default notification reason'
- it_behaves_like 'email with link to issue'
-
- it 'uses "Unassigned" placeholder' do
- is_expected.to have_body_text("Assignee changed from <strong>#{previous_assignee.name}</strong> to <strong>Unassigned</strong>")
- is_expected.to have_plain_text_content("Assignee changed from #{previous_assignee.name} to Unassigned")
- end
+ it_behaves_like 'an assignee email with previous assignees' do
+ let(:resource) { issue }
end
context 'without previous assignees' do
@@ -190,14 +214,14 @@ RSpec.describe Notify do
it_behaves_like 'email with default notification reason'
it_behaves_like 'email with link to issue'
- it 'uses short text' do
- is_expected.to have_body_text("Assignee changed to <strong>#{assignee.name}</strong>")
- is_expected.to have_plain_text_content("Assignee changed to #{assignee.name}")
+ it 'does not mention any previous assignees' do
+ is_expected.to have_body_text("<p> <strong>#{assignee.name}</strong> was added as an assignee. </p>")
+ is_expected.to have_plain_text_content("#{assignee.name} was added as an assignee.")
end
end
context 'when sent with a reason' do
- subject { described_class.reassigned_issue_email(recipient.id, issue.id, [previous_assignee.id], current_user.id, NotificationReason::ASSIGNED) }
+ subject { described_class.reassigned_issue_email(recipient.id, issue.id, [previous_assignee1.id], current_user.id, NotificationReason::ASSIGNED) }
it_behaves_like 'appearance header and footer enabled'
it_behaves_like 'appearance header and footer not enabled'
@@ -211,10 +235,10 @@ RSpec.describe Notify do
let(:email_obj) { create(:email, :confirmed, user_id: recipient.id, email: '123@abc') }
let(:recipient) { create(:user, preferred_language: :zh_CN) }
- it 'is translated into zh_CN' do
+ it 'is sent with html lang attribute set to the user\'s preferred language' do
recipient.notification_email = email_obj.email
recipient.save!
- is_expected.to have_body_text '指派人从 <strong>Previous Assignee</strong> 更改为 <strong>John Doe</strong>'
+ is_expected.to have_body_text '<html lang="zh-CN">'
end
end
end
@@ -450,6 +474,7 @@ RSpec.describe Notify do
subject { described_class.new_merge_request_email(merge_request.assignee_ids.first, merge_request.id) }
it_behaves_like 'an assignee email'
+
it_behaves_like 'an email starting a new thread with reply-by-email enabled' do
let(:model) { merge_request }
end
@@ -495,9 +520,7 @@ RSpec.describe Notify do
end
describe 'that are reassigned' do
- let(:previous_assignee) { create(:user, name: 'Previous Assignee') }
-
- subject { described_class.reassigned_merge_request_email(recipient.id, merge_request.id, [previous_assignee.id], current_user.id) }
+ subject { described_class.reassigned_merge_request_email(recipient.id, merge_request.id, previous_assignee_ids, current_user.id) }
it_behaves_like 'a multiple recipients email'
it_behaves_like 'an answer to an existing thread with reply-by-email enabled' do
@@ -509,6 +532,10 @@ RSpec.describe Notify do
it_behaves_like 'appearance header and footer enabled'
it_behaves_like 'appearance header and footer not enabled'
+ it_behaves_like 'an assignee email with previous assignees' do
+ let(:resource) { merge_request }
+ end
+
it 'is sent as the author' do
expect_sender(current_user)
end
@@ -516,14 +543,14 @@ RSpec.describe Notify do
it 'has the correct subject and body' do
aggregate_failures do
is_expected.to have_referable_subject(merge_request, reply: true)
- is_expected.to have_body_text(previous_assignee.name)
+ is_expected.to have_body_text(previous_assignee1.name)
is_expected.to have_body_text(project_merge_request_path(project, merge_request))
is_expected.to have_body_text(assignee.name)
end
end
context 'when sent with a reason', type: :helper do
- subject { described_class.reassigned_merge_request_email(recipient.id, merge_request.id, [previous_assignee.id], current_user.id, NotificationReason::ASSIGNED) }
+ subject { described_class.reassigned_merge_request_email(recipient.id, merge_request.id, [previous_assignee1.id], current_user.id, NotificationReason::ASSIGNED) }
it_behaves_like 'appearance header and footer enabled'
it_behaves_like 'appearance header and footer not enabled'
@@ -536,11 +563,11 @@ RSpec.describe Notify do
text = EmailsHelper.instance_method(:notification_reason_text).bind_call(self, reason: NotificationReason::ASSIGNED, format: :html)
is_expected.to have_body_text(text)
- new_subject = described_class.reassigned_merge_request_email(recipient.id, merge_request.id, [previous_assignee.id], current_user.id, NotificationReason::MENTIONED)
+ new_subject = described_class.reassigned_merge_request_email(recipient.id, merge_request.id, [previous_assignee1.id], current_user.id, NotificationReason::MENTIONED)
text = EmailsHelper.instance_method(:notification_reason_text).bind_call(self, reason: NotificationReason::MENTIONED, format: :html)
expect(new_subject).to have_body_text(text)
- new_subject = described_class.reassigned_merge_request_email(recipient.id, merge_request.id, [previous_assignee.id], current_user.id, nil)
+ new_subject = described_class.reassigned_merge_request_email(recipient.id, merge_request.id, [previous_assignee1.id], current_user.id, nil)
text = EmailsHelper.instance_method(:notification_reason_text).bind_call(self, format: :html)
expect(new_subject).to have_body_text(text)
end
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index 024d3ae4240..e075ea232d3 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -2349,14 +2349,14 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep, feature_category:
end
it 'runs on a branch update push' do
- expect(pipeline.before_sha).not_to be Gitlab::Git::BLANK_SHA
+ expect(pipeline.before_sha).not_to be Gitlab::Git::SHA1_BLANK_SHA
expect(pipeline.branch_updated?).to be true
end
end
context 'when pipeline does not have before SHA' do
before do
- pipeline.update!(before_sha: Gitlab::Git::BLANK_SHA)
+ pipeline.update!(before_sha: Gitlab::Git::SHA1_BLANK_SHA)
end
it 'does not run on a branch updating push' do
@@ -2384,7 +2384,7 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep, feature_category:
context 'when either old or new revision is missing' do
before do
- pipeline.update!(before_sha: Gitlab::Git::BLANK_SHA)
+ pipeline.update!(before_sha: Gitlab::Git::SHA1_BLANK_SHA)
end
it 'returns nil' do
diff --git a/spec/models/commit_collection_spec.rb b/spec/models/commit_collection_spec.rb
index be80aced3fd..5db417f8032 100644
--- a/spec/models/commit_collection_spec.rb
+++ b/spec/models/commit_collection_spec.rb
@@ -210,7 +210,7 @@ RSpec.describe CommitCollection, feature_category: :source_code_management do
it 'returns the original commit if the commit could not be lazy loaded' do
collection = described_class.new(project, [hash_commit])
- unexisting_lazy_commit = Commit.lazy(project, Gitlab::Git::BLANK_SHA)
+ unexisting_lazy_commit = Commit.lazy(project, Gitlab::Git::SHA1_BLANK_SHA)
expect(Commit).to receive(:lazy).with(project, hash_commit.id).and_return(unexisting_lazy_commit)
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb
index 618dd3a3f77..7c4917596a0 100644
--- a/spec/models/commit_status_spec.rb
+++ b/spec/models/commit_status_spec.rb
@@ -583,7 +583,7 @@ RSpec.describe CommitStatus, feature_category: :continuous_integration do
end
it 'returns blank sha' do
- is_expected.to eq(Gitlab::Git::BLANK_SHA)
+ is_expected.to eq(Gitlab::Git::SHA1_BLANK_SHA)
end
end
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb
index cb2c38c15e0..b8217ffd2c9 100644
--- a/spec/models/deployment_spec.rb
+++ b/spec/models/deployment_spec.rb
@@ -878,7 +878,7 @@ RSpec.describe Deployment, feature_category: :continuous_delivery do
context 'when the SHA for the deployment does not exist in the repo' do
it 'returns false' do
- deployment.update!(sha: Gitlab::Git::BLANK_SHA)
+ deployment.update!(sha: Gitlab::Git::SHA1_BLANK_SHA)
commit = project.commit
expect(deployment.includes_commit?(commit.id)).to be false
diff --git a/spec/models/design_management/design_spec.rb b/spec/models/design_management/design_spec.rb
index 98e5399f737..882aaffa818 100644
--- a/spec/models/design_management/design_spec.rb
+++ b/spec/models/design_management/design_spec.rb
@@ -447,7 +447,7 @@ RSpec.describe DesignManagement::Design, feature_category: :design_management do
let(:versions_count) { 1 }
it 'builds diff refs based on the empty tree if there was only one version' do
- expect(design.diff_refs.base_sha).to eq(Gitlab::Git::BLANK_SHA)
+ expect(design.diff_refs.base_sha).to eq(Gitlab::Git::SHA1_BLANK_SHA)
expect(design.diff_refs.head_sha).to eq(design.diff_refs.head_sha)
end
end
diff --git a/spec/models/integrations/chat_message/push_message_spec.rb b/spec/models/integrations/chat_message/push_message_spec.rb
index a9d0f801406..ba619f655ec 100644
--- a/spec/models/integrations/chat_message/push_message_spec.rb
+++ b/spec/models/integrations/chat_message/push_message_spec.rb
@@ -72,7 +72,7 @@ RSpec.describe Integrations::ChatMessage::PushMessage do
let(:args) do
{
after: 'after',
- before: Gitlab::Git::BLANK_SHA,
+ before: Gitlab::Git::SHA1_BLANK_SHA,
project_name: 'project_name',
ref: 'refs/tags/new_tag',
user_name: 'test.user',
@@ -112,7 +112,7 @@ RSpec.describe Integrations::ChatMessage::PushMessage do
context 'removed tag' do
let(:args) do
{
- after: Gitlab::Git::BLANK_SHA,
+ after: Gitlab::Git::SHA1_BLANK_SHA,
before: 'before',
project_name: 'project_name',
ref: 'refs/tags/new_tag',
@@ -152,7 +152,7 @@ RSpec.describe Integrations::ChatMessage::PushMessage do
context 'new branch' do
before do
- args[:before] = Gitlab::Git::BLANK_SHA
+ args[:before] = Gitlab::Git::SHA1_BLANK_SHA
end
context 'without markdown' do
@@ -185,7 +185,7 @@ RSpec.describe Integrations::ChatMessage::PushMessage do
context 'removed branch' do
before do
- args[:after] = Gitlab::Git::BLANK_SHA
+ args[:after] = Gitlab::Git::SHA1_BLANK_SHA
end
context 'without markdown' do
diff --git a/spec/models/integrations/teamcity_spec.rb b/spec/models/integrations/teamcity_spec.rb
index 1537b10ba03..2294e687296 100644
--- a/spec/models/integrations/teamcity_spec.rb
+++ b/spec/models/integrations/teamcity_spec.rb
@@ -246,7 +246,7 @@ RSpec.describe Integrations::Teamcity, :use_clean_rails_memory_store_caching do
end
it 'returns nil when ref is blank' do
- data[:after] = Gitlab::Git::BLANK_SHA
+ data[:after] = Gitlab::Git::SHA1_BLANK_SHA
expect(integration.execute(data)).to be_nil
end
diff --git a/spec/models/merge_request_diff_spec.rb b/spec/models/merge_request_diff_spec.rb
index 2e68cd9e74a..3b4b9fd30fe 100644
--- a/spec/models/merge_request_diff_spec.rb
+++ b/spec/models/merge_request_diff_spec.rb
@@ -1206,7 +1206,7 @@ RSpec.describe MergeRequestDiff, feature_category: :code_review_workflow do
it 'returns false if passed commits do not exist' do
expect(subject.includes_any_commits?([])).to eq(false)
- expect(subject.includes_any_commits?([Gitlab::Git::BLANK_SHA])).to eq(false)
+ expect(subject.includes_any_commits?([Gitlab::Git::SHA1_BLANK_SHA])).to eq(false)
end
it 'returns true if passed commits exists' do
diff --git a/spec/models/note_diff_file_spec.rb b/spec/models/note_diff_file_spec.rb
index 1ece1dfea59..5d9381b5886 100644
--- a/spec/models/note_diff_file_spec.rb
+++ b/spec/models/note_diff_file_spec.rb
@@ -32,7 +32,7 @@ RSpec.describe NoteDiffFile do
end
it 'excludes note diff files with the wrong sha' do
- found = described_class.referencing_sha(Gitlab::Git::BLANK_SHA, project_id: project.id)
+ found = described_class.referencing_sha(Gitlab::Git::SHA1_BLANK_SHA, project_id: project.id)
expect(found).to be_empty
end
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index eeb0bbb8e7d..ca2ee447b4c 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -661,7 +661,7 @@ RSpec.describe Repository, feature_category: :source_code_management do
describe '#blob_at' do
context 'blank sha' do
- subject { repository.blob_at(Gitlab::Git::BLANK_SHA, '.gitignore') }
+ subject { repository.blob_at(Gitlab::Git::SHA1_BLANK_SHA, '.gitignore') }
it { is_expected.to be_nil }
end
@@ -3226,8 +3226,8 @@ RSpec.describe Repository, feature_category: :source_code_management do
end
it 'returns false for invalid commit IDs' do
- expect(repository.ancestor?(commit.id, Gitlab::Git::BLANK_SHA)).to eq(false)
- expect(repository.ancestor?(Gitlab::Git::BLANK_SHA, commit.id)).to eq(false)
+ expect(repository.ancestor?(commit.id, Gitlab::Git::SHA1_BLANK_SHA)).to eq(false)
+ expect(repository.ancestor?(Gitlab::Git::SHA1_BLANK_SHA, commit.id)).to eq(false)
end
end
diff --git a/spec/requests/api/internal/base_spec.rb b/spec/requests/api/internal/base_spec.rb
index e59633b6d35..87f3ee640f3 100644
--- a/spec/requests/api/internal/base_spec.rb
+++ b/spec/requests/api/internal/base_spec.rb
@@ -1437,7 +1437,7 @@ RSpec.describe API::Internal::Base, feature_category: :system_access do
end
let(:changes) do
- "#{Gitlab::Git::BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/#{branch_name}"
+ "#{Gitlab::Git::SHA1_BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/#{branch_name}"
end
subject { post api('/internal/post_receive'), params: valid_params, headers: gitlab_shell_internal_api_request_header }
diff --git a/spec/serializers/profile/event_entity_spec.rb b/spec/serializers/profile/event_entity_spec.rb
index 3dade4210b3..2c880500e05 100644
--- a/spec/serializers/profile/event_entity_spec.rb
+++ b/spec/serializers/profile/event_entity_spec.rb
@@ -29,7 +29,7 @@ RSpec.describe Profile::EventEntity, feature_category: :user_profile do
end
context 'for push events' do
- let_it_be(:commit_from) { Gitlab::Git::BLANK_SHA }
+ let_it_be(:commit_from) { Gitlab::Git::SHA1_BLANK_SHA }
let_it_be(:commit_title) { 'My commit' }
let(:event) { build(:push_event, project: project, author: target_user) }
diff --git a/spec/services/design_management/save_designs_service_spec.rb b/spec/services/design_management/save_designs_service_spec.rb
index 4ab0080d8a2..5ad3fa1bca6 100644
--- a/spec/services/design_management/save_designs_service_spec.rb
+++ b/spec/services/design_management/save_designs_service_spec.rb
@@ -30,7 +30,7 @@ RSpec.describe DesignManagement::SaveDesignsService, feature_category: :design_m
before do
if issue.design_collection.repository.exists?
issue.design_collection.repository.expire_all_method_caches
- issue.design_collection.repository.raw.delete_all_refs_except([Gitlab::Git::BLANK_SHA])
+ issue.design_collection.repository.raw.delete_all_refs_except([Gitlab::Git::SHA1_BLANK_SHA])
end
allow(DesignManagement::NewVersionWorker)
diff --git a/spec/services/git/base_hooks_service_spec.rb b/spec/services/git/base_hooks_service_spec.rb
index e083c8d7316..2a041d9b3e2 100644
--- a/spec/services/git/base_hooks_service_spec.rb
+++ b/spec/services/git/base_hooks_service_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe Git::BaseHooksService, feature_category: :source_code_management
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :repository) }
- let(:oldrev) { Gitlab::Git::BLANK_SHA }
+ let(:oldrev) { Gitlab::Git::SHA1_BLANK_SHA }
let(:newrev) { "8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b" } # gitlab-test: git rev-parse refs/tags/v1.1.0
let(:ref) { 'refs/tags/v1.1.0' }
let(:checkout_sha) { '5937ac0a7beb003549fc5fd26fc247adbce4a52e' }
diff --git a/spec/services/git/branch_hooks_service_spec.rb b/spec/services/git/branch_hooks_service_spec.rb
index 8fd542542ae..39a5f28060c 100644
--- a/spec/services/git/branch_hooks_service_spec.rb
+++ b/spec/services/git/branch_hooks_service_spec.rb
@@ -160,7 +160,7 @@ RSpec.describe Git::BranchHooksService, :clean_gitlab_redis_shared_state, featur
end
context "with a new default branch" do
- let(:oldrev) { Gitlab::Git::BLANK_SHA }
+ let(:oldrev) { Gitlab::Git::SHA1_BLANK_SHA }
it 'generates a push event with more than one commit' do
execute_service
@@ -178,7 +178,7 @@ RSpec.describe Git::BranchHooksService, :clean_gitlab_redis_shared_state, featur
end
context "with a new non-default branch" do
- let(:oldrev) { Gitlab::Git::BLANK_SHA }
+ let(:oldrev) { Gitlab::Git::SHA1_BLANK_SHA }
let(:branch) { 'fix' }
let(:commit_id) { project.commit(branch).id }
@@ -198,7 +198,7 @@ RSpec.describe Git::BranchHooksService, :clean_gitlab_redis_shared_state, featur
end
context 'removing a branch' do
- let(:newrev) { Gitlab::Git::BLANK_SHA }
+ let(:newrev) { Gitlab::Git::SHA1_BLANK_SHA }
it 'generates a push event with no commits' do
execute_service
@@ -222,7 +222,7 @@ RSpec.describe Git::BranchHooksService, :clean_gitlab_redis_shared_state, featur
)
end
- let(:blank_sha) { Gitlab::Git::BLANK_SHA }
+ let(:blank_sha) { Gitlab::Git::SHA1_BLANK_SHA }
def clears_cache(extended: [])
expect(service).to receive(:invalidated_file_types).and_return(extended)
@@ -361,7 +361,7 @@ RSpec.describe Git::BranchHooksService, :clean_gitlab_redis_shared_state, featur
end
context 'creating the default branch' do
- let(:oldrev) { Gitlab::Git::BLANK_SHA }
+ let(:oldrev) { Gitlab::Git::SHA1_BLANK_SHA }
it 'processes a limited number of commit messages' do
expect(project.repository)
@@ -414,7 +414,7 @@ RSpec.describe Git::BranchHooksService, :clean_gitlab_redis_shared_state, featur
end
context 'removing the default branch' do
- let(:newrev) { Gitlab::Git::BLANK_SHA }
+ let(:newrev) { Gitlab::Git::SHA1_BLANK_SHA }
it 'does not process commit messages' do
expect(project.repository).not_to receive(:commits)
@@ -429,7 +429,7 @@ RSpec.describe Git::BranchHooksService, :clean_gitlab_redis_shared_state, featur
context 'creating a normal branch' do
let(:branch) { 'fix' }
- let(:oldrev) { Gitlab::Git::BLANK_SHA }
+ let(:oldrev) { Gitlab::Git::SHA1_BLANK_SHA }
it 'processes a limited number of commit messages' do
expect(project.repository)
@@ -463,7 +463,7 @@ RSpec.describe Git::BranchHooksService, :clean_gitlab_redis_shared_state, featur
context 'removing a normal branch' do
let(:branch) { 'fix' }
- let(:newrev) { Gitlab::Git::BLANK_SHA }
+ let(:newrev) { Gitlab::Git::SHA1_BLANK_SHA }
it 'does not process commit messages' do
expect(project.repository).not_to receive(:commits)
@@ -530,7 +530,7 @@ RSpec.describe Git::BranchHooksService, :clean_gitlab_redis_shared_state, featur
let(:branch) { 'fix' }
context 'oldrev is the blank SHA' do
- let(:oldrev) { Gitlab::Git::BLANK_SHA }
+ let(:oldrev) { Gitlab::Git::SHA1_BLANK_SHA }
it 'is treated as a new branch' do
expect(service).to receive(:branch_create_hooks)
diff --git a/spec/services/git/branch_push_service_spec.rb b/spec/services/git/branch_push_service_spec.rb
index db4f3ace64b..bb5fe1b7b11 100644
--- a/spec/services/git/branch_push_service_spec.rb
+++ b/spec/services/git/branch_push_service_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe Git::BranchPushService, :use_clean_rails_redis_caching, services:
let_it_be(:user) { create(:user) }
let_it_be_with_refind(:project) { create(:project, :repository) }
- let(:blankrev) { Gitlab::Git::BLANK_SHA }
+ let(:blankrev) { Gitlab::Git::SHA1_BLANK_SHA }
let(:oldrev) { sample_commit.parent_id }
let(:newrev) { sample_commit.id }
let(:branch) { 'master' }
diff --git a/spec/services/git/process_ref_changes_service_spec.rb b/spec/services/git/process_ref_changes_service_spec.rb
index 93d65b0b344..c117988f0a1 100644
--- a/spec/services/git/process_ref_changes_service_spec.rb
+++ b/spec/services/git/process_ref_changes_service_spec.rb
@@ -21,9 +21,9 @@ RSpec.describe Git::ProcessRefChangesService, feature_category: :source_code_man
let(:changes) do
[
- { index: 0, oldrev: Gitlab::Git::BLANK_SHA, newrev: '789012', ref: "#{ref_prefix}/create" },
+ { index: 0, oldrev: Gitlab::Git::SHA1_BLANK_SHA, newrev: '789012', ref: "#{ref_prefix}/create" },
{ index: 1, oldrev: '123456', newrev: '789012', ref: "#{ref_prefix}/update" },
- { index: 2, oldrev: '123456', newrev: Gitlab::Git::BLANK_SHA, ref: "#{ref_prefix}/delete" }
+ { index: 2, oldrev: '123456', newrev: Gitlab::Git::SHA1_BLANK_SHA, ref: "#{ref_prefix}/delete" }
]
end
@@ -71,9 +71,9 @@ RSpec.describe Git::ProcessRefChangesService, feature_category: :source_code_man
let(:changes) do
[
- { oldrev: Gitlab::Git::BLANK_SHA, newrev: '789012', ref: "#{ref_prefix}/create" },
+ { oldrev: Gitlab::Git::SHA1_BLANK_SHA, newrev: '789012', ref: "#{ref_prefix}/create" },
{ oldrev: '123456', newrev: '789012', ref: "#{ref_prefix}/update" },
- { oldrev: '123456', newrev: Gitlab::Git::BLANK_SHA, ref: "#{ref_prefix}/delete" }
+ { oldrev: '123456', newrev: Gitlab::Git::SHA1_BLANK_SHA, ref: "#{ref_prefix}/delete" }
].map do |change|
multiple_changes(change, push_event_activities_limit + 1)
end.flatten
@@ -216,19 +216,19 @@ RSpec.describe Git::ProcessRefChangesService, feature_category: :source_code_man
context 'when there are merge requests associated with branches' do
let(:tag_changes) do
[
- { index: 0, oldrev: Gitlab::Git::BLANK_SHA, newrev: '789012', ref: "refs/tags/v10.0.0" }
+ { index: 0, oldrev: Gitlab::Git::SHA1_BLANK_SHA, newrev: '789012', ref: "refs/tags/v10.0.0" }
]
end
let(:branch_changes) do
[
- { index: 0, oldrev: Gitlab::Git::BLANK_SHA, newrev: '789012', ref: "#{ref_prefix}/create1" },
- { index: 1, oldrev: Gitlab::Git::BLANK_SHA, newrev: '789013', ref: "#{ref_prefix}/create2" },
- { index: 2, oldrev: Gitlab::Git::BLANK_SHA, newrev: '789014', ref: "#{ref_prefix}/create3" },
+ { index: 0, oldrev: Gitlab::Git::SHA1_BLANK_SHA, newrev: '789012', ref: "#{ref_prefix}/create1" },
+ { index: 1, oldrev: Gitlab::Git::SHA1_BLANK_SHA, newrev: '789013', ref: "#{ref_prefix}/create2" },
+ { index: 2, oldrev: Gitlab::Git::SHA1_BLANK_SHA, newrev: '789014', ref: "#{ref_prefix}/create3" },
{ index: 3, oldrev: '789015', newrev: '789016', ref: "#{ref_prefix}/changed1" },
{ index: 4, oldrev: '789017', newrev: '789018', ref: "#{ref_prefix}/changed2" },
- { index: 5, oldrev: '789019', newrev: Gitlab::Git::BLANK_SHA, ref: "#{ref_prefix}/removed1" },
- { index: 6, oldrev: '789020', newrev: Gitlab::Git::BLANK_SHA, ref: "#{ref_prefix}/removed2" }
+ { index: 5, oldrev: '789019', newrev: Gitlab::Git::SHA1_BLANK_SHA, ref: "#{ref_prefix}/removed1" },
+ { index: 6, oldrev: '789020', newrev: Gitlab::Git::SHA1_BLANK_SHA, ref: "#{ref_prefix}/removed2" }
]
end
@@ -246,7 +246,7 @@ RSpec.describe Git::ProcessRefChangesService, feature_category: :source_code_man
expect(UpdateMergeRequestsWorker).to receive(:perform_async).with(
project.id,
user.id,
- Gitlab::Git::BLANK_SHA,
+ Gitlab::Git::SHA1_BLANK_SHA,
'789012',
"#{ref_prefix}/create1",
{ 'push_options' => nil }).ordered
@@ -254,7 +254,7 @@ RSpec.describe Git::ProcessRefChangesService, feature_category: :source_code_man
expect(UpdateMergeRequestsWorker).to receive(:perform_async).with(
project.id,
user.id,
- Gitlab::Git::BLANK_SHA,
+ Gitlab::Git::SHA1_BLANK_SHA,
'789013',
"#{ref_prefix}/create2",
{ 'push_options' => nil }).ordered
@@ -271,7 +271,7 @@ RSpec.describe Git::ProcessRefChangesService, feature_category: :source_code_man
project.id,
user.id,
'789020',
- Gitlab::Git::BLANK_SHA,
+ Gitlab::Git::SHA1_BLANK_SHA,
"#{ref_prefix}/removed2",
{ 'push_options' => nil }).ordered
diff --git a/spec/services/git/tag_hooks_service_spec.rb b/spec/services/git/tag_hooks_service_spec.rb
index 3e06443126b..afa8a4e72d3 100644
--- a/spec/services/git/tag_hooks_service_spec.rb
+++ b/spec/services/git/tag_hooks_service_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe Git::TagHooksService, :service, feature_category: :source_code_ma
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
- let(:oldrev) { Gitlab::Git::BLANK_SHA }
+ let(:oldrev) { Gitlab::Git::SHA1_BLANK_SHA }
let(:newrev) { "8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b" } # gitlab-test: git rev-parse refs/tags/v1.1.0
let(:ref) { "refs/tags/#{tag_name}" }
let(:tag_name) { 'v1.1.0' }
diff --git a/spec/services/git/tag_push_service_spec.rb b/spec/services/git/tag_push_service_spec.rb
index 0d40c331d11..ba0f94d6fe6 100644
--- a/spec/services/git/tag_push_service_spec.rb
+++ b/spec/services/git/tag_push_service_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe Git::TagPushService, feature_category: :source_code_management do
let(:project) { create(:project, :repository) }
let(:service) { described_class.new(project, user, change: { oldrev: oldrev, newrev: newrev, ref: ref }) }
- let(:blankrev) { Gitlab::Git::BLANK_SHA }
+ let(:blankrev) { Gitlab::Git::SHA1_BLANK_SHA }
let(:oldrev) { blankrev }
let(:newrev) { "8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b" } # gitlab-test: git rev-parse refs/tags/v1.1.0
let(:tag) { 'v1.1.0' }
diff --git a/spec/services/git/wiki_push_service_spec.rb b/spec/services/git/wiki_push_service_spec.rb
index b076b2d51ef..e584b0db63f 100644
--- a/spec/services/git/wiki_push_service_spec.rb
+++ b/spec/services/git/wiki_push_service_spec.rb
@@ -347,7 +347,7 @@ RSpec.describe Git::WikiPushService, services: true, feature_category: :wiki do
end
def current_sha
- repository.commit('master')&.id || Gitlab::Git::BLANK_SHA
+ repository.commit('master')&.id || Gitlab::Git::SHA1_BLANK_SHA
end
# It is important not to re-use the WikiPage services here, since they create
diff --git a/spec/services/merge_requests/conflicts/list_service_spec.rb b/spec/services/merge_requests/conflicts/list_service_spec.rb
index 5eb53b1bcba..416b28bff05 100644
--- a/spec/services/merge_requests/conflicts/list_service_spec.rb
+++ b/spec/services/merge_requests/conflicts/list_service_spec.rb
@@ -84,7 +84,7 @@ RSpec.describe MergeRequests::Conflicts::ListService, feature_category: :code_re
it 'returns a falsey value when the MR has a missing revision after a force push' do
merge_request = create_merge_request('conflict-resolvable')
service = conflicts_service(merge_request)
- allow(merge_request).to receive_message_chain(:target_branch_head, :raw, :id).and_return(Gitlab::Git::BLANK_SHA)
+ allow(merge_request).to receive_message_chain(:target_branch_head, :raw, :id).and_return(Gitlab::Git::SHA1_BLANK_SHA)
expect(service.can_be_resolved_in_ui?).to be_falsey
end
diff --git a/spec/services/merge_requests/get_urls_service_spec.rb b/spec/services/merge_requests/get_urls_service_spec.rb
index 31b3e513a51..85a84f07094 100644
--- a/spec/services/merge_requests/get_urls_service_spec.rb
+++ b/spec/services/merge_requests/get_urls_service_spec.rb
@@ -10,8 +10,8 @@ RSpec.describe MergeRequests::GetUrlsService, feature_category: :code_review_wor
let(:source_branch) { "merge-test" }
let(:new_merge_request_url) { "http://#{Gitlab.config.gitlab.host}/#{project.full_path}/-/merge_requests/new?merge_request%5Bsource_branch%5D=#{source_branch}" }
let(:show_merge_request_url) { "http://#{Gitlab.config.gitlab.host}/#{project.full_path}/-/merge_requests/#{merge_request.iid}" }
- let(:new_branch_changes) { "#{Gitlab::Git::BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/#{source_branch}" }
- let(:deleted_branch_changes) { "d14d6c0abdd253381df51a723d58691b2ee1ab08 #{Gitlab::Git::BLANK_SHA} refs/heads/#{source_branch}" }
+ let(:new_branch_changes) { "#{Gitlab::Git::SHA1_BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/#{source_branch}" }
+ let(:deleted_branch_changes) { "d14d6c0abdd253381df51a723d58691b2ee1ab08 #{Gitlab::Git::SHA1_BLANK_SHA} refs/heads/#{source_branch}" }
let(:existing_branch_changes) { "d14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/#{source_branch}" }
let(:default_branch_changes) { "d14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/master" }
@@ -131,7 +131,7 @@ RSpec.describe MergeRequests::GetUrlsService, feature_category: :code_review_wor
context 'pushing new branch and existing branch (with merge request created) at once' do
let!(:merge_request) { create(:merge_request, source_project: project, source_branch: "markdown") }
- let(:new_branch_changes) { "#{Gitlab::Git::BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/new_branch" }
+ let(:new_branch_changes) { "#{Gitlab::Git::SHA1_BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/new_branch" }
let(:existing_branch_changes) { "d14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/markdown" }
let(:changes) { "#{new_branch_changes}\n#{existing_branch_changes}" }
let(:new_merge_request_url) { "http://#{Gitlab.config.gitlab.host}/#{project.full_path}/-/merge_requests/new?merge_request%5Bsource_branch%5D=new_branch" }
diff --git a/spec/services/merge_requests/push_options_handler_service_spec.rb b/spec/services/merge_requests/push_options_handler_service_spec.rb
index 038977e4fd0..e34eb804a82 100644
--- a/spec/services/merge_requests/push_options_handler_service_spec.rb
+++ b/spec/services/merge_requests/push_options_handler_service_spec.rb
@@ -34,9 +34,9 @@ RSpec.describe MergeRequests::PushOptionsHandlerService, feature_category: :sour
let(:label1) { 'mylabel1' }
let(:label2) { 'mylabel2' }
let(:label3) { 'mylabel3' }
- let(:new_branch_changes) { "#{Gitlab::Git::BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/#{source_branch}" }
+ let(:new_branch_changes) { "#{Gitlab::Git::SHA1_BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/#{source_branch}" }
let(:existing_branch_changes) { "d14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/#{source_branch}" }
- let(:deleted_branch_changes) { "d14d6c0abdd253381df51a723d58691b2ee1ab08 #{Gitlab::Git::BLANK_SHA} refs/heads/#{source_branch}" }
+ let(:deleted_branch_changes) { "d14d6c0abdd253381df51a723d58691b2ee1ab08 #{Gitlab::Git::SHA1_BLANK_SHA} refs/heads/#{source_branch}" }
let(:default_branch_changes) { "d14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/#{project.default_branch}" }
let(:error_mr_required) { "A merge_request.create push option is required to create a merge request for branch #{source_branch}" }
@@ -802,7 +802,7 @@ RSpec.describe MergeRequests::PushOptionsHandlerService, feature_category: :sour
let(:changes) do
[
new_branch_changes,
- "#{Gitlab::Git::BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/feature_conflict"
+ "#{Gitlab::Git::SHA1_BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/feature_conflict"
]
end
@@ -814,7 +814,7 @@ RSpec.describe MergeRequests::PushOptionsHandlerService, feature_category: :sour
let(:limit) { MergeRequests::PushOptionsHandlerService::LIMIT }
let(:changes) do
TestEnv::BRANCH_SHA.to_a[0..limit].map do |x|
- "#{Gitlab::Git::BLANK_SHA} #{x.first} refs/heads/#{x.last}"
+ "#{Gitlab::Git::SHA1_BLANK_SHA} #{x.first} refs/heads/#{x.last}"
end
end
diff --git a/spec/services/merge_requests/refresh_service_spec.rb b/spec/services/merge_requests/refresh_service_spec.rb
index dd50dfa49e0..e2b1c91d6eb 100644
--- a/spec/services/merge_requests/refresh_service_spec.rb
+++ b/spec/services/merge_requests/refresh_service_spec.rb
@@ -712,10 +712,10 @@ RSpec.describe MergeRequests::RefreshService, feature_category: :code_review_wor
it 'refreshes the merge request' do
expect(refresh_service).to receive(:execute_hooks)
- .with(@fork_merge_request, 'update', old_rev: Gitlab::Git::BLANK_SHA)
+ .with(@fork_merge_request, 'update', old_rev: Gitlab::Git::SHA1_BLANK_SHA)
allow_any_instance_of(Repository).to receive(:merge_base).and_return(@oldrev)
- refresh_service.execute(Gitlab::Git::BLANK_SHA, @newrev, 'refs/heads/master')
+ refresh_service.execute(Gitlab::Git::SHA1_BLANK_SHA, @newrev, 'refs/heads/master')
reload_mrs
expect(@merge_request.notes).to be_empty
diff --git a/spec/services/post_receive_service_spec.rb b/spec/services/post_receive_service_spec.rb
index 167baed06e7..c0bc8e1cc6e 100644
--- a/spec/services/post_receive_service_spec.rb
+++ b/spec/services/post_receive_service_spec.rb
@@ -19,7 +19,7 @@ RSpec.describe PostReceiveService, feature_category: :team_planning do
let(:repository) { project.repository }
let(:changes) do
- "#{Gitlab::Git::BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/#{branch_name}"
+ "#{Gitlab::Git::SHA1_BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/#{branch_name}"
end
let(:params) do
diff --git a/spec/services/projects/cleanup_service_spec.rb b/spec/services/projects/cleanup_service_spec.rb
index 533a09f7bc7..90f360c5dbd 100644
--- a/spec/services/projects/cleanup_service_spec.rb
+++ b/spec/services/projects/cleanup_service_spec.rb
@@ -190,7 +190,7 @@ RSpec.describe Projects::CleanupService, feature_category: :source_code_manageme
Gitaly::ApplyBfgObjectMapStreamResponse::Entry.new(
type: :COMMIT,
old_oid: old_oid,
- new_oid: Gitlab::Git::BLANK_SHA
+ new_oid: Gitlab::Git::SHA1_BLANK_SHA
)
end
diff --git a/spec/services/projects/fork_service_spec.rb b/spec/services/projects/fork_service_spec.rb
index e6418c7b4ea..30fcdc27a78 100644
--- a/spec/services/projects/fork_service_spec.rb
+++ b/spec/services/projects/fork_service_spec.rb
@@ -392,7 +392,7 @@ RSpec.describe Projects::ForkService, feature_category: :source_code_management
.and_return(true)
allow_any_instance_of(Gitlab::Git::Repository).to receive(:replicate)
allow_any_instance_of(Gitlab::Git::Repository).to receive(:checksum)
- .and_return(::Gitlab::Git::BLANK_SHA)
+ .and_return(::Gitlab::Git::SHA1_BLANK_SHA)
allow_next_instance_of(Gitlab::Git::ObjectPool) do |object_pool|
allow(object_pool).to receive(:link)
end
diff --git a/spec/services/push_event_payload_service_spec.rb b/spec/services/push_event_payload_service_spec.rb
index 999b71ff754..ef722fb34e7 100644
--- a/spec/services/push_event_payload_service_spec.rb
+++ b/spec/services/push_event_payload_service_spec.rb
@@ -70,7 +70,7 @@ RSpec.describe PushEventPayloadService, feature_category: :source_code_managemen
describe '#commit_from_id' do
it 'returns nil when creating a new ref' do
- service = described_class.new(event, before: Gitlab::Git::BLANK_SHA)
+ service = described_class.new(event, before: Gitlab::Git::SHA1_BLANK_SHA)
expect(service.commit_from_id).to be_nil
end
@@ -84,7 +84,7 @@ RSpec.describe PushEventPayloadService, feature_category: :source_code_managemen
describe '#commit_to_id' do
it 'returns nil when removing an existing ref' do
- service = described_class.new(event, after: Gitlab::Git::BLANK_SHA)
+ service = described_class.new(event, after: Gitlab::Git::SHA1_BLANK_SHA)
expect(service.commit_to_id).to be_nil
end
@@ -156,7 +156,7 @@ RSpec.describe PushEventPayloadService, feature_category: :source_code_managemen
describe '#create?' do
it 'returns true when creating a new ref' do
- service = described_class.new(event, before: Gitlab::Git::BLANK_SHA)
+ service = described_class.new(event, before: Gitlab::Git::SHA1_BLANK_SHA)
expect(service.create?).to eq(true)
end
@@ -170,7 +170,7 @@ RSpec.describe PushEventPayloadService, feature_category: :source_code_managemen
describe '#remove?' do
it 'returns true when removing an existing ref' do
- service = described_class.new(event, after: Gitlab::Git::BLANK_SHA)
+ service = described_class.new(event, after: Gitlab::Git::SHA1_BLANK_SHA)
expect(service.remove?).to eq(true)
end
@@ -184,13 +184,13 @@ RSpec.describe PushEventPayloadService, feature_category: :source_code_managemen
describe '#action' do
it 'returns :created when creating a ref' do
- service = described_class.new(event, before: Gitlab::Git::BLANK_SHA)
+ service = described_class.new(event, before: Gitlab::Git::SHA1_BLANK_SHA)
expect(service.action).to eq(:created)
end
it 'returns :removed when removing an existing ref' do
- service = described_class.new(event, before: '123', after: Gitlab::Git::BLANK_SHA)
+ service = described_class.new(event, before: '123', after: Gitlab::Git::SHA1_BLANK_SHA)
expect(service.action).to eq(:removed)
end
diff --git a/spec/support/helpers/cycle_analytics_helpers.rb b/spec/support/helpers/cycle_analytics_helpers.rb
index 890fefcc7de..e4683cbf3c0 100644
--- a/spec/support/helpers/cycle_analytics_helpers.rb
+++ b/spec/support/helpers/cycle_analytics_helpers.rb
@@ -123,7 +123,7 @@ module CycleAnalyticsHelpers
def create_commit(message, project, user, branch_name, count: 1, commit_time: nil, skip_push_handler: false)
repository = project.repository
- oldrev = repository.commit(branch_name)&.sha || Gitlab::Git::BLANK_SHA
+ oldrev = repository.commit(branch_name)&.sha || Gitlab::Git::SHA1_BLANK_SHA
commit_shas = Array.new(count) do |index|
commit_sha = repository.create_file(user, generate(:branch), "content", message: message, branch_name: branch_name)
diff --git a/spec/support/rspec_order_todo.yml b/spec/support/rspec_order_todo.yml
index 81196fdcbfa..56a28004233 100644
--- a/spec/support/rspec_order_todo.yml
+++ b/spec/support/rspec_order_todo.yml
@@ -6116,7 +6116,6 @@
- './spec/lib/gitlab/github_import/markdown_text_spec.rb'
- './spec/lib/gitlab/github_import/milestone_finder_spec.rb'
- './spec/lib/gitlab/github_import/object_counter_spec.rb'
-- './spec/lib/gitlab/github_import/page_counter_spec.rb'
- './spec/lib/gitlab/github_import/parallel_importer_spec.rb'
- './spec/lib/gitlab/github_import/parallel_scheduling_spec.rb'
- './spec/lib/gitlab/github_import/representation/diff_note_spec.rb'
@@ -6244,6 +6243,7 @@
- './spec/lib/gitlab/i18n/translation_entry_spec.rb'
- './spec/lib/gitlab/identifier_spec.rb'
- './spec/lib/gitlab/import/database_helpers_spec.rb'
+- './spec/lib/gitlab/import/page_counter_spec.rb'
- './spec/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy_spec.rb'
- './spec/lib/gitlab/import_export/after_export_strategies/web_upload_strategy_spec.rb'
- './spec/lib/gitlab/import_export/after_export_strategy_builder_spec.rb'
diff --git a/spec/support/shared_examples/models/concerns/integrations/base_slack_notification_shared_examples.rb b/spec/support/shared_examples/models/concerns/integrations/base_slack_notification_shared_examples.rb
index 2dad35dc46e..d05c29c39c3 100644
--- a/spec/support/shared_examples/models/concerns/integrations/base_slack_notification_shared_examples.rb
+++ b/spec/support/shared_examples/models/concerns/integrations/base_slack_notification_shared_examples.rb
@@ -111,7 +111,7 @@ RSpec.shared_examples Integrations::BaseSlackNotification do |factory:|
end
context 'for tag_push notification' do
- let(:oldrev) { Gitlab::Git::BLANK_SHA }
+ let(:oldrev) { Gitlab::Git::SHA1_BLANK_SHA }
let(:newrev) { '8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b' } # gitlab-test: git rev-parse refs/tags/v1.1.0
let(:ref) { 'refs/tags/v1.1.0' }
let(:data) do
diff --git a/spec/support/shared_examples/models/concerns/integrations/slack_mattermost_notifier_shared_examples.rb b/spec/support/shared_examples/models/concerns/integrations/slack_mattermost_notifier_shared_examples.rb
index 2985763426f..9e5b5ecfb48 100644
--- a/spec/support/shared_examples/models/concerns/integrations/slack_mattermost_notifier_shared_examples.rb
+++ b/spec/support/shared_examples/models/concerns/integrations/slack_mattermost_notifier_shared_examples.rb
@@ -143,7 +143,7 @@ RSpec.shared_examples Integrations::SlackMattermostNotifier do |integration_name
end
context 'tag_push events' do
- let(:oldrev) { Gitlab::Git::BLANK_SHA }
+ let(:oldrev) { Gitlab::Git::SHA1_BLANK_SHA }
let(:newrev) { '8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b' } # gitlab-test: git rev-parse refs/tags/v1.1.0
let(:ref) { 'refs/tags/v1.1.0' }
let(:data) { Git::TagHooksService.new(project, user, change: { oldrev: oldrev, newrev: newrev, ref: ref }).send(:push_data) }
diff --git a/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb b/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb
index c76ce6b555f..c08b85e6161 100644
--- a/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb
+++ b/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb
@@ -76,7 +76,7 @@ RSpec.describe Gitlab::GithubImport::ReschedulingMethods, feature_category: :imp
expect(worker.class)
.to receive(:perform_in)
- .with(15, project.id, { 'number' => 2 }, '123')
+ .with(15.012, project.id, { 'number' => 2 }, '123')
worker.perform(project.id, { 'number' => 2 }, '123')
end
diff --git a/spec/workers/emails_on_push_worker_spec.rb b/spec/workers/emails_on_push_worker_spec.rb
index 9e8fad19c20..7f400ce791d 100644
--- a/spec/workers/emails_on_push_worker_spec.rb
+++ b/spec/workers/emails_on_push_worker_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe EmailsOnPushWorker, :mailer, feature_category: :source_code_manag
describe "#perform" do
context "when push is a new branch" do
before do
- data_new_branch = data.stringify_keys.merge("before" => Gitlab::Git::BLANK_SHA)
+ data_new_branch = data.stringify_keys.merge("before" => Gitlab::Git::SHA1_BLANK_SHA)
subject.perform(project.id, recipients, data_new_branch)
end
@@ -34,7 +34,7 @@ RSpec.describe EmailsOnPushWorker, :mailer, feature_category: :source_code_manag
context "when push is a deleted branch" do
before do
- data_deleted_branch = data.stringify_keys.merge("after" => Gitlab::Git::BLANK_SHA)
+ data_deleted_branch = data.stringify_keys.merge("after" => Gitlab::Git::SHA1_BLANK_SHA)
subject.perform(project.id, recipients, data_deleted_branch)
end
diff --git a/spec/workers/gitlab/bitbucket_server_import/stage/import_users_worker_spec.rb b/spec/workers/gitlab/bitbucket_server_import/stage/import_users_worker_spec.rb
index d4cd1b82349..1141d08729d 100644
--- a/spec/workers/gitlab/bitbucket_server_import/stage/import_users_worker_spec.rb
+++ b/spec/workers/gitlab/bitbucket_server_import/stage/import_users_worker_spec.rb
@@ -3,7 +3,14 @@
require 'spec_helper'
RSpec.describe Gitlab::BitbucketServerImport::Stage::ImportUsersWorker, feature_category: :importers do
- let_it_be(:project) { create(:project, :import_started) }
+ let_it_be(:project) do
+ create(:project, :import_started,
+ import_data_attributes: {
+ data: { 'project_key' => 'key', 'repo_slug' => 'slug' },
+ credentials: { 'base_uri' => 'http://bitbucket.org/', 'user' => 'bitbucket', 'password' => 'password' }
+ }
+ )
+ end
let(:worker) { described_class.new }
@@ -15,6 +22,12 @@ RSpec.describe Gitlab::BitbucketServerImport::Stage::ImportUsersWorker, feature_
allow_next_instance_of(Gitlab::BitbucketServerImport::Importers::UsersImporter) do |importer|
allow(importer).to receive(:execute)
end
+
+ allow(Gitlab::BitbucketServerImport::Stage::ImportPullRequestsWorker).to receive(:perform_async).and_return(nil)
+ end
+
+ it_behaves_like 'an idempotent worker' do
+ let(:job_args) { [project.id] }
end
it 'schedules the next stage' do