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>2022-12-20 18:07:25 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 18:07:25 +0300
commit5e97da08cba997aefba6f6d13850f95536a80477 (patch)
treebd6d968e0f5054913d3f1463843ebd811fbfb32c /spec
parent09b4875c004d2db76b15cb0b32e7a7e623bbfa6f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/features/projects/pipelines/pipeline_spec.rb4
-rw-r--r--spec/features/projects/pipelines/pipelines_spec.rb6
-rw-r--r--spec/frontend/pipelines/pipelines_spec.js8
-rw-r--r--spec/presenters/ci/stage_presenter_spec.rb2
-rw-r--r--spec/requests/api/graphql/project/jobs_spec.rb12
-rw-r--r--spec/requests/api/graphql/project/pipeline_spec.rb17
-rw-r--r--spec/requests/api/rubygem_packages_spec.rb26
-rw-r--r--spec/serializers/stage_entity_spec.rb2
8 files changed, 52 insertions, 25 deletions
diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb
index d6067e22952..c9c79680c1c 100644
--- a/spec/features/projects/pipelines/pipeline_spec.rb
+++ b/spec/features/projects/pipelines/pipeline_spec.rb
@@ -18,6 +18,8 @@ RSpec.describe 'Pipeline', :js, feature_category: :projects do
end
shared_context 'pipeline builds' do
+ let!(:external_stage) { create(:ci_stage, name: 'external', pipeline: pipeline) }
+
let!(:build_passed) do
create(:ci_build, :success,
pipeline: pipeline, stage: 'build', stage_idx: 0, name: 'build')
@@ -52,7 +54,7 @@ RSpec.describe 'Pipeline', :js, feature_category: :projects do
create(:generic_commit_status, status: 'success',
pipeline: pipeline,
name: 'jenkins',
- stage: 'external',
+ ci_stage: external_stage,
ref: 'master',
target_url: 'http://gitlab.com/status')
end
diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb
index 3bdabd672c7..26ef0cd52f7 100644
--- a/spec/features/projects/pipelines/pipelines_spec.rb
+++ b/spec/features/projects/pipelines/pipelines_spec.rb
@@ -594,7 +594,7 @@ RSpec.describe 'Pipelines', :js, feature_category: :projects do
end
it 'changes the Pipeline ID column for Pipeline IID' do
- page.find('[data-testid="pipeline-key-dropdown"]').click
+ page.find('[data-testid="pipeline-key-collapsible-box"]').click
within '.gl-dropdown-contents' do
dropdown_options = page.find_all '.gl-dropdown-item'
@@ -618,6 +618,8 @@ RSpec.describe 'Pipelines', :js, feature_category: :projects do
user: user)
end
+ let(:external_stage) { create(:ci_stage, name: 'external', pipeline: pipeline) }
+
before do
create_build('build', 0, 'build', :success)
create_build('test', 1, 'rspec 0:2', :pending)
@@ -627,7 +629,7 @@ RSpec.describe 'Pipelines', :js, feature_category: :projects do
create_build('test', 1, 'audit', :created)
create_build('deploy', 2, 'production', :created)
- create(:generic_commit_status, pipeline: pipeline, stage: 'external', name: 'jenkins', stage_idx: 3, ref: 'master')
+ create(:generic_commit_status, pipeline: pipeline, ci_stage: external_stage, name: 'jenkins', ref: 'master')
visit project_pipeline_path(project, pipeline)
wait_for_requests
diff --git a/spec/frontend/pipelines/pipelines_spec.js b/spec/frontend/pipelines/pipelines_spec.js
index a3f15e25f36..351572fc83a 100644
--- a/spec/frontend/pipelines/pipelines_spec.js
+++ b/spec/frontend/pipelines/pipelines_spec.js
@@ -71,7 +71,7 @@ describe('Pipelines', () => {
const findTablePagination = () => wrapper.findComponent(TablePagination);
const findTab = (tab) => wrapper.findByTestId(`pipelines-tab-${tab}`);
- const findPipelineKeyDropdown = () => wrapper.findByTestId('pipeline-key-dropdown');
+ const findPipelineKeyCollapsibleBox = () => wrapper.findByTestId('pipeline-key-collapsible-box');
const findRunPipelineButton = () => wrapper.findByTestId('run-pipeline-button');
const findCiLintButton = () => wrapper.findByTestId('ci-lint-button');
const findCleanCacheButton = () => wrapper.findByTestId('clear-cache-button');
@@ -545,8 +545,8 @@ describe('Pipelines', () => {
expect(findFilteredSearch().exists()).toBe(true);
});
- it('renders the pipeline key dropdown', () => {
- expect(findPipelineKeyDropdown().exists()).toBe(true);
+ it('renders the pipeline key collapsible box', () => {
+ expect(findPipelineKeyCollapsibleBox().exists()).toBe(true);
});
it('renders tab empty state finished scope', async () => {
@@ -578,7 +578,7 @@ describe('Pipelines', () => {
});
it('does not render the pipeline key dropdown', () => {
- expect(findPipelineKeyDropdown().exists()).toBe(false);
+ expect(findPipelineKeyCollapsibleBox().exists()).toBe(false);
});
it('does not render tabs nor buttons', () => {
diff --git a/spec/presenters/ci/stage_presenter_spec.rb b/spec/presenters/ci/stage_presenter_spec.rb
index 368f03b0150..e7187b4ac16 100644
--- a/spec/presenters/ci/stage_presenter_spec.rb
+++ b/spec/presenters/ci/stage_presenter_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe Ci::StagePresenter do
let!(:retried_build) { create(:ci_build, :tags, :artifacts, :retried, pipeline: stage.pipeline, stage: stage.name) }
before do
- create(:generic_commit_status, pipeline: stage.pipeline, stage: stage.name)
+ create(:generic_commit_status, pipeline: stage.pipeline, ci_stage: stage)
end
shared_examples 'preloaded associations for CI status' do
diff --git a/spec/requests/api/graphql/project/jobs_spec.rb b/spec/requests/api/graphql/project/jobs_spec.rb
index d05d4a2f4b6..aea6cad9e62 100644
--- a/spec/requests/api/graphql/project/jobs_spec.rb
+++ b/spec/requests/api/graphql/project/jobs_spec.rb
@@ -33,10 +33,10 @@ RSpec.describe 'Query.project.jobs', feature_category: :continuous_integration d
it 'does not generate N+1 queries', :request_store, :use_sql_query_cache do
build_stage = create(:ci_stage, position: 1, name: 'build', project: project, pipeline: pipeline)
test_stage = create(:ci_stage, position: 2, name: 'test', project: project, pipeline: pipeline)
- create(:ci_build, pipeline: pipeline, stage_idx: build_stage.position, name: 'docker 1 2', stage: build_stage)
- create(:ci_build, pipeline: pipeline, stage_idx: build_stage.position, name: 'docker 2 2', stage: build_stage)
- create(:ci_build, pipeline: pipeline, stage_idx: test_stage.position, name: 'rspec 1 2', stage: test_stage)
- test_job = create(:ci_build, pipeline: pipeline, stage_idx: test_stage.position, name: 'rspec 2 2', stage: test_stage)
+ create(:ci_build, pipeline: pipeline, name: 'docker 1 2', ci_stage: build_stage)
+ create(:ci_build, pipeline: pipeline, name: 'docker 2 2', ci_stage: build_stage)
+ create(:ci_build, pipeline: pipeline, name: 'rspec 1 2', ci_stage: test_stage)
+ test_job = create(:ci_build, pipeline: pipeline, name: 'rspec 2 2', ci_stage: test_stage)
create(:ci_build_need, build: test_job, name: 'docker 1 2')
post_graphql(query, current_user: user)
@@ -45,8 +45,8 @@ RSpec.describe 'Query.project.jobs', feature_category: :continuous_integration d
post_graphql(query, current_user: user)
end
- create(:ci_build, name: 'test-a', stage: test_stage, stage_idx: test_stage.position, pipeline: pipeline)
- test_b_job = create(:ci_build, name: 'test-b', stage: test_stage, stage_idx: test_stage.position, pipeline: pipeline)
+ create(:ci_build, name: 'test-a', ci_stage: test_stage, pipeline: pipeline)
+ test_b_job = create(:ci_build, name: 'test-b', ci_stage: test_stage, pipeline: pipeline)
create(:ci_build_need, build: test_b_job, name: 'docker 2 2')
expect do
diff --git a/spec/requests/api/graphql/project/pipeline_spec.rb b/spec/requests/api/graphql/project/pipeline_spec.rb
index 0eeb382510e..abfdf07c288 100644
--- a/spec/requests/api/graphql/project/pipeline_spec.rb
+++ b/spec/requests/api/graphql/project/pipeline_spec.rb
@@ -348,10 +348,10 @@ RSpec.describe 'getting pipeline information nested in a project', feature_categ
it 'does not generate N+1 queries', :request_store, :use_sql_query_cache do
build_stage = create(:ci_stage, position: 1, name: 'build', project: project, pipeline: pipeline)
test_stage = create(:ci_stage, position: 2, name: 'test', project: project, pipeline: pipeline)
- create(:ci_build, pipeline: pipeline, stage_idx: build_stage.position, name: 'docker 1 2', stage: build_stage)
- create(:ci_build, pipeline: pipeline, stage_idx: build_stage.position, name: 'docker 2 2', stage: build_stage)
- create(:ci_build, pipeline: pipeline, stage_idx: test_stage.position, name: 'rspec 1 2', stage: test_stage)
- test_job = create(:ci_build, pipeline: pipeline, stage_idx: test_stage.position, name: 'rspec 2 2', stage: test_stage)
+ create(:ci_build, pipeline: pipeline, name: 'docker 1 2', ci_stage: build_stage)
+ create(:ci_build, pipeline: pipeline, name: 'docker 2 2', ci_stage: build_stage)
+ create(:ci_build, pipeline: pipeline, name: 'rspec 1 2', ci_stage: test_stage)
+ test_job = create(:ci_build, pipeline: pipeline, name: 'rspec 2 2', ci_stage: test_stage)
create(:ci_build_need, build: test_job, name: 'docker 1 2')
post_graphql(query, current_user: current_user)
@@ -360,8 +360,8 @@ RSpec.describe 'getting pipeline information nested in a project', feature_categ
post_graphql(query, current_user: current_user)
end
- create(:ci_build, name: 'test-a', stage: test_stage, stage_idx: test_stage.position, pipeline: pipeline)
- test_b_job = create(:ci_build, name: 'test-b', stage: test_stage, stage_idx: test_stage.position, pipeline: pipeline)
+ create(:ci_build, name: 'test-a', ci_stage: test_stage, pipeline: pipeline)
+ test_b_job = create(:ci_build, name: 'test-b', ci_stage: test_stage, pipeline: pipeline)
create(:ci_build_need, build: test_b_job, name: 'docker 2 2')
expect do
@@ -409,7 +409,8 @@ RSpec.describe 'getting pipeline information nested in a project', feature_categ
it 'does not generate N+1 queries', :request_store, :use_sql_query_cache do
# create extra statuses
- create(:generic_commit_status, :pending, name: 'generic-build-a', pipeline: pipeline, stage_idx: 0, stage: 'build')
+ external_stage = create(:ci_stage, position: 10, name: 'external', project: project, pipeline: pipeline)
+ create(:generic_commit_status, :pending, name: 'generic-build-a', pipeline: pipeline, ci_stage: external_stage)
create(:ci_bridge, :failed, name: 'deploy-a', pipeline: pipeline, stage_idx: 2, stage: 'deploy')
# warm up
@@ -419,7 +420,7 @@ RSpec.describe 'getting pipeline information nested in a project', feature_categ
post_graphql(query, current_user: current_user)
end
- create(:generic_commit_status, :pending, name: 'generic-build-b', pipeline: pipeline, stage_idx: 0, stage: 'build')
+ create(:generic_commit_status, :pending, name: 'generic-build-b', pipeline: pipeline, ci_stage: external_stage)
create(:ci_build, :failed, name: 'test-a', pipeline: pipeline, stage_idx: 1, stage: 'test')
create(:ci_build, :running, name: 'test-b', pipeline: pipeline, stage_idx: 1, stage: 'test')
create(:ci_build, :pending, name: 'deploy-b', pipeline: pipeline, stage_idx: 2, stage: 'deploy')
diff --git a/spec/requests/api/rubygem_packages_spec.rb b/spec/requests/api/rubygem_packages_spec.rb
index 6f048fa57a8..34cf6033811 100644
--- a/spec/requests/api/rubygem_packages_spec.rb
+++ b/spec/requests/api/rubygem_packages_spec.rb
@@ -55,11 +55,11 @@ RSpec.describe API::RubygemPackages, feature_category: :package_registry do
end
where(:user_role, :token_type, :valid_token, :status) do
- :guest | :personal_access_token | true | :not_found
+ :guest | :personal_access_token | true | :forbidden
:guest | :personal_access_token | false | :unauthorized
:guest | :deploy_token | true | :not_found
:guest | :deploy_token | false | :unauthorized
- :guest | :job_token | true | :not_found
+ :guest | :job_token | true | :forbidden
:guest | :job_token | false | :unauthorized
:reporter | :personal_access_token | true | :not_found
:reporter | :personal_access_token | false | :unauthorized
@@ -174,6 +174,17 @@ RSpec.describe API::RubygemPackages, feature_category: :package_registry do
end
end
+ context 'with access to package registry for everyone' do
+ let(:snowplow_gitlab_standard_context) { { project: project, namespace: project.namespace, property: 'i_package_rubygems_user' } }
+
+ before do
+ project.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
+ project.project_feature.update!(package_registry_access_level: ProjectFeature::PUBLIC)
+ end
+
+ it_behaves_like 'Rubygems gem download', :anonymous, :success
+ end
+
context 'with package files pending destruction' do
let_it_be(:package_file_pending_destruction) { create(:package_file, :pending_destruction, :xml, package: package, file_name: file_name) }
@@ -423,5 +434,16 @@ RSpec.describe API::RubygemPackages, feature_category: :package_registry do
it_behaves_like params[:shared_examples_name], params[:user_role], params[:expected_status], params[:member]
end
end
+
+ context 'with access to package registry for everyone' do
+ let(:params) { {} }
+
+ before do
+ project.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
+ project.project_feature.update!(package_registry_access_level: ProjectFeature::PUBLIC)
+ end
+
+ it_behaves_like 'dependency endpoint success', :anonymous, :success
+ end
end
end
diff --git a/spec/serializers/stage_entity_spec.rb b/spec/serializers/stage_entity_spec.rb
index 95d3fd254d4..5cb5724ebdc 100644
--- a/spec/serializers/stage_entity_spec.rb
+++ b/spec/serializers/stage_entity_spec.rb
@@ -63,7 +63,7 @@ RSpec.describe StageEntity do
context 'and contains commit status' do
before do
- create(:generic_commit_status, pipeline: pipeline, stage: 'test')
+ create(:generic_commit_status, pipeline: pipeline, ci_stage: stage)
end
it 'contains commit status' do