Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-09-19 00:13:54 +00:00
parent cd25acd9f7
commit f764c2fd9e
21 changed files with 180 additions and 180 deletions

View File

@ -60,26 +60,6 @@ Layout/FirstArrayElementIndentation:
- 'qa/qa/specs/features/ee/browser_ui/3_create/repository/code_owners_with_protected_branch_and_squashed_commits_spec.rb'
- 'qa/qa/specs/features/ee/browser_ui/4_verify/new_discussion_not_dropping_merge_trains_mr_spec.rb'
- 'spec/controllers/concerns/send_file_upload_spec.rb'
- 'spec/controllers/graphql_controller_spec.rb'
- 'spec/controllers/projects/ci/daily_build_group_report_results_controller_spec.rb'
- 'spec/controllers/projects/ci/lints_controller_spec.rb'
- 'spec/controllers/projects/pipelines/tests_controller_spec.rb'
- 'spec/controllers/projects/pipelines_controller_spec.rb'
- 'spec/deprecation_toolkit_env.rb'
- 'spec/features/clusters/create_agent_spec.rb'
- 'spec/finders/bulk_imports/entities_finder_spec.rb'
- 'spec/finders/ci/daily_build_group_report_results_finder_spec.rb'
- 'spec/finders/deploy_tokens/tokens_finder_spec.rb'
- 'spec/finders/groups/projects_requiring_authorizations_refresh/on_direct_membership_finder_spec.rb'
- 'spec/finders/groups/projects_requiring_authorizations_refresh/on_transfer_finder_spec.rb'
- 'spec/frontend/fixtures/search.rb'
- 'spec/graphql/mutations/commits/create_spec.rb'
- 'spec/graphql/mutations/environments/canary_ingress/update_spec.rb'
- 'spec/graphql/resolvers/ci/test_suite_resolver_spec.rb'
- 'spec/graphql/types/ci/runner_architecture_type_spec.rb'
- 'spec/graphql/types/ci/runner_platform_type_spec.rb'
- 'spec/graphql/types/metrics/dashboard_type_spec.rb'
- 'spec/graphql/types/packages/composer/metadatum_type_spec.rb'
- 'spec/graphql/types/packages/tag_type_spec.rb'
- 'spec/helpers/application_settings_helper_spec.rb'
- 'spec/helpers/commits_helper_spec.rb'

View File

@ -162,8 +162,9 @@ to groups instead of projects. Bot users for groups:
- Do not count as licensed seats.
- Can have a maximum role of Owner for a group. For more information, see
[Create a group access token](../../../api/group_access_tokens.md#create-a-group-access-token).
- The username is set to `group_{project_id}_bot` for the first access token. For example, `project_123_bot`.
- The email is set to `group{group_id}_bot@noreply.{Gitlab.config.gitlab.host}`. For example, `group123_bot@noreply.example.com`.
- All other properties are similar to [bot users for projects](../../project/settings/project_access_tokens.md#bot-users-for-projects)
- Have a username set to `group_{group_id}_bot` for the first access token. For example, `group_123_bot`.
- Have an email set to `group{group_id}_bot@noreply.{Gitlab.config.gitlab.host}`. For example, `group123_bot@noreply.example.com`.
All other properties are similar to [bot users for projects](../../project/settings/project_access_tokens.md#bot-users-for-projects).
For more information, see [Bot users for projects](../../project/settings/project_access_tokens.md#bot-users-for-projects).

View File

@ -88,10 +88,11 @@ RSpec.describe GraphqlController do
post :execute, params: { _json: multiplex }
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to eq([
{ 'data' => { '__typename' => 'Query' } },
{ 'data' => { '__typename' => 'Query' } }
])
expect(json_response).to eq(
[
{ 'data' => { '__typename' => 'Query' } },
{ 'data' => { '__typename' => 'Query' } }
])
end
it 'sets a limit on the total query size' do

View File

@ -59,12 +59,13 @@ RSpec.describe Projects::Ci::DailyBuildGroupReportResultsController do
expect(response).to have_gitlab_http_status(:ok)
expect(response.headers['Content-Type']).to eq('text/csv; charset=utf-8')
expect(csv_response).to eq([
%w[date group_name coverage],
['2020-03-09', 'rspec', '79.0'],
['2020-03-08', 'rspec', '77.0'],
['2019-12-10', 'karma', '81.0']
])
expect(csv_response).to eq(
[
%w[date group_name coverage],
['2020-03-09', 'rspec', '79.0'],
['2020-03-08', 'rspec', '77.0'],
['2019-12-10', 'karma', '81.0']
])
end
context 'when given date range spans more than 90 days' do
@ -72,12 +73,13 @@ RSpec.describe Projects::Ci::DailyBuildGroupReportResultsController do
let(:end_date) { '2020-03-09' }
it 'limits the result to 90 days from the given start_date' do
expect(csv_response).to eq([
%w[date group_name coverage],
['2020-03-09', 'rspec', '79.0'],
['2020-03-08', 'rspec', '77.0'],
['2019-12-10', 'karma', '81.0']
])
expect(csv_response).to eq(
[
%w[date group_name coverage],
['2020-03-09', 'rspec', '79.0'],
['2020-03-08', 'rspec', '77.0'],
['2019-12-10', 'karma', '81.0']
])
end
end
@ -89,29 +91,8 @@ RSpec.describe Projects::Ci::DailyBuildGroupReportResultsController do
it 'serves the results in JSON' do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to eq([
{
'group_name' => 'rspec',
'data' => [
{ 'date' => '2020-03-09', 'coverage' => 79.0 },
{ 'date' => '2020-03-08', 'coverage' => 77.0 }
]
},
{
'group_name' => 'karma',
'data' => [
{ 'date' => '2019-12-10', 'coverage' => 81.0 }
]
}
])
end
context 'when given date range spans more than 90 days' do
let(:start_date) { '2019-12-09' }
let(:end_date) { '2020-03-09' }
it 'limits the result to 90 days from the given start_date' do
expect(json_response).to eq([
expect(json_response).to eq(
[
{
'group_name' => 'rspec',
'data' => [
@ -126,6 +107,29 @@ RSpec.describe Projects::Ci::DailyBuildGroupReportResultsController do
]
}
])
end
context 'when given date range spans more than 90 days' do
let(:start_date) { '2019-12-09' }
let(:end_date) { '2020-03-09' }
it 'limits the result to 90 days from the given start_date' do
expect(json_response).to eq(
[
{
'group_name' => 'rspec',
'data' => [
{ 'date' => '2020-03-09', 'coverage' => 79.0 },
{ 'date' => '2020-03-08', 'coverage' => 77.0 }
]
},
{
'group_name' => 'karma',
'data' => [
{ 'date' => '2019-12-10', 'coverage' => 81.0 }
]
}
])
end
end

View File

@ -143,10 +143,11 @@ RSpec.describe Projects::Ci::LintsController do
it_behaves_like 'returns a successful validation'
it 'assigns result with errors' do
expect(parsed_body['errors']).to match_array([
'jobs rubocop config should implement a script: or a trigger: keyword',
'jobs config should contain at least one visible job'
])
expect(parsed_body['errors']).to match_array(
[
'jobs rubocop config should implement a script: or a trigger: keyword',
'jobs config should contain at least one visible job'
])
end
context 'with dry_run mode' do

View File

@ -86,11 +86,12 @@ RSpec.describe Projects::Pipelines::TestsController do
# Each test failure in this pipeline has a matching failure in the default branch
recent_failures = json_response['test_cases'].map { |tc| tc['recent_failures'] }
expect(recent_failures).to eq([
{ 'count' => 1, 'base_branch' => 'master' },
{ 'count' => 1, 'base_branch' => 'master' },
{ 'count' => 1, 'base_branch' => 'master' }
])
expect(recent_failures).to eq(
[
{ 'count' => 1, 'base_branch' => 'master' },
{ 'count' => 1, 'base_branch' => 'master' },
{ 'count' => 1, 'base_branch' => 'master' }
])
end
end
end

View File

@ -994,8 +994,8 @@ RSpec.describe Projects::PipelinesController do
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['errors']).to eq([
'test job: chosen stage does not exist; available stages are .pre, build, test, deploy, .post'
])
'test job: chosen stage does not exist; available stages are .pre, build, test, deploy, .post'
])
expect(json_response['warnings'][0]).to include(
'jobs:build may allow multiple pipelines to run for a single action due to `rules:when`'
)

View File

@ -58,7 +58,7 @@ module DeprecationToolkitEnv
# See https://gitlab.com/gitlab-org/gitlab/-/commit/aea37f506bbe036378998916d374966c031bf347#note_647515736
def self.allowed_kwarg_warning_paths
%w[
]
]
end
def self.configure!

View File

@ -12,10 +12,11 @@ RSpec.describe 'Cluster agent registration', :js do
allow(Gitlab::Kas).to receive(:internal_url).and_return('kas.example.internal')
allow_next_instance_of(Gitlab::Kas::Client) do |client|
allow(client).to receive(:list_agent_config_files).and_return([
double(agent_name: 'example-agent-1', path: '.gitlab/agents/example-agent-1/config.yaml'),
double(agent_name: 'example-agent-2', path: '.gitlab/agents/example-agent-2/config.yaml')
])
allow(client).to receive(:list_agent_config_files).and_return(
[
double(agent_name: 'example-agent-1', path: '.gitlab/agents/example-agent-1/config.yaml'),
double(agent_name: 'example-agent-2', path: '.gitlab/agents/example-agent-2/config.yaml')
])
allow(client).to receive(:get_connected_agents).and_return([])
end

View File

@ -88,10 +88,11 @@ RSpec.describe BulkImports::EntitiesFinder do
let(:order) { :asc }
it 'returns entities sorted ascending' do
expect(subject.execute).to eq([
started_entity_1, finished_entity_1, failed_entity_1,
started_entity_2, finished_entity_2, failed_entity_2
])
expect(subject.execute).to eq(
[
started_entity_1, finished_entity_1, failed_entity_1,
started_entity_2, finished_entity_2, failed_entity_2
])
end
end
@ -99,10 +100,11 @@ RSpec.describe BulkImports::EntitiesFinder do
let(:order) { :desc }
it 'returns entities sorted descending' do
expect(subject.execute).to eq([
failed_entity_2, finished_entity_2, started_entity_2,
failed_entity_1, finished_entity_1, started_entity_1
])
expect(subject.execute).to eq(
[
failed_entity_2, finished_entity_2, started_entity_2,
failed_entity_1, finished_entity_1, started_entity_1
])
end
end
end

View File

@ -50,12 +50,13 @@ RSpec.describe Ci::DailyBuildGroupReportResultsFinder do
let(:current_user) { user_with_permission }
it 'returns matching coverages within the given date range' do
expect(coverages).to match_array([
karma_coverage_2,
rspec_coverage_2,
karma_coverage_1,
rspec_coverage_1
])
expect(coverages).to match_array(
[
karma_coverage_2,
rspec_coverage_2,
karma_coverage_1,
rspec_coverage_1
])
end
context 'when ref_path is nil' do
@ -73,10 +74,11 @@ RSpec.describe Ci::DailyBuildGroupReportResultsFinder do
let(:limit) { 2 }
it 'returns limited number of matching coverages within the given date range' do
expect(coverages).to match_array([
karma_coverage_2,
rspec_coverage_2
])
expect(coverages).to match_array(
[
karma_coverage_2,
rspec_coverage_2
])
end
end

View File

@ -30,24 +30,26 @@ RSpec.describe DeployTokens::TokensFinder do
it 'returns all deploy tokens' do
expect(subject.size).to eq(6)
is_expected.to match_array([
project_deploy_token,
revoked_project_deploy_token,
expired_project_deploy_token,
group_deploy_token,
revoked_group_deploy_token,
expired_group_deploy_token
])
is_expected.to match_array(
[
project_deploy_token,
revoked_project_deploy_token,
expired_project_deploy_token,
group_deploy_token,
revoked_group_deploy_token,
expired_group_deploy_token
])
end
context 'and active filter is applied' do
let(:params) { { active: true } }
it 'returns only active tokens' do
is_expected.to match_array([
project_deploy_token,
group_deploy_token
])
is_expected.to match_array(
[
project_deploy_token,
group_deploy_token
])
end
end
@ -68,11 +70,12 @@ RSpec.describe DeployTokens::TokensFinder do
end
it 'returns all deploy tokens for the project' do
is_expected.to match_array([
project_deploy_token,
revoked_project_deploy_token,
expired_project_deploy_token
])
is_expected.to match_array(
[
project_deploy_token,
revoked_project_deploy_token,
expired_project_deploy_token
])
end
context 'and active filter is applied' do
@ -100,11 +103,12 @@ RSpec.describe DeployTokens::TokensFinder do
end
it 'returns all deploy tokens for the group' do
is_expected.to match_array([
group_deploy_token,
revoked_group_deploy_token,
expired_group_deploy_token
])
is_expected.to match_array(
[
group_deploy_token,
revoked_group_deploy_token,
expired_group_deploy_token
])
end
context 'and active filter is applied' do

View File

@ -54,14 +54,14 @@ RSpec.describe Groups::ProjectsRequiringAuthorizationsRefresh::OnDirectMembershi
it 'includes only the expected projects' do
expected_projects = Project.id_in(
[
project_b_subgroup_1, # direct member of Group B gets access to this project due to group hierarchy
project_b_subgroup_2, # direct member of Group B gets access to this project due to group hierarchy
project_c, # direct member of Group B gets access to this project via project-group share
project_a_subgroup_1, # direct member of Group B gets access to this project via group share
project_a_subgroup_2, # direct member of Group B gets access to this project via group share
project_b_subgroup_1, # direct member of Group B gets access to this project due to group hierarchy
project_b_subgroup_2, # direct member of Group B gets access to this project due to group hierarchy
project_c, # direct member of Group B gets access to this project via project-group share
project_a_subgroup_1, # direct member of Group B gets access to this project via group share
project_a_subgroup_2, # direct member of Group B gets access to this project via group share
# direct member of Group B gets access to any projects shared with groups within its shared groups.
project_x_subgroup_1
# direct member of Group B gets access to any projects shared with groups within its shared groups.
project_x_subgroup_1
]
)
# project_c_subgroup_1 is not included in the list because only 'direct' members of

View File

@ -46,9 +46,9 @@ RSpec.describe Groups::ProjectsRequiringAuthorizationsRefresh::OnTransferFinder
it 'includes only the expected projects' do
expected_projects = Project.id_in(
[
project_b_subgroup_1,
project_b_subgroup_2,
project_c
project_b_subgroup_1,
project_b_subgroup_2,
project_c
]
)

View File

@ -23,40 +23,41 @@ RSpec.describe SearchController, '(JavaScript fixtures)', type: :controller do
let(:namespace) { create(:namespace, name: 'frontend-fixtures') }
let(:project) { create(:project, :public, :repository, namespace: namespace, path: 'search-project') }
let(:blobs) do
Kaminari.paginate_array([
Gitlab::Search::FoundBlob.new(
path: 'CHANGELOG',
basename: 'CHANGELOG',
ref: 'master',
data: "hello\nworld\nfoo\nSend # this is the highligh\nbaz\nboo\nbat",
project: project,
project_id: project.id,
startline: 2),
Gitlab::Search::FoundBlob.new(
path: 'CONTRIBUTING',
basename: 'CONTRIBUTING',
ref: 'master',
data: "hello\nworld\nfoo\nSend # this is the highligh\nbaz\nboo\nbat",
project: project,
project_id: project.id,
startline: 2),
Gitlab::Search::FoundBlob.new(
path: 'README',
basename: 'README',
ref: 'master',
data: "foo\nSend # this is the highlight\nbaz\nboo\nbat",
project: project,
project_id: project.id,
startline: 2),
Gitlab::Search::FoundBlob.new(
path: 'test',
basename: 'test',
ref: 'master',
data: "foo\nSend # this is the highlight\nbaz\nboo\nbat",
project: project,
project_id: project.id,
startline: 2)
],
Kaminari.paginate_array(
[
Gitlab::Search::FoundBlob.new(
path: 'CHANGELOG',
basename: 'CHANGELOG',
ref: 'master',
data: "hello\nworld\nfoo\nSend # this is the highligh\nbaz\nboo\nbat",
project: project,
project_id: project.id,
startline: 2),
Gitlab::Search::FoundBlob.new(
path: 'CONTRIBUTING',
basename: 'CONTRIBUTING',
ref: 'master',
data: "hello\nworld\nfoo\nSend # this is the highligh\nbaz\nboo\nbat",
project: project,
project_id: project.id,
startline: 2),
Gitlab::Search::FoundBlob.new(
path: 'README',
basename: 'README',
ref: 'master',
data: "foo\nSend # this is the highlight\nbaz\nboo\nbat",
project: project,
project_id: project.id,
startline: 2),
Gitlab::Search::FoundBlob.new(
path: 'test',
basename: 'test',
ref: 'master',
data: "foo\nSend # this is the highlight\nbaz\nboo\nbat",
project: project,
project_id: project.id,
startline: 2)
],
total_count: 4,
limit: 4,
offset: 0)

View File

@ -43,11 +43,12 @@ RSpec.describe Mutations::Environments::CanaryIngress::Update do
end
it 'returns notice about feature removal' do
expect(subject[:errors]).to match_array([
'This endpoint was deactivated as part of the certificate-based' \
'kubernetes integration removal. See Epic:' \
'https://gitlab.com/groups/gitlab-org/configure/-/epics/8'
])
expect(subject[:errors]).to match_array(
[
'This endpoint was deactivated as part of the certificate-based' \
'kubernetes integration removal. See Epic:' \
'https://gitlab.com/groups/gitlab-org/configure/-/epics/8'
])
end
end
end

View File

@ -32,11 +32,12 @@ RSpec.describe Resolvers::Ci::TestSuiteResolver do
# Each test failure in this pipeline has a matching failure in the default branch
recent_failures = test_suite[:test_cases].map { |tc| tc[:recent_failures] }
expect(recent_failures).to eq([
{ count: 1, base_branch: 'master' },
{ count: 1, base_branch: 'master' },
{ count: 1, base_branch: 'master' }
])
expect(recent_failures).to eq(
[
{ count: 1, base_branch: 'master' },
{ count: 1, base_branch: 'master' },
{ count: 1, base_branch: 'master' }
])
end
end

View File

@ -7,8 +7,8 @@ RSpec.describe Types::Ci::RunnerArchitectureType do
it 'exposes the expected fields' do
expected_fields = %i[
name
download_location
name
download_location
]
expect(described_class).to have_graphql_fields(*expected_fields)

View File

@ -7,9 +7,9 @@ RSpec.describe Types::Ci::RunnerPlatformType do
it 'exposes the expected fields' do
expected_fields = %i[
name
human_readable_name
architectures
name
human_readable_name
architectures
]
expect(described_class).to have_graphql_fields(*expected_fields)

View File

@ -7,8 +7,8 @@ RSpec.describe GitlabSchema.types['MetricsDashboard'] do
it 'has the expected fields' do
expected_fields = %w[
path annotations schema_validation_warnings
]
path annotations schema_validation_warnings
]
expect(described_class).to have_graphql_fields(*expected_fields)
end

View File

@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['ComposerMetadata'] do
it 'includes composer metadatum fields' do
expected_fields = %w[
target_sha composer_json
target_sha composer_json
]
expect(described_class).to include_graphql_fields(*expected_fields)