Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
846dc476d8
commit
cd40e11c57
32 changed files with 409 additions and 56 deletions
|
@ -882,6 +882,9 @@
|
|||
- <<: *if-dot-com-gitlab-org-and-security-merge-request
|
||||
changes: *feature-flag-development-config-patterns
|
||||
when: never
|
||||
- <<: *if-dot-com-gitlab-org-and-security-merge-request
|
||||
changes: *nodejs-patterns
|
||||
allow_failure: true
|
||||
- <<: *if-dot-com-gitlab-org-and-security-merge-request
|
||||
changes: *ci-qa-patterns
|
||||
allow_failure: true
|
||||
|
|
|
@ -340,6 +340,7 @@ export default {
|
|||
:title="__('Copy file path')"
|
||||
:text="diffFile.file_path"
|
||||
:gfm="gfmCopyText"
|
||||
size="small"
|
||||
data-testid="diff-file-copy-clipboard"
|
||||
category="tertiary"
|
||||
data-track-action="click_copy_file_button"
|
||||
|
@ -392,6 +393,7 @@ export default {
|
|||
/>
|
||||
<gl-dropdown
|
||||
v-gl-tooltip.hover.focus="$options.i18n.optionsDropdownTitle"
|
||||
size="small"
|
||||
right
|
||||
toggle-class="btn-icon js-diff-more-actions"
|
||||
class="gl-pt-0!"
|
||||
|
@ -400,7 +402,7 @@ export default {
|
|||
@hidden="setMoreActionsShown(false)"
|
||||
>
|
||||
<template #button-content>
|
||||
<gl-icon name="ellipsis_v" class="mr-0" />
|
||||
<gl-icon name="ellipsis_v" class="mr-0" :size="12" />
|
||||
<span class="sr-only">{{ $options.i18n.optionsDropdownTitle }}</span>
|
||||
</template>
|
||||
<gl-dropdown-item
|
||||
|
|
|
@ -160,7 +160,7 @@ export default {
|
|||
data-testid="begin-commit-button"
|
||||
@click="beginCommit"
|
||||
>
|
||||
{{ __('Commit…') }}
|
||||
{{ __('Create commit...') }}
|
||||
</gl-button>
|
||||
</div>
|
||||
<p class="text-center bold">{{ overviewText }}</p>
|
||||
|
|
|
@ -207,7 +207,7 @@ export default {
|
|||
class="hide-collapsed gl-line-height-20 gl-text-gray-900 gl-display-flex gl-align-items-center"
|
||||
>
|
||||
{{ __('Time tracking') }}
|
||||
<gl-loading-icon v-if="isTimeTrackingInfoLoading" size="sm" inline />
|
||||
<gl-loading-icon v-if="isTimeTrackingInfoLoading" size="sm" class="gl-ml-2" inline />
|
||||
<gl-button
|
||||
:data-testid="showHelpState ? 'closeHelpButton' : 'helpButton'"
|
||||
category="tertiary"
|
||||
|
|
92
app/finders/packages/build_infos_for_many_packages_finder.rb
Normal file
92
app/finders/packages/build_infos_for_many_packages_finder.rb
Normal file
|
@ -0,0 +1,92 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Packages
|
||||
# TODO rename to BuildInfosFinder when cleaning up packages_graphql_pipelines_resolver
|
||||
# https://gitlab.com/gitlab-org/gitlab/-/issues/358432
|
||||
class BuildInfosForManyPackagesFinder
|
||||
include ActiveRecord::ConnectionAdapters::Quoting
|
||||
|
||||
MAX_PAGE_SIZE = 100
|
||||
|
||||
def initialize(package_ids, params)
|
||||
@package_ids = package_ids
|
||||
@params = params
|
||||
end
|
||||
|
||||
def execute
|
||||
return Packages::BuildInfo.none if @package_ids.blank?
|
||||
|
||||
# This is a highly custom query that
|
||||
# will not be re-used elsewhere
|
||||
# rubocop: disable CodeReuse/ActiveRecord
|
||||
query = Packages::Package.id_in(@package_ids)
|
||||
.select('build_infos.*')
|
||||
.from([Packages::Package.arel_table, lateral_query.arel.lateral.as('build_infos')])
|
||||
.order('build_infos.id DESC')
|
||||
|
||||
# We manually select build_infos fields from the lateral query.
|
||||
# Thus, we need to instruct ActiveRecord that returned rows are
|
||||
# actually Packages::BuildInfo objects
|
||||
Packages::BuildInfo.find_by_sql(query.to_sql)
|
||||
# rubocop: enable CodeReuse/ActiveRecord
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def lateral_query
|
||||
order_direction = last ? :asc : :desc
|
||||
|
||||
# This is a highly custom query that
|
||||
# will not be re-used elsewhere
|
||||
# rubocop: disable CodeReuse/ActiveRecord
|
||||
where_condition = Packages::BuildInfo.arel_table[:package_id]
|
||||
.eq(Arel.sql("#{Packages::Package.table_name}.id"))
|
||||
build_infos = ::Packages::BuildInfo.without_empty_pipelines
|
||||
.where(where_condition)
|
||||
.order(id: order_direction)
|
||||
.limit(max_rows_per_package_id)
|
||||
# rubocop: enable CodeReuse/ActiveRecord
|
||||
apply_cursor(build_infos)
|
||||
end
|
||||
|
||||
def max_rows_per_package_id
|
||||
limit = [first, last, max_page_size, MAX_PAGE_SIZE].compact.min
|
||||
limit += 1 if support_next_page
|
||||
limit
|
||||
end
|
||||
|
||||
def apply_cursor(build_infos)
|
||||
if before
|
||||
build_infos.with_pipeline_id_greater_than(before)
|
||||
elsif after
|
||||
build_infos.with_pipeline_id_less_than(after)
|
||||
else
|
||||
build_infos
|
||||
end
|
||||
end
|
||||
|
||||
def first
|
||||
@params[:first]
|
||||
end
|
||||
|
||||
def last
|
||||
@params[:last]
|
||||
end
|
||||
|
||||
def max_page_size
|
||||
@params[:max_page_size]
|
||||
end
|
||||
|
||||
def before
|
||||
@params[:before]
|
||||
end
|
||||
|
||||
def after
|
||||
@params[:after]
|
||||
end
|
||||
|
||||
def support_next_page
|
||||
@params[:support_next_page]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -98,11 +98,10 @@
|
|||
|
||||
%fieldset
|
||||
.form-group
|
||||
.form-check
|
||||
- link_start = '<a href="%{url}">'.html_safe % { url: help_page_path('user/project/web_ide/index', anchor: 'enable-live-preview') }
|
||||
= f.gitlab_ui_checkbox_component :web_ide_clientside_preview_enabled,
|
||||
s_('IDE|Live Preview'),
|
||||
help_text: s_('Preview JavaScript projects in the Web IDE with CodeSandbox Live Preview. %{link_start}Learn more.%{link_end} ').html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
|
||||
- link_start = '<a href="%{url}">'.html_safe % { url: help_page_path('user/project/web_ide/index', anchor: 'enable-live-preview') }
|
||||
= f.gitlab_ui_checkbox_component :web_ide_clientside_preview_enabled,
|
||||
s_('IDE|Live Preview'),
|
||||
help_text: s_('Preview JavaScript projects in the Web IDE with CodeSandbox Live Preview. %{link_start}Learn more.%{link_end} ').html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
|
||||
= f.submit _('Save changes'), class: "gl-button btn btn-confirm"
|
||||
|
||||
= render_if_exists 'admin/application_settings/maintenance_mode_settings_form'
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
|
||||
|
||||
.js-toggle-content.toggle-import-form{ class: ('hide' if active_tab != 'import') }
|
||||
= form_for @project, html: { class: 'new_project gl-show-field-errors js-project-import' } do |f|
|
||||
= gitlab_ui_form_for @project, html: { class: 'new_project gl-show-field-errors js-project-import' } do |f|
|
||||
%hr
|
||||
= render "shared/import_form", f: f
|
||||
= render 'projects/new_project_fields', f: f, project_name_id: "import-url-name", hide_init_with_readme: true, track_label: track_label
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
- return unless branches.any?
|
||||
|
||||
.card.gl-mt-3
|
||||
.card
|
||||
.card-header
|
||||
= panel_title
|
||||
%ul.content-list.all-branches.qa-all-branches
|
||||
|
|
|
@ -27,11 +27,6 @@
|
|||
= render_if_exists 'projects/commits/mirror_status'
|
||||
|
||||
.js-branch-list{ data: { diverging_counts_endpoint: diverging_commit_counts_namespace_project_branches_path(@project.namespace, @project, format: :json), default_branch: @project.default_branch } }
|
||||
- if can?(current_user, :admin_project, @project)
|
||||
- project_settings_link = link_to s_('Branches|project settings'), project_protected_branches_path(@project)
|
||||
.row-content-block
|
||||
%h5
|
||||
= s_('Branches|Protected branches can be managed in %{project_settings_link}.').html_safe % { project_settings_link: project_settings_link }
|
||||
|
||||
- if @gitaly_unavailable
|
||||
= render 'shared/errors/gitaly_unavailable', reason: s_('Branches|Unable to load branches')
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
:preserve
|
||||
#{h(@project.import_state.last_error)}
|
||||
|
||||
= form_for @project, url: project_import_path(@project), method: :post, html: { class: 'js-project-import' } do |f|
|
||||
= gitlab_ui_form_for @project, url: project_import_path(@project), method: :post, html: { class: 'js-project-import' } do |f|
|
||||
= render "shared/import_form", f: f
|
||||
|
||||
.form-actions
|
||||
|
|
8
config/feature_flags/development/ipynb_semantic_diff.yml
Normal file
8
config/feature_flags/development/ipynb_semantic_diff.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
name: ipynb_semantic_diff
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/85079
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/358917
|
||||
milestone: '15.0'
|
||||
type: development
|
||||
group: group::code review
|
||||
default_enabled: true
|
|
@ -4,6 +4,8 @@ classes:
|
|||
- Gitlab::Database::AsyncIndexes::PostgresAsyncIndex
|
||||
feature_categories:
|
||||
- database
|
||||
description: TODO
|
||||
description: >-
|
||||
Contains a queue-like structure for database indexes scheduled to be created asynchronously.
|
||||
See https://docs.gitlab.com/ee/development/adding_database_indexes.html#create-indexes-asynchronously for more details.
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66478
|
||||
milestone: '14.2'
|
||||
|
|
|
@ -4,6 +4,9 @@ classes:
|
|||
- Gitlab::Database::Reindexing::ReindexAction
|
||||
feature_categories:
|
||||
- database
|
||||
description: TODO
|
||||
description: >-
|
||||
Captures details about reindexing operations on a per-index basis.
|
||||
See https://docs.gitlab.com/ee/administration/raketasks/maintenance.html#rebuild-database-indexes
|
||||
for details about reindexing.
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/43156
|
||||
milestone: '13.5'
|
||||
|
|
|
@ -4,6 +4,8 @@ classes:
|
|||
- Gitlab::Database::Reindexing::QueuedAction
|
||||
feature_categories:
|
||||
- database
|
||||
description: TODO
|
||||
description: >-
|
||||
Contains a queue-like structure for reindexing actions.
|
||||
Actions in this queue will be prioritized over regular reindexing actions.
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/73480
|
||||
milestone: '14.5'
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class UpdateIndexOnPackagesBuildInfos < Gitlab::Database::Migration[1.0]
|
||||
disable_ddl_transaction!
|
||||
|
||||
NEW_INDEX_NAME = 'index_packages_build_infos_package_id_pipeline_id_id'
|
||||
OLD_INDEX_NAME = 'index_packages_build_infos_package_id_pipeline_id'
|
||||
|
||||
def up
|
||||
add_concurrent_index :packages_build_infos,
|
||||
[:package_id, :pipeline_id, :id],
|
||||
name: NEW_INDEX_NAME
|
||||
remove_concurrent_index_by_name :packages_build_infos, OLD_INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
add_concurrent_index :packages_build_infos,
|
||||
[:package_id, :pipeline_id],
|
||||
name: OLD_INDEX_NAME
|
||||
remove_concurrent_index_by_name :packages_build_infos, NEW_INDEX_NAME
|
||||
end
|
||||
end
|
1
db/schema_migrations/20220413075921
Normal file
1
db/schema_migrations/20220413075921
Normal file
|
@ -0,0 +1 @@
|
|||
b3e580387d56847039c4030fbbbda1131016ef6b068ff60f2e4e48563a331051
|
|
@ -28493,7 +28493,7 @@ CREATE UNIQUE INDEX index_organizations_on_unique_name_per_group ON customer_rel
|
|||
|
||||
CREATE INDEX index_packages_build_infos_on_pipeline_id ON packages_build_infos USING btree (pipeline_id);
|
||||
|
||||
CREATE INDEX index_packages_build_infos_package_id_pipeline_id ON packages_build_infos USING btree (package_id, pipeline_id);
|
||||
CREATE INDEX index_packages_build_infos_package_id_pipeline_id_id ON packages_build_infos USING btree (package_id, pipeline_id, id);
|
||||
|
||||
CREATE UNIQUE INDEX index_packages_composer_cache_namespace_and_sha ON packages_composer_cache_files USING btree (namespace_id, file_sha256);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
stage: Fulfillment
|
||||
group: License
|
||||
group: Provision
|
||||
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
|
||||
---
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
stage: Fulfillment
|
||||
group: License
|
||||
group: Provision
|
||||
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
|
||||
---
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
stage: Fulfillment
|
||||
group: License
|
||||
group: Provision
|
||||
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
|
||||
---
|
||||
|
||||
|
|
|
@ -25,8 +25,14 @@ GitLab.
|
|||
|
||||
## Cleaner diffs
|
||||
|
||||
> - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/6589) in GitLab 14.5 [with a flag](../../../../administration/feature_flags.md) named `jupyter_clean_diffs`. Enabled by default.
|
||||
> - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/6589) in GitLab 14.5 as an [Alpha](../../../../policy/alpha-beta-support.md#alpha-features) release [with a flag](../../../../administration/feature_flags.md) named `jupyter_clean_diffs`. Enabled by default.
|
||||
> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75500) in GitLab 14.9. Feature flag `jupyter_clean_diffs` removed.
|
||||
> - [Reintroduced toggle](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/85079) in GitLab 15.0 [with a flag](../../../../administration/feature_flags.md) named `ipynb_semantic_diff`. Enabled by default.
|
||||
|
||||
FLAG:
|
||||
On self-managed GitLab, by default this feature is available. To hide the feature, ask an administrator to [disable the feature flag](../../../../administration/feature_flags.md) named `ipynb_semantic_diff`.
|
||||
On GitLab.com, this feature is available.
|
||||
This feature is ready for production use.
|
||||
|
||||
When commits include changes to Jupyter Notebook files, GitLab:
|
||||
|
||||
|
@ -37,6 +43,10 @@ Code suggestions are not available on diffs and merge requests for `.ipynb` file
|
|||
|
||||
![Jupyter Notebook Clean Diff](img/jupyter_notebook_diff_v14_5.png)
|
||||
|
||||
This feature is an [Alpha](../../../../policy/alpha-beta-support.md#alpha-features) release,
|
||||
and might lead to performance degradation. On self-managed GitLab, if unexpected issues
|
||||
arise, disable the feature.
|
||||
|
||||
## Jupyter Git integration
|
||||
|
||||
Jupyter can be configured as an OAuth application with repository access, acting
|
||||
|
|
|
@ -210,7 +210,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
def self.db_config_names
|
||||
::ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).map(&:name)
|
||||
::ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).map(&:name) - ['geo']
|
||||
end
|
||||
|
||||
# This returns all matching schemas that a given connection can use
|
||||
|
|
|
@ -44,7 +44,13 @@ module Gitlab
|
|||
new_blob_lazy
|
||||
old_blob_lazy
|
||||
|
||||
diff.diff = Gitlab::Diff::CustomDiff.preprocess_before_diff(diff.new_path, old_blob_lazy, new_blob_lazy) || diff.diff unless use_renderable_diff?
|
||||
if use_semantic_ipynb_diff? && !use_renderable_diff?
|
||||
diff.diff = Gitlab::Diff::CustomDiff.preprocess_before_diff(diff.new_path, old_blob_lazy, new_blob_lazy) || diff.diff
|
||||
end
|
||||
end
|
||||
|
||||
def use_semantic_ipynb_diff?
|
||||
strong_memoize(:_use_semantic_ipynb_diff) { Feature.enabled?(:ipynb_semantic_diff, repository.project, default_enabled: :yaml) }
|
||||
end
|
||||
|
||||
def use_renderable_diff?
|
||||
|
@ -375,7 +381,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
def rendered
|
||||
return unless use_renderable_diff? && ipynb? && modified_file? && !too_large?
|
||||
return unless use_semantic_ipynb_diff? && use_renderable_diff? && ipynb? && modified_file? && !too_large?
|
||||
|
||||
strong_memoize(:rendered) { Rendered::Notebook::DiffFile.new(self) }
|
||||
end
|
||||
|
|
|
@ -6262,9 +6262,6 @@ msgstr ""
|
|||
msgid "Branches|Please type the following to confirm:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Branches|Protected branches can be managed in %{project_settings_link}."
|
||||
msgstr ""
|
||||
|
||||
msgid "Branches|Show active branches"
|
||||
msgstr ""
|
||||
|
||||
|
@ -6322,9 +6319,6 @@ msgstr ""
|
|||
msgid "Branches|merged"
|
||||
msgstr ""
|
||||
|
||||
msgid "Branches|project settings"
|
||||
msgstr ""
|
||||
|
||||
msgid "Branches|protected"
|
||||
msgstr ""
|
||||
|
||||
|
@ -9154,9 +9148,6 @@ msgstr ""
|
|||
msgid "Committed by"
|
||||
msgstr ""
|
||||
|
||||
msgid "Commit…"
|
||||
msgstr ""
|
||||
|
||||
msgid "Community forum"
|
||||
msgstr ""
|
||||
|
||||
|
@ -10489,6 +10480,9 @@ msgstr ""
|
|||
msgid "Create commit"
|
||||
msgstr ""
|
||||
|
||||
msgid "Create commit..."
|
||||
msgstr ""
|
||||
|
||||
msgid "Create common files more quickly, and standardize their format."
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
# Running with FF :ci_trigger_forward_variables
|
||||
RSpec.describe 'Verify', :runner do
|
||||
# TODO:
|
||||
# Remove FF :ci_trigger_forward_variables
|
||||
# when https://gitlab.com/gitlab-org/gitlab/-/issues/355572 is closed
|
||||
RSpec.describe 'Verify', :runner, feature_flag: {
|
||||
name: 'ci_trigger_forward_variables',
|
||||
scope: :global
|
||||
} do
|
||||
describe 'UI defined variable' do
|
||||
include_context 'variable inheritance test prep'
|
||||
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
# Running with FF :ci_trigger_forward_variables
|
||||
RSpec.describe 'Verify', :runner do
|
||||
# TODO:
|
||||
# Remove FF :ci_trigger_forward_variables
|
||||
# when https://gitlab.com/gitlab-org/gitlab/-/issues/355572 is closed
|
||||
RSpec.describe 'Verify', :runner, feature_flag: {
|
||||
name: 'ci_trigger_forward_variables',
|
||||
scope: :global
|
||||
} do
|
||||
describe 'UI defined variable' do
|
||||
include_context 'variable inheritance test prep'
|
||||
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
# TODO:
|
||||
# Remove FF :ci_trigger_forward_variables
|
||||
# when https://gitlab.com/gitlab-org/gitlab/-/issues/355572 is closed
|
||||
RSpec.shared_context 'variable inheritance test prep', feature_flag: {
|
||||
name: 'ci_trigger_forward_variables',
|
||||
scope: :global
|
||||
} do
|
||||
RSpec.shared_context 'variable inheritance test prep' do
|
||||
let(:random_string) { Faker::Alphanumeric.alphanumeric(number: 8) }
|
||||
|
||||
let(:group) do
|
||||
|
|
|
@ -199,14 +199,6 @@ RSpec.describe 'Branches' do
|
|||
project.add_maintainer(user)
|
||||
end
|
||||
|
||||
describe 'Initial branches page' do
|
||||
it 'shows description for admin' do
|
||||
visit project_branches_filtered_path(project, state: 'all')
|
||||
|
||||
expect(page).to have_content("Protected branches can be managed in project settings")
|
||||
end
|
||||
end
|
||||
|
||||
it 'shows the merge request button' do
|
||||
visit project_branches_path(project)
|
||||
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe ::Packages::BuildInfosForManyPackagesFinder do
|
||||
using RSpec::Parameterized::TableSyntax
|
||||
|
||||
let_it_be(:package) { create(:package) }
|
||||
let_it_be(:build_infos) { create_list(:package_build_info, 5, :with_pipeline, package: package) }
|
||||
let_it_be(:build_info_with_empty_pipeline) { create(:package_build_info, package: package) }
|
||||
|
||||
let_it_be(:other_package) { create(:package) }
|
||||
let_it_be(:other_build_infos) { create_list(:package_build_info, 5, :with_pipeline, package: other_package) }
|
||||
let_it_be(:other_build_info_with_empty_pipeline) { create(:package_build_info, package: other_package) }
|
||||
|
||||
let_it_be(:all_build_infos) { build_infos + other_build_infos }
|
||||
|
||||
let(:finder) { described_class.new(packages, params) }
|
||||
let(:packages) { nil }
|
||||
let(:first) { nil }
|
||||
let(:last) { nil }
|
||||
let(:after) { nil }
|
||||
let(:before) { nil }
|
||||
let(:max_page_size) { nil }
|
||||
let(:support_next_page) { false }
|
||||
let(:params) do
|
||||
{
|
||||
first: first,
|
||||
last: last,
|
||||
after: after,
|
||||
before: before,
|
||||
max_page_size: max_page_size,
|
||||
support_next_page: support_next_page
|
||||
}
|
||||
end
|
||||
|
||||
describe '#execute' do
|
||||
subject { finder.execute }
|
||||
|
||||
shared_examples 'returning the expected build infos' do
|
||||
let(:expected_build_infos) do
|
||||
expected_build_infos_indexes.map do |idx|
|
||||
all_build_infos[idx]
|
||||
end
|
||||
end
|
||||
|
||||
let(:after) do
|
||||
all_build_infos[after_index].pipeline_id if after_index
|
||||
end
|
||||
|
||||
let(:before) do
|
||||
all_build_infos[before_index].pipeline_id if before_index
|
||||
end
|
||||
|
||||
it { is_expected.to eq(expected_build_infos) }
|
||||
end
|
||||
|
||||
context 'with nil packages' do
|
||||
let(:packages) { nil }
|
||||
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
|
||||
context 'with [] packages' do
|
||||
let(:packages) { [] }
|
||||
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
|
||||
context 'with empy scope packages' do
|
||||
let(:packages) { Packages::Package.none }
|
||||
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
|
||||
context 'with a single package' do
|
||||
let(:packages) { package.id }
|
||||
|
||||
# rubocop: disable Layout/LineLength
|
||||
where(:first, :last, :after_index, :before_index, :max_page_size, :support_next_page, :expected_build_infos_indexes) do
|
||||
# F L AI BI MPS SNP
|
||||
nil | nil | nil | nil | nil | false | [4, 3, 2, 1, 0]
|
||||
nil | nil | nil | nil | 10 | false | [4, 3, 2, 1, 0]
|
||||
nil | nil | nil | nil | 2 | false | [4, 3]
|
||||
2 | nil | nil | nil | nil | false | [4, 3]
|
||||
2 | nil | nil | nil | nil | true | [4, 3, 2]
|
||||
2 | nil | 3 | nil | nil | false | [2, 1]
|
||||
2 | nil | 3 | nil | nil | true | [2, 1, 0]
|
||||
3 | nil | 4 | nil | 2 | false | [3, 2]
|
||||
3 | nil | 4 | nil | 2 | true | [3, 2, 1]
|
||||
nil | 2 | nil | nil | nil | false | [1, 0]
|
||||
nil | 2 | nil | nil | nil | true | [2, 1, 0]
|
||||
nil | 2 | nil | 1 | nil | false | [3, 2]
|
||||
nil | 2 | nil | 1 | nil | true | [4, 3, 2]
|
||||
nil | 3 | nil | 0 | 2 | false | [2, 1]
|
||||
nil | 3 | nil | 0 | 2 | true | [3, 2, 1]
|
||||
end
|
||||
# rubocop: enable Layout/LineLength
|
||||
|
||||
with_them do
|
||||
it_behaves_like 'returning the expected build infos'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with many packages' do
|
||||
let(:packages) { [package.id, other_package.id] }
|
||||
|
||||
# using after_index/before_index when receiving multiple packages doesn't
|
||||
# make sense but we still verify here that the behavior is coherent.
|
||||
# rubocop: disable Layout/LineLength
|
||||
where(:first, :last, :after_index, :before_index, :max_page_size, :support_next_page, :expected_build_infos_indexes) do
|
||||
# F L AI BI MPS SNP
|
||||
nil | nil | nil | nil | nil | false | [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
|
||||
nil | nil | nil | nil | 10 | false | [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
|
||||
nil | nil | nil | nil | 2 | false | [9, 8, 4, 3]
|
||||
2 | nil | nil | nil | nil | false | [9, 8, 4, 3]
|
||||
2 | nil | nil | nil | nil | true | [9, 8, 7, 4, 3, 2]
|
||||
2 | nil | 3 | nil | nil | false | [2, 1]
|
||||
2 | nil | 3 | nil | nil | true | [2, 1, 0]
|
||||
3 | nil | 4 | nil | 2 | false | [3, 2]
|
||||
3 | nil | 4 | nil | 2 | true | [3, 2, 1]
|
||||
nil | 2 | nil | nil | nil | false | [6, 5, 1, 0]
|
||||
nil | 2 | nil | nil | nil | true | [7, 6, 5, 2, 1, 0]
|
||||
nil | 2 | nil | 1 | nil | false | [6, 5, 3, 2]
|
||||
nil | 2 | nil | 1 | nil | true | [7, 6, 5, 4, 3, 2]
|
||||
nil | 3 | nil | 0 | 2 | false | [6, 5, 2, 1]
|
||||
nil | 3 | nil | 0 | 2 | true | [7, 6, 5, 3, 2, 1]
|
||||
end
|
||||
|
||||
with_them do
|
||||
it_behaves_like 'returning the expected build infos'
|
||||
end
|
||||
# rubocop: enable Layout/LineLength
|
||||
end
|
||||
end
|
||||
end
|
|
@ -120,7 +120,7 @@ describe('IDE commit form', () => {
|
|||
|
||||
it('renders commit button in compact mode', () => {
|
||||
expect(findBeginCommitButton().exists()).toBe(true);
|
||||
expect(findBeginCommitButton().text()).toBe('Commit…');
|
||||
expect(findBeginCommitButton().text()).toBe('Create commit...');
|
||||
});
|
||||
|
||||
it('does not render form', () => {
|
||||
|
|
|
@ -235,6 +235,26 @@ RSpec.describe Gitlab::Database do
|
|||
end
|
||||
end
|
||||
|
||||
describe '.db_config_names' do
|
||||
let(:expected) { %w[foo bar] }
|
||||
|
||||
it 'includes only main by default' do
|
||||
allow(::ActiveRecord::Base).to receive(:configurations).and_return(
|
||||
double(configs_for: %w[foo bar].map { |x| double(name: x) })
|
||||
)
|
||||
|
||||
expect(described_class.db_config_names).to eq(expected)
|
||||
end
|
||||
|
||||
it 'excludes geo when that is included' do
|
||||
allow(::ActiveRecord::Base).to receive(:configurations).and_return(
|
||||
double(configs_for: %w[foo bar geo].map { |x| double(name: x) })
|
||||
)
|
||||
|
||||
expect(described_class.db_config_names).to eq(expected)
|
||||
end
|
||||
end
|
||||
|
||||
describe '.gitlab_schemas_for_connection' do
|
||||
it 'does raise exception for invalid connection' do
|
||||
expect { described_class.gitlab_schemas_for_connection(:invalid) }.to raise_error /key not found: "unknown"/
|
||||
|
|
|
@ -51,6 +51,54 @@ RSpec.describe Gitlab::Diff::File do
|
|||
project.commit(branch_name).diffs.diff_files.first
|
||||
end
|
||||
|
||||
describe '#initialize' do
|
||||
let(:commit) { project.commit("532c837") }
|
||||
|
||||
context 'when file is ipynb' do
|
||||
let(:ipynb_semantic_diff) { false }
|
||||
let(:rendered_diffs_viewer) { false }
|
||||
|
||||
before do
|
||||
stub_feature_flags(ipynb_semantic_diff: ipynb_semantic_diff, rendered_diffs_viewer: rendered_diffs_viewer)
|
||||
end
|
||||
|
||||
context 'when ipynb_semantic_diff is off, and rendered_viewer is off' do
|
||||
it 'does not generate notebook diffs' do
|
||||
expect(Gitlab::Diff::CustomDiff).not_to receive(:preprocess_before_diff)
|
||||
expect(diff_file.rendered).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when ipynb_semantic_diff is off, and rendered_viewer is on' do
|
||||
let(:rendered_diffs_viewer) { true }
|
||||
|
||||
it 'does not generate rendered diff' do
|
||||
expect(Gitlab::Diff::CustomDiff).not_to receive(:preprocess_before_diff)
|
||||
expect(diff_file.rendered).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when ipynb_semantic_diff is on, and rendered_viewer is off' do
|
||||
let(:ipynb_semantic_diff) { true }
|
||||
|
||||
it 'transforms using custom diff CustomDiff' do
|
||||
expect(Gitlab::Diff::CustomDiff).to receive(:preprocess_before_diff).and_call_original
|
||||
expect(diff_file.rendered).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when ipynb_semantic_diff is on, and rendered_viewer is on' do
|
||||
let(:ipynb_semantic_diff) { true }
|
||||
let(:rendered_diffs_viewer) { true }
|
||||
|
||||
it 'transforms diff using NotebookDiffFile' do
|
||||
expect(Gitlab::Diff::CustomDiff).not_to receive(:preprocess_before_diff)
|
||||
expect(diff_file.rendered).not_to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#has_renderable?' do
|
||||
context 'file is ipynb' do
|
||||
let(:commit) { project.commit("532c837") }
|
||||
|
@ -104,6 +152,20 @@ RSpec.describe Gitlab::Diff::File do
|
|||
expect(diff_file.rendered).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when semantic ipynb is off' do
|
||||
before do
|
||||
stub_feature_flags(ipynb_semantic_diff: false)
|
||||
end
|
||||
|
||||
it 'returns nil' do
|
||||
expect(diff_file).not_to receive(:modified_file?)
|
||||
expect(diff_file).not_to receive(:ipynb?)
|
||||
expect(diff).not_to receive(:too_large?)
|
||||
|
||||
expect(diff_file.rendered).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue