Commit 4f739da6 authored by Mark Lapierre's avatar Mark Lapierre Committed by Ramya Authappan

Fix nuget e2e test

Use unique package names to avoid collisions if packages are left behind
parent 8e5c5787
# frozen_string_literal: true # frozen_string_literal: true
require 'securerandom'
module QA module QA
RSpec.describe 'Package', :orchestrated, :packages do RSpec.describe 'Package', :orchestrated, :packages do
describe 'NuGet Repository' do describe 'NuGet Repository' do
include Runtime::Fixtures include Runtime::Fixtures
let(:package_name) { 'dotnetcore' } let(:package_name) { "dotnetcore-#{SecureRandom.hex(8)}" }
let(:project) do let(:project) do
Resource::Project.fabricate_via_api! do |project| Resource::Project.fabricate_via_api! do |project|
project.name = 'nuget-package-project' project.name = 'nuget-package-project'
...@@ -43,7 +45,7 @@ module QA ...@@ -43,7 +45,7 @@ module QA
another_runner.remove_via_api! another_runner.remove_via_api!
end end
it 'publishes a nuget package at the project level, installs and deletes it at the group level', quarantine: { only: { pipeline: :canary }, issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/321425', type: :stale }, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1073' do it 'publishes a nuget package at the project level, installs and deletes it at the group level', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1073' do
Flow::Login.sign_in Flow::Login.sign_in
Resource::Repository::Commit.fabricate_via_api! do |commit| Resource::Repository::Commit.fabricate_via_api! do |commit|
...@@ -64,7 +66,7 @@ module QA ...@@ -64,7 +66,7 @@ module QA
script: script:
- dotnet restore -p:Configuration=Release - dotnet restore -p:Configuration=Release
- dotnet build -c Release - dotnet build -c Release
- dotnet pack -c Release - dotnet pack -c Release -p:PackageID=#{package_name}
- dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username gitlab-ci-token --password $CI_JOB_TOKEN --store-password-in-clear-text - dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username gitlab-ci-token --password $CI_JOB_TOKEN --store-password-in-clear-text
- dotnet nuget push "bin/Release/*.nupkg" --source gitlab - dotnet nuget push "bin/Release/*.nupkg" --source gitlab
only: only:
......
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