Commit c8d8e9b5 authored by Nick Thomas's avatar Nick Thomas

Merge branch '213929-move-package-fixtures-to-core' into 'master'

Move package fixtures to core

See merge request gitlab-org/gitlab!33710
parents f0550cb6 4819e10f
......@@ -129,7 +129,7 @@ class Gitlab::Seeder::Packages
end
def fixture_path(package_type, file)
Rails.root.join('ee', 'spec', 'fixtures', package_type, file)
Rails.root.join('spec', 'fixtures', 'packages', package_type, file)
end
def with_cloned_fixture_file(package_type, file)
......
......@@ -126,7 +126,7 @@ FactoryBot.define do
end
end
file { fixture_file_upload('ee/spec/fixtures/conan/recipe_files/conanfile.py') }
file { fixture_file_upload('spec/fixtures/packages/conan/recipe_files/conanfile.py') }
file_name { 'conanfile.py' }
file_sha1 { 'be93151dc23ac34a82752444556fe79b32c7a1ad' }
file_md5 { '12345abcde' }
......@@ -140,7 +140,7 @@ FactoryBot.define do
end
end
file { fixture_file_upload('ee/spec/fixtures/conan/recipe_files/conanmanifest.txt') }
file { fixture_file_upload('spec/fixtures/packages/conan/recipe_files/conanmanifest.txt') }
file_name { 'conanmanifest.txt' }
file_sha1 { 'be93151dc23ac34a82752444556fe79b32c7a1ad' }
file_md5 { '12345abcde' }
......@@ -154,7 +154,7 @@ FactoryBot.define do
end
end
file { fixture_file_upload('ee/spec/fixtures/conan/package_files/conanmanifest.txt') }
file { fixture_file_upload('spec/fixtures/packages/conan/package_files/conanmanifest.txt') }
file_name { 'conanmanifest.txt' }
file_sha1 { 'be93151dc23ac34a82752444556fe79b32c7a1ad' }
file_md5 { '12345abcde' }
......@@ -168,7 +168,7 @@ FactoryBot.define do
end
end
file { fixture_file_upload('ee/spec/fixtures/conan/package_files/conaninfo.txt') }
file { fixture_file_upload('spec/fixtures/packages/conan/package_files/conaninfo.txt') }
file_name { 'conaninfo.txt' }
file_sha1 { 'be93151dc23ac34a82752444556fe79b32c7a1ad' }
file_md5 { '12345abcde' }
......@@ -182,7 +182,7 @@ FactoryBot.define do
end
end
file { fixture_file_upload('ee/spec/fixtures/conan/package_files/conan_package.tgz') }
file { fixture_file_upload('spec/fixtures/packages/conan/package_files/conan_package.tgz') }
file_name { 'conan_package.tgz' }
file_sha1 { 'be93151dc23ac34a82752444556fe79b32c7a1ad' }
file_md5 { '12345abcde' }
......@@ -191,28 +191,28 @@ FactoryBot.define do
end
trait(:jar) do
file { fixture_file_upload('ee/spec/fixtures/maven/my-app-1.0-20180724.124855-1.jar') }
file { fixture_file_upload('spec/fixtures/packages/maven/my-app-1.0-20180724.124855-1.jar') }
file_name { 'my-app-1.0-20180724.124855-1.jar' }
file_sha1 { '4f0bfa298744d505383fbb57c554d4f5c12d88b3' }
size { 100.kilobytes }
end
trait(:pom) do
file { fixture_file_upload('ee/spec/fixtures/maven/my-app-1.0-20180724.124855-1.pom') }
file { fixture_file_upload('spec/fixtures/packages/maven/my-app-1.0-20180724.124855-1.pom') }
file_name { 'my-app-1.0-20180724.124855-1.pom' }
file_sha1 { '19c975abd49e5102ca6c74a619f21e0cf0351c57' }
size { 200.kilobytes }
end
trait(:xml) do
file { fixture_file_upload('ee/spec/fixtures/maven/maven-metadata.xml') }
file { fixture_file_upload('spec/fixtures/packages/maven/maven-metadata.xml') }
file_name { 'maven-metadata.xml' }
file_sha1 { '42b1bdc80de64953b6876f5a8c644f20204011b0' }
size { 300.kilobytes }
end
trait(:npm) do
file { fixture_file_upload('ee/spec/fixtures/npm/foo-1.0.1.tgz') }
file { fixture_file_upload('spec/fixtures/packages/npm/foo-1.0.1.tgz') }
file_name { 'foo-1.0.1.tgz' }
file_sha1 { 'be93151dc23ac34a82752444556fe79b32c7a1ad' }
verified_at { Date.current }
......@@ -222,7 +222,7 @@ FactoryBot.define do
trait(:nuget) do
package
file { fixture_file_upload('ee/spec/fixtures/nuget/package.nupkg') }
file { fixture_file_upload('spec/fixtures/packages/nuget/package.nupkg') }
file_name { 'package.nupkg' }
file_sha1 { '5fe852b2a6abd96c22c11fa1ff2fb19d9ce58b57' }
size { 300.kilobytes }
......@@ -230,7 +230,7 @@ FactoryBot.define do
trait(:pypi) do
package
file { fixture_file_upload('ee/spec/fixtures/pypi/sample-project.tar.gz') }
file { fixture_file_upload('spec/fixtures/packages/pypi/sample-project.tar.gz') }
file_name { 'sample-project-1.0.0.tar.gz' }
file_sha1 { '2c0cfbed075d3fae226f051f0cc771b533e01aff' }
file_md5 { '0a7392d24f42f83068fa3767c5310052' }
......
......@@ -484,7 +484,7 @@ RSpec.describe API::MavenPackages do
end
describe 'PUT /api/v4/projects/:id/packages/maven/*path/:file_name' do
let(:file_upload) { fixture_file_upload('ee/spec/fixtures/maven/my-app-1.0-20180724.124855-1.jar') }
let(:file_upload) { fixture_file_upload('spec/fixtures/packages/maven/my-app-1.0-20180724.124855-1.jar') }
before do
# by configuring this path we allow to pass temp file from any path
......
......@@ -409,7 +409,7 @@ RSpec.describe API::NpmPackages do
end
def upload_params(package_name:, package_version: '1.0.1', file: 'npm/payload.json')
Gitlab::Json.parse(fixture_file(file, dir: 'ee')
Gitlab::Json.parse(fixture_file("packages/#{file}")
.gsub('@root/npm-test', package_name)
.gsub('1.0.1', package_version))
end
......
......@@ -8,9 +8,9 @@ RSpec.describe Packages::CreateDependencyService do
let_it_be(:package_name) { "@#{namespace.path}/my-app".freeze }
context 'when packages are published' do
let(:json_file) { 'npm/payload.json' }
let(:json_file) { 'packages/npm/payload.json' }
let(:params) do
Gitlab::Json.parse(fixture_file(json_file, dir: 'ee')
Gitlab::Json.parse(fixture_file(json_file)
.gsub('@root/npm-test', package_name)
.gsub('1.0.1', version))
.with_indifferent_access
......@@ -37,7 +37,7 @@ RSpec.describe Packages::CreateDependencyService do
end
context 'with repeated packages' do
let(:json_file) { 'npm/payload_with_duplicated_packages.json' }
let(:json_file) { 'packages/npm/payload_with_duplicated_packages.json' }
it 'creates dependencies and links' do
expect(Packages::Dependency)
......
......@@ -8,7 +8,7 @@ RSpec.describe Packages::Npm::CreatePackageService do
let(:version) { '1.0.1' }
let(:params) do
Gitlab::Json.parse(fixture_file('npm/payload.json', dir: 'ee')
Gitlab::Json.parse(fixture_file('packages/npm/payload.json')
.gsub('@root/npm-test', package_name)
.gsub('1.0.1', version)).with_indifferent_access
.merge!(override)
......
......@@ -28,11 +28,11 @@ RSpec.describe Packages::Nuget::MetadataExtractionService do
context 'with nuspec file' do
before do
allow(service).to receive(:nuspec_file).and_return(fixture_file(nuspec_filepath, dir: 'ee'))
allow(service).to receive(:nuspec_file).and_return(fixture_file(nuspec_filepath))
end
context 'with dependencies' do
let(:nuspec_filepath) { 'nuget/with_dependencies.nuspec' }
let(:nuspec_filepath) { 'packages/nuget/with_dependencies.nuspec' }
it { is_expected.to have_key(:package_dependencies) }
......@@ -47,17 +47,17 @@ RSpec.describe Packages::Nuget::MetadataExtractionService do
end
context 'with a nuspec file with metadata' do
let(:nuspec_filepath) { 'nuget/with_metadata.nuspec' }
let(:nuspec_filepath) { 'packages/nuget/with_metadata.nuspec' }
it { expect(subject[:package_tags].sort).to eq(%w(foo bar test tag1 tag2 tag3 tag4 tag5).sort) }
end
end
context 'with a nuspec file with metadata' do
let_it_be(:nuspec_filepath) { 'nuget/with_metadata.nuspec' }
let_it_be(:nuspec_filepath) { 'packages/nuget/with_metadata.nuspec' }
before do
allow(service).to receive(:nuspec_file).and_return(fixture_file(nuspec_filepath, dir: 'ee'))
allow(service).to receive(:nuspec_file).and_return(fixture_file(nuspec_filepath))
end
it { expect(subject[:license_url]).to eq('https://opensource.org/licenses/MIT') }
......
......@@ -111,13 +111,13 @@ RSpec.describe Packages::Nuget::UpdatePackageFromMetadataService, :clean_gitlab_
end
context 'with a nuspec file with metadata' do
let(:nuspec_filepath) { 'nuget/with_metadata.nuspec' }
let(:nuspec_filepath) { 'packages/nuget/with_metadata.nuspec' }
let(:expected_tags) { %w(foo bar test tag1 tag2 tag3 tag4 tag5) }
before do
allow_any_instance_of(Packages::Nuget::MetadataExtractionService)
.to receive(:nuspec_file)
.and_return(fixture_file(nuspec_filepath, dir: 'ee'))
.and_return(fixture_file(nuspec_filepath))
end
it 'creates tags' do
......@@ -164,7 +164,7 @@ RSpec.describe Packages::Nuget::UpdatePackageFromMetadataService, :clean_gitlab_
end
context 'with nuspec file with dependencies' do
let(:nuspec_filepath) { 'nuget/with_dependencies.nuspec' }
let(:nuspec_filepath) { 'packages/nuget/with_dependencies.nuspec' }
let(:package_name) { 'Test.Package' }
let(:package_version) { '3.5.2' }
let(:package_file_name) { 'test.package.3.5.2.nupkg' }
......@@ -172,7 +172,7 @@ RSpec.describe Packages::Nuget::UpdatePackageFromMetadataService, :clean_gitlab_
before do
allow_any_instance_of(Packages::Nuget::MetadataExtractionService)
.to receive(:nuspec_file)
.and_return(fixture_file(nuspec_filepath, dir: 'ee'))
.and_return(fixture_file(nuspec_filepath))
end
it 'updates package and package file' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment