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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 11:17:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 11:17:02 +0300
commitb39512ed755239198a9c294b6a45e65c05900235 (patch)
treed234a3efade1de67c46b9e5a38ce813627726aa7 /spec/lib/bulk_imports
parentd31474cf3b17ece37939d20082b07f6657cc79a9 (diff)
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'spec/lib/bulk_imports')
-rw-r--r--spec/lib/bulk_imports/clients/http_spec.rb66
-rw-r--r--spec/lib/bulk_imports/common/pipelines/lfs_objects_pipeline_spec.rb4
-rw-r--r--spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb2
-rw-r--r--spec/lib/bulk_imports/groups/transformers/group_attributes_transformer_spec.rb8
-rw-r--r--spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb8
-rw-r--r--spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb2
-rw-r--r--spec/lib/bulk_imports/projects/transformers/project_attributes_transformer_spec.rb10
7 files changed, 61 insertions, 39 deletions
diff --git a/spec/lib/bulk_imports/clients/http_spec.rb b/spec/lib/bulk_imports/clients/http_spec.rb
index c9730e03311..75c5f363b1f 100644
--- a/spec/lib/bulk_imports/clients/http_spec.rb
+++ b/spec/lib/bulk_imports/clients/http_spec.rb
@@ -56,15 +56,17 @@ RSpec.describe BulkImports::Clients::HTTP do
[
'http://gitlab.example/api/v4/resource',
hash_including(
- follow_redirects: false,
query: {
page: described_class::DEFAULT_PAGE,
- per_page: described_class::DEFAULT_PER_PAGE
+ per_page: described_class::DEFAULT_PER_PAGE,
+ private_token: token
},
headers: {
- 'Content-Type' => 'application/json',
- 'Authorization' => "Bearer #{token}"
- }
+ 'Content-Type' => 'application/json'
+ },
+ follow_redirects: true,
+ resend_on_redirect: false,
+ limit: 2
)
]
end
@@ -106,12 +108,13 @@ RSpec.describe BulkImports::Clients::HTTP do
def stub_http_get(path, query, response)
uri = "http://gitlab.example/api/v4/#{path}"
params = {
- follow_redirects: false,
- headers: {
- "Authorization" => "Bearer token",
- "Content-Type" => "application/json"
- }
- }.merge(query: query)
+ headers: { "Content-Type" => "application/json" },
+ query: { private_token: token },
+ follow_redirects: true,
+ resend_on_redirect: false,
+ limit: 2
+ }
+ params[:query] = params[:query].merge(query)
allow(Gitlab::HTTP).to receive(:get).with(uri, params).and_return(response)
end
@@ -127,11 +130,17 @@ RSpec.describe BulkImports::Clients::HTTP do
'http://gitlab.example/api/v4/resource',
hash_including(
body: {},
- follow_redirects: false,
headers: {
- 'Content-Type' => 'application/json',
- 'Authorization' => "Bearer #{token}"
- }
+ 'Content-Type' => 'application/json'
+ },
+ query: {
+ page: described_class::DEFAULT_PAGE,
+ per_page: described_class::DEFAULT_PER_PAGE,
+ private_token: token
+ },
+ follow_redirects: true,
+ resend_on_redirect: false,
+ limit: 2
)
]
end
@@ -146,11 +155,17 @@ RSpec.describe BulkImports::Clients::HTTP do
[
'http://gitlab.example/api/v4/resource',
hash_including(
- follow_redirects: false,
headers: {
- 'Content-Type' => 'application/json',
- 'Authorization' => "Bearer #{token}"
- }
+ 'Content-Type' => 'application/json'
+ },
+ query: {
+ page: described_class::DEFAULT_PAGE,
+ per_page: described_class::DEFAULT_PER_PAGE,
+ private_token: token
+ },
+ follow_redirects: true,
+ resend_on_redirect: false,
+ limit: 2
)
]
end
@@ -164,9 +179,16 @@ RSpec.describe BulkImports::Clients::HTTP do
hash_including(
stream_body: true,
headers: {
- 'Content-Type' => 'application/json',
- 'Authorization' => "Bearer #{token}"
- }
+ 'Content-Type' => 'application/json'
+ },
+ query: {
+ page: described_class::DEFAULT_PAGE,
+ per_page: described_class::DEFAULT_PER_PAGE,
+ private_token: token
+ },
+ follow_redirects: true,
+ resend_on_redirect: false,
+ limit: 2
)
]
diff --git a/spec/lib/bulk_imports/common/pipelines/lfs_objects_pipeline_spec.rb b/spec/lib/bulk_imports/common/pipelines/lfs_objects_pipeline_spec.rb
index b769aa4af5a..f0b461e518e 100644
--- a/spec/lib/bulk_imports/common/pipelines/lfs_objects_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/common/pipelines/lfs_objects_pipeline_spec.rb
@@ -11,8 +11,8 @@ RSpec.describe BulkImports::Common::Pipelines::LfsObjectsPipeline do
let(:tracker) { create(:bulk_import_tracker, entity: entity) }
let(:context) { BulkImports::Pipeline::Context.new(tracker) }
let(:lfs_dir_path) { tmpdir }
- let(:lfs_json_file_path) { File.join(lfs_dir_path, 'lfs_objects.json')}
- let(:lfs_file_path) { File.join(lfs_dir_path, oid)}
+ let(:lfs_json_file_path) { File.join(lfs_dir_path, 'lfs_objects.json') }
+ let(:lfs_file_path) { File.join(lfs_dir_path, oid) }
subject(:pipeline) { described_class.new(context) }
diff --git a/spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb b/spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb
index 9d43bb3ebfb..f650e931dc7 100644
--- a/spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe BulkImports::Common::Pipelines::UploadsPipeline do
let(:tmpdir) { Dir.mktmpdir }
let(:uploads_dir_path) { File.join(tmpdir, '72a497a02fe3ee09edae2ed06d390038') }
- let(:upload_file_path) { File.join(uploads_dir_path, 'upload.txt')}
+ let(:upload_file_path) { File.join(uploads_dir_path, 'upload.txt') }
let(:tracker) { create(:bulk_import_tracker, entity: entity) }
let(:context) { BulkImports::Pipeline::Context.new(tracker) }
diff --git a/spec/lib/bulk_imports/groups/transformers/group_attributes_transformer_spec.rb b/spec/lib/bulk_imports/groups/transformers/group_attributes_transformer_spec.rb
index d775cf6b026..896af865c56 100644
--- a/spec/lib/bulk_imports/groups/transformers/group_attributes_transformer_spec.rb
+++ b/spec/lib/bulk_imports/groups/transformers/group_attributes_transformer_spec.rb
@@ -13,7 +13,7 @@ RSpec.describe BulkImports::Groups::Transformers::GroupAttributesTransformer do
:bulk_import_entity,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'destination-name-path',
+ destination_slug: 'destination-slug-path',
destination_namespace: parent.full_path
)
end
@@ -41,14 +41,14 @@ RSpec.describe BulkImports::Groups::Transformers::GroupAttributesTransformer do
'name' => 'Name',
'description' => 'Description',
'parent_id' => parent.id,
- 'path' => 'destination-name-path'
+ 'path' => 'destination-slug-path'
})
end
- it 'transforms path from destination_name' do
+ it 'transforms path from destination_slug' do
transformed_data = subject.transform(context, data)
- expect(transformed_data['path']).to eq(entity.destination_name)
+ expect(transformed_data['path']).to eq(entity.destination_slug)
end
it 'removes full path' do
diff --git a/spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb
index 2633598b48d..a376cdd712c 100644
--- a/spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb
@@ -77,7 +77,7 @@ RSpec.describe BulkImports::Projects::Pipelines::ReleasesPipeline do
}
end
- let(:attributes) {{ 'links' => [link] }}
+ let(:attributes) { { 'links' => [link] } }
it 'restores release links' do
pipeline.run
@@ -106,7 +106,7 @@ RSpec.describe BulkImports::Projects::Pipelines::ReleasesPipeline do
}
end
- let(:attributes) {{ 'milestone_releases' => [{ 'milestone' => milestone }] }}
+ let(:attributes) { { 'milestone_releases' => [{ 'milestone' => milestone }] } }
it 'restores release milestone' do
pipeline.run
@@ -133,7 +133,7 @@ RSpec.describe BulkImports::Projects::Pipelines::ReleasesPipeline do
end
context 'when release is historical' do
- let(:attributes) {{ 'released_at' => '2018-12-26T10:17:14.621Z' }}
+ let(:attributes) { { 'released_at' => '2018-12-26T10:17:14.621Z' } }
it 'does not create release evidence' do
expect(::Releases::CreateEvidenceWorker).not_to receive(:perform_async)
@@ -143,7 +143,7 @@ RSpec.describe BulkImports::Projects::Pipelines::ReleasesPipeline do
end
context 'when release is upcoming' do
- let(:attributes) {{ 'released_at' => Time.zone.now + 30.days }}
+ let(:attributes) { { 'released_at' => Time.zone.now + 30.days } }
it 'does not create release evidence' do
expect(::Releases::CreateEvidenceWorker).not_to receive(:perform_async)
diff --git a/spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb
index 9897e74ec7b..4d12b49e2c0 100644
--- a/spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe BulkImports::Projects::Pipelines::SnippetsRepositoryPipeline do
let(:project) { create(:project) }
let(:bulk_import) { create(:bulk_import, user: user) }
let(:bulk_import_configuration) { create(:bulk_import_configuration, bulk_import: bulk_import) }
- let!(:matched_snippet) { create(:snippet, project: project, created_at: "1981-12-13T23:59:59Z")}
+ let!(:matched_snippet) { create(:snippet, project: project, created_at: "1981-12-13T23:59:59Z") }
let(:entity) do
create(
:bulk_import_entity,
diff --git a/spec/lib/bulk_imports/projects/transformers/project_attributes_transformer_spec.rb b/spec/lib/bulk_imports/projects/transformers/project_attributes_transformer_spec.rb
index a1d77b9732d..c1c4d0bf0db 100644
--- a/spec/lib/bulk_imports/projects/transformers/project_attributes_transformer_spec.rb
+++ b/spec/lib/bulk_imports/projects/transformers/project_attributes_transformer_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe BulkImports::Projects::Transformers::ProjectAttributesTransformer
source_type: :project_entity,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'Destination Project Name',
+ destination_slug: 'Destination Project Name',
destination_namespace: destination_group.full_path
)
end
@@ -32,12 +32,12 @@ RSpec.describe BulkImports::Projects::Transformers::ProjectAttributesTransformer
subject(:transformed_data) { described_class.new.transform(context, data) }
- it 'transforms name to destination name' do
- expect(transformed_data[:name]).to eq(entity.destination_name)
+ it 'transforms name to destination slug' do
+ expect(transformed_data[:name]).to eq(entity.destination_slug)
end
it 'adds path as parameterized name' do
- expect(transformed_data[:path]).to eq(entity.destination_name.parameterize)
+ expect(transformed_data[:path]).to eq(entity.destination_slug.parameterize)
end
it 'transforms visibility level' do
@@ -65,7 +65,7 @@ RSpec.describe BulkImports::Projects::Transformers::ProjectAttributesTransformer
source_type: :project_entity,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: 'Destination Project Name',
+ destination_slug: 'Destination Project Name',
destination_namespace: ''
)