Commit 0364c112 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 6f973369 c711c6fb
<script> <script>
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import { escape } from 'lodash'; import { escape } from 'lodash';
import { GlLoadingIcon, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui'; import { GlButton, GlLoadingIcon, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { sprintf } from '~/locale'; import { sprintf } from '~/locale';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import { deprecatedCreateFlash as createFlash } from '~/flash';
...@@ -19,6 +19,7 @@ export default { ...@@ -19,6 +19,7 @@ export default {
components: { components: {
DiffFileHeader, DiffFileHeader,
DiffContent, DiffContent,
GlButton,
GlLoadingIcon, GlLoadingIcon,
}, },
directives: { directives: {
...@@ -267,16 +268,21 @@ export default { ...@@ -267,16 +268,21 @@ export default {
<div v-safe-html="errorMessage" class="nothing-here-block"></div> <div v-safe-html="errorMessage" class="nothing-here-block"></div>
</div> </div>
<template v-else> <template v-else>
<div v-show="showWarning" class="nothing-here-block diff-collapsed"> <div
{{ $options.i18n.collapsed }} v-show="showWarning"
<a class="collapsed-file-warning gl-p-7 gl-bg-orange-50 gl-text-center gl-rounded-bottom-left-base gl-rounded-bottom-right-base"
class="click-to-expand" >
data-testid="toggle-link" <p class="gl-mb-8">
href="#" {{ $options.i18n.autoCollapsed }}
</p>
<gl-button
data-testid="expand-button"
category="secondary"
variant="warning"
@click.prevent="handleToggle" @click.prevent="handleToggle"
> >
{{ $options.i18n.expand }} {{ $options.i18n.expand }}
</a> </gl-button>
</div> </div>
<diff-content <diff-content
v-show="showContent" v-show="showContent"
......
...@@ -13,6 +13,6 @@ export const DIFF_FILE = { ...@@ -13,6 +13,6 @@ export const DIFF_FILE = {
), ),
fork: __('Fork'), fork: __('Fork'),
cancel: __('Cancel'), cancel: __('Cancel'),
collapsed: __('This diff is collapsed.'), autoCollapsed: __('Files with large changes are collapsed by default.'),
expand: __('Click to expand it.'), expand: __('Expand file'),
}; };
...@@ -15,22 +15,22 @@ module Types ...@@ -15,22 +15,22 @@ module Types
field :edit_url, GraphQL::STRING_TYPE, null: true, field :edit_url, GraphQL::STRING_TYPE, null: true,
description: "HTTP URL of the release's edit page", description: "HTTP URL of the release's edit page",
authorize: :update_release authorize: :update_release
field :open_merge_requests_url, GraphQL::STRING_TYPE, null: true, field :opened_merge_requests_url, GraphQL::STRING_TYPE, null: true,
description: 'HTTP URL of the merge request page, filtered by this release and `state=open`' description: 'HTTP URL of the merge request page, filtered by this release and `state=open`'
field :merged_merge_requests_url, GraphQL::STRING_TYPE, null: true, field :merged_merge_requests_url, GraphQL::STRING_TYPE, null: true,
description: 'HTTP URL of the merge request page , filtered by this release and `state=merged`' description: 'HTTP URL of the merge request page , filtered by this release and `state=merged`'
field :closed_merge_requests_url, GraphQL::STRING_TYPE, null: true, field :closed_merge_requests_url, GraphQL::STRING_TYPE, null: true,
description: 'HTTP URL of the merge request page , filtered by this release and `state=closed`' description: 'HTTP URL of the merge request page , filtered by this release and `state=closed`'
field :open_issues_url, GraphQL::STRING_TYPE, null: true, field :opened_issues_url, GraphQL::STRING_TYPE, null: true,
description: 'HTTP URL of the issues page, filtered by this release and `state=open`' description: 'HTTP URL of the issues page, filtered by this release and `state=open`'
field :closed_issues_url, GraphQL::STRING_TYPE, null: true, field :closed_issues_url, GraphQL::STRING_TYPE, null: true,
description: 'HTTP URL of the issues page, filtered by this release and `state=closed`' description: 'HTTP URL of the issues page, filtered by this release and `state=closed`'
field :merge_requests_url, GraphQL::STRING_TYPE, null: true, method: :open_merge_requests_url, field :merge_requests_url, GraphQL::STRING_TYPE, null: true, method: :opened_merge_requests_url,
description: 'HTTP URL of the merge request page filtered by this release', description: 'HTTP URL of the merge request page filtered by this release',
deprecated: { reason: 'Use `open_merge_requests_url`', milestone: '13.6' } deprecated: { reason: 'Use `openedMergeRequestsUrl`', milestone: '13.6' }
field :issues_url, GraphQL::STRING_TYPE, null: true, method: :open_issues_url, field :issues_url, GraphQL::STRING_TYPE, null: true, method: :opened_issues_url,
description: 'HTTP URL of the issues page filtered by this release', description: 'HTTP URL of the issues page filtered by this release',
deprecated: { reason: 'Use `open_issues_url`', milestone: '13.6' } deprecated: { reason: 'Use `openedIssuesUrl`', milestone: '13.6' }
end end
end end
...@@ -23,7 +23,7 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated ...@@ -23,7 +23,7 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated
project_release_url(project, release) project_release_url(project, release)
end end
def open_merge_requests_url def opened_merge_requests_url
return unless release_mr_issue_urls_available? return unless release_mr_issue_urls_available?
project_merge_requests_url(project, params_for_issues_and_mrs) project_merge_requests_url(project, params_for_issues_and_mrs)
...@@ -41,7 +41,7 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated ...@@ -41,7 +41,7 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated
project_merge_requests_url(project, params_for_issues_and_mrs(state: 'closed')) project_merge_requests_url(project, params_for_issues_and_mrs(state: 'closed'))
end end
def open_issues_url def opened_issues_url
return unless release_mr_issue_urls_available? return unless release_mr_issue_urls_available?
project_issues_url(project, params_for_issues_and_mrs) project_issues_url(project, params_for_issues_and_mrs)
......
...@@ -14,7 +14,7 @@ module Ci ...@@ -14,7 +14,7 @@ module Ci
def remaining_work_count(*args) def remaining_work_count(*args)
@remaining_work_count ||= service @remaining_work_count ||= service
.remaining_batches_count(max_batch_count: remaining_capacity) .remaining_batches_count(max_batch_count: max_running_jobs)
end end
def max_running_jobs def max_running_jobs
......
---
title: Expand Diff File collapsed UI to be significantly more obvious
merge_request: 46286
author:
type: changed
---
name: ci_new_artifact_file_reader
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/46552
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/273755
milestone: '13.6'
type: development
group: group::pipeline authoring
default_enabled: false
...@@ -17273,14 +17273,14 @@ type ReleaseLinks { ...@@ -17273,14 +17273,14 @@ type ReleaseLinks {
editUrl: String editUrl: String
""" """
HTTP URL of the issues page filtered by this release. Deprecated in 13.6: Use `open_issues_url` HTTP URL of the issues page filtered by this release. Deprecated in 13.6: Use `openedIssuesUrl`
""" """
issuesUrl: String @deprecated(reason: "Use `open_issues_url`. Deprecated in 13.6") issuesUrl: String @deprecated(reason: "Use `openedIssuesUrl`. Deprecated in 13.6")
""" """
HTTP URL of the merge request page filtered by this release. Deprecated in 13.6: Use `open_merge_requests_url` HTTP URL of the merge request page filtered by this release. Deprecated in 13.6: Use `openedMergeRequestsUrl`
""" """
mergeRequestsUrl: String @deprecated(reason: "Use `open_merge_requests_url`. Deprecated in 13.6") mergeRequestsUrl: String @deprecated(reason: "Use `openedMergeRequestsUrl`. Deprecated in 13.6")
""" """
HTTP URL of the merge request page , filtered by this release and `state=merged` HTTP URL of the merge request page , filtered by this release and `state=merged`
...@@ -17290,12 +17290,12 @@ type ReleaseLinks { ...@@ -17290,12 +17290,12 @@ type ReleaseLinks {
""" """
HTTP URL of the issues page, filtered by this release and `state=open` HTTP URL of the issues page, filtered by this release and `state=open`
""" """
openIssuesUrl: String openedIssuesUrl: String
""" """
HTTP URL of the merge request page, filtered by this release and `state=open` HTTP URL of the merge request page, filtered by this release and `state=open`
""" """
openMergeRequestsUrl: String openedMergeRequestsUrl: String
""" """
HTTP URL of the release HTTP URL of the release
......
...@@ -49821,7 +49821,7 @@ ...@@ -49821,7 +49821,7 @@
}, },
{ {
"name": "issuesUrl", "name": "issuesUrl",
"description": "HTTP URL of the issues page filtered by this release. Deprecated in 13.6: Use `open_issues_url`", "description": "HTTP URL of the issues page filtered by this release. Deprecated in 13.6: Use `openedIssuesUrl`",
"args": [ "args": [
], ],
...@@ -49831,11 +49831,11 @@ ...@@ -49831,11 +49831,11 @@
"ofType": null "ofType": null
}, },
"isDeprecated": true, "isDeprecated": true,
"deprecationReason": "Use `open_issues_url`. Deprecated in 13.6" "deprecationReason": "Use `openedIssuesUrl`. Deprecated in 13.6"
}, },
{ {
"name": "mergeRequestsUrl", "name": "mergeRequestsUrl",
"description": "HTTP URL of the merge request page filtered by this release. Deprecated in 13.6: Use `open_merge_requests_url`", "description": "HTTP URL of the merge request page filtered by this release. Deprecated in 13.6: Use `openedMergeRequestsUrl`",
"args": [ "args": [
], ],
...@@ -49845,7 +49845,7 @@ ...@@ -49845,7 +49845,7 @@
"ofType": null "ofType": null
}, },
"isDeprecated": true, "isDeprecated": true,
"deprecationReason": "Use `open_merge_requests_url`. Deprecated in 13.6" "deprecationReason": "Use `openedMergeRequestsUrl`. Deprecated in 13.6"
}, },
{ {
"name": "mergedMergeRequestsUrl", "name": "mergedMergeRequestsUrl",
...@@ -49862,7 +49862,7 @@ ...@@ -49862,7 +49862,7 @@
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "openIssuesUrl", "name": "openedIssuesUrl",
"description": "HTTP URL of the issues page, filtered by this release and `state=open`", "description": "HTTP URL of the issues page, filtered by this release and `state=open`",
"args": [ "args": [
...@@ -49876,7 +49876,7 @@ ...@@ -49876,7 +49876,7 @@
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "openMergeRequestsUrl", "name": "openedMergeRequestsUrl",
"description": "HTTP URL of the merge request page, filtered by this release and `state=open`", "description": "HTTP URL of the merge request page, filtered by this release and `state=open`",
"args": [ "args": [
...@@ -2304,11 +2304,11 @@ Evidence for a release. ...@@ -2304,11 +2304,11 @@ Evidence for a release.
| `closedIssuesUrl` | String | HTTP URL of the issues page, filtered by this release and `state=closed` | | `closedIssuesUrl` | String | HTTP URL of the issues page, filtered by this release and `state=closed` |
| `closedMergeRequestsUrl` | String | HTTP URL of the merge request page , filtered by this release and `state=closed` | | `closedMergeRequestsUrl` | String | HTTP URL of the merge request page , filtered by this release and `state=closed` |
| `editUrl` | String | HTTP URL of the release's edit page | | `editUrl` | String | HTTP URL of the release's edit page |
| `issuesUrl` **{warning-solid}** | String | **Deprecated:** Use `open_issues_url`. Deprecated in 13.6 | | `issuesUrl` **{warning-solid}** | String | **Deprecated:** Use `openedIssuesUrl`. Deprecated in 13.6 |
| `mergeRequestsUrl` **{warning-solid}** | String | **Deprecated:** Use `open_merge_requests_url`. Deprecated in 13.6 | | `mergeRequestsUrl` **{warning-solid}** | String | **Deprecated:** Use `openedMergeRequestsUrl`. Deprecated in 13.6 |
| `mergedMergeRequestsUrl` | String | HTTP URL of the merge request page , filtered by this release and `state=merged` | | `mergedMergeRequestsUrl` | String | HTTP URL of the merge request page , filtered by this release and `state=merged` |
| `openIssuesUrl` | String | HTTP URL of the issues page, filtered by this release and `state=open` | | `openedIssuesUrl` | String | HTTP URL of the issues page, filtered by this release and `state=open` |
| `openMergeRequestsUrl` | String | HTTP URL of the merge request page, filtered by this release and `state=open` | | `openedMergeRequestsUrl` | String | HTTP URL of the merge request page, filtered by this release and `state=open` |
| `selfUrl` | String | HTTP URL of the release | | `selfUrl` | String | HTTP URL of the release |
### ReleaseSource ### ReleaseSource
......
...@@ -302,6 +302,58 @@ build: ...@@ -302,6 +302,58 @@ build:
- docker run my-docker-image /script/to/run/tests - docker run my-docker-image /script/to/run/tests
``` ```
#### Enable registry mirror for `docker:dind` service
When the Docker daemon starts inside of the service container, it uses
the default configuration. You may want to configure a [registry
mirror](https://docs.docker.com/registry/recipes/mirror/) for
performance improvements and ensuring you don't reach DockerHub rate limits.
##### Inside `.gitlab-ci.yml`
You can append extra CLI flags to the `dind` service to set the registry
mirror:
```yaml
services:
- name: docker:19.03.13-dind
command: ["--registry-mirror", "https://registry-mirror.example.com"] # Specify the registry mirror to use.
```
##### Docker executor inside GitLab Runner configuration
If you are an administrator of GitLab Runner and you always want to use
the mirror for every `dind` service, update the
[configuration](https://docs.gitlab.com/runner/configuration/advanced-configuration.html)
to specify a [volume
mount](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#volumes-in-the-runnersdocker-section).
Given we have a file `/opt/docker/daemon.json` with the following
content:
```json
{
"registry-mirrors": [
"https://registry-mirror.example.com"
]
}
```
Update the `config.toml` for GitLab Runner to mount the file to
`/etc/docker/daemon.json`. This would mount the file for **every**
container that is created by GitLab Runner. The configuration will be
picked up by the `dind` service.
```toml
[[runners]]
...
executor = "docker"
[runners.docker]
image = "alpine:3.12"
privileged = true
volumes = ["/opt/docker/daemon.json:/etc/docker/daemon.json:ro"]
```
### Use Docker socket binding ### Use Docker socket binding
The third approach is to bind-mount `/var/run/docker.sock` into the The third approach is to bind-mount `/var/run/docker.sock` into the
......
...@@ -30,8 +30,8 @@ module API ...@@ -30,8 +30,8 @@ module API
expose :evidences, using: Entities::Releases::Evidence, expose_nil: false, if: ->(_, _) { can_download_code? } expose :evidences, using: Entities::Releases::Evidence, expose_nil: false, if: ->(_, _) { can_download_code? }
expose :_links do expose :_links do
expose :self_url, as: :self, expose_nil: false expose :self_url, as: :self, expose_nil: false
expose :open_merge_requests_url, as: :merge_requests_url, expose_nil: false expose :opened_merge_requests_url, as: :merge_requests_url, expose_nil: false
expose :open_issues_url, as: :issues_url, expose_nil: false expose :opened_issues_url, as: :issues_url, expose_nil: false
expose :edit_url, expose_nil: false expose :edit_url, expose_nil: false
end end
......
...@@ -45,6 +45,14 @@ module Gitlab ...@@ -45,6 +45,14 @@ module Gitlab
end end
def read_zip_file!(file_path) def read_zip_file!(file_path)
if ::Feature.enabled?(:ci_new_artifact_file_reader, job.project, default_enabled: false)
read_with_new_artifact_file_reader(file_path)
else
read_with_legacy_artifact_file_reader(file_path)
end
end
def read_with_new_artifact_file_reader(file_path)
job.artifacts_file.use_open_file do |file| job.artifacts_file.use_open_file do |file|
zip_file = Zip::File.new(file, false, true) zip_file = Zip::File.new(file, false, true)
entry = zip_file.find_entry(file_path) entry = zip_file.find_entry(file_path)
...@@ -61,6 +69,25 @@ module Gitlab ...@@ -61,6 +69,25 @@ module Gitlab
end end
end end
def read_with_legacy_artifact_file_reader(file_path)
job.artifacts_file.use_file do |archive_path|
Zip::File.open(archive_path) do |zip_file|
entry = zip_file.find_entry(file_path)
unless entry
raise Error, "Path `#{file_path}` does not exist inside the `#{job.name}` artifacts archive!"
end
if entry.name_is_directory?
raise Error, "Path `#{file_path}` was expected to be a file but it was a directory!"
end
zip_file.get_input_stream(entry) do |is|
is.read
end
end
end
end
def max_archive_size_in_mb def max_archive_size_in_mb
ActiveSupport::NumberHelper.number_to_human_size(MAX_ARCHIVE_SIZE) ActiveSupport::NumberHelper.number_to_human_size(MAX_ARCHIVE_SIZE)
end end
......
...@@ -18,6 +18,15 @@ module Gitlab ...@@ -18,6 +18,15 @@ module Gitlab
FEATURE_CATEGORY_HEADER = 'X-Gitlab-Feature-Category' FEATURE_CATEGORY_HEADER = 'X-Gitlab-Feature-Category'
FEATURE_CATEGORY_DEFAULT = 'unknown' FEATURE_CATEGORY_DEFAULT = 'unknown'
# These were the top 5 categories at a point in time, chosen as a
# reasonable default. If we initialize every category we'll end up
# with an explosion in unused metric combinations, but we want the
# most common ones to be always present.
FEATURE_CATEGORIES_TO_INITIALIZE = ['authentication_and_authorization',
'code_review', 'continuous_integration',
'not_owned', 'source_code_management',
FEATURE_CATEGORY_DEFAULT].freeze
def initialize(app) def initialize(app)
@app = app @app = app
end end
...@@ -46,16 +55,10 @@ module Gitlab ...@@ -46,16 +55,10 @@ module Gitlab
# #
# For example `rate(http_requests_total{status="500"}[1m])` would return # For example `rate(http_requests_total{status="500"}[1m])` would return
# no data until the first 500 error would occur. # no data until the first 500 error would occur.
# The list of feature categories is currently not needed by the application
# anywhere else. So no need to keep these in memory forever.
# Doing it here, means we're only reading the file on boot.
feature_categories = YAML.load_file(Rails.root.join('config', 'feature_categories.yml')).map(&:strip).uniq << FEATURE_CATEGORY_DEFAULT
HTTP_METHODS.each do |method, statuses| HTTP_METHODS.each do |method, statuses|
http_request_duration_seconds.get({ method: method }) http_request_duration_seconds.get({ method: method })
statuses.product(feature_categories) do |status, feature_category| statuses.product(FEATURE_CATEGORIES_TO_INITIALIZE) do |status, feature_category|
http_requests_total.get({ method: method, status: status, feature_category: feature_category }) http_requests_total.get({ method: method, status: status, feature_category: feature_category })
end end
end end
......
...@@ -10884,6 +10884,9 @@ msgstr "" ...@@ -10884,6 +10884,9 @@ msgstr ""
msgid "Expand approvers" msgid "Expand approvers"
msgstr "" msgstr ""
msgid "Expand file"
msgstr ""
msgid "Expand milestones" msgid "Expand milestones"
msgstr "" msgstr ""
...@@ -11585,6 +11588,9 @@ msgstr "" ...@@ -11585,6 +11588,9 @@ msgstr ""
msgid "Files breadcrumb" msgid "Files breadcrumb"
msgstr "" msgstr ""
msgid "Files with large changes are collapsed by default."
msgstr ""
msgid "Files, directories, and submodules in the path %{path} for commit reference %{ref}" msgid "Files, directories, and submodules in the path %{path} for commit reference %{ref}"
msgstr "" msgstr ""
......
...@@ -15,11 +15,11 @@ RSpec.describe 'User expands diff', :js do ...@@ -15,11 +15,11 @@ RSpec.describe 'User expands diff', :js do
it 'allows user to expand diff' do it 'allows user to expand diff' do
page.within find('[id="19763941ab80e8c09871c0a425f0560d9053bcb3"]') do page.within find('[id="19763941ab80e8c09871c0a425f0560d9053bcb3"]') do
click_link 'Click to expand it.' find('[data-testid="expand-button"]').click
wait_for_requests wait_for_requests
expect(page).not_to have_content('Click to expand it.') expect(page).not_to have_content('Expand file')
expect(page).to have_selector('.code') expect(page).to have_selector('.code')
end end
end end
......
...@@ -90,7 +90,7 @@ function createComponent({ file }) { ...@@ -90,7 +90,7 @@ function createComponent({ file }) {
const findDiffHeader = wrapper => wrapper.find(DiffFileHeaderComponent); const findDiffHeader = wrapper => wrapper.find(DiffFileHeaderComponent);
const findDiffContentArea = wrapper => wrapper.find('[data-testid="content-area"]'); const findDiffContentArea = wrapper => wrapper.find('[data-testid="content-area"]');
const findLoader = wrapper => wrapper.find('[data-testid="loader-icon"]'); const findLoader = wrapper => wrapper.find('[data-testid="loader-icon"]');
const findToggleLinks = wrapper => wrapper.findAll('[data-testid="toggle-link"]'); const findToggleButton = wrapper => wrapper.find('[data-testid="expand-button"]');
const toggleFile = wrapper => findDiffHeader(wrapper).vm.$emit('toggleFile'); const toggleFile = wrapper => findDiffHeader(wrapper).vm.$emit('toggleFile');
const isDisplayNone = element => element.style.display === 'none'; const isDisplayNone = element => element.style.display === 'none';
...@@ -187,9 +187,11 @@ describe('DiffFile', () => { ...@@ -187,9 +187,11 @@ describe('DiffFile', () => {
makeFileAutomaticallyCollapsed(store); makeFileAutomaticallyCollapsed(store);
}); });
it('should show the collapsed file warning with expansion link', () => { it('should show the collapsed file warning with expansion button', () => {
expect(findDiffContentArea(wrapper).html()).toContain('This diff is collapsed'); expect(findDiffContentArea(wrapper).html()).toContain(
expect(findToggleLinks(wrapper).length).toEqual(1); 'Files with large changes are collapsed by default.',
);
expect(findToggleButton(wrapper).exists()).toBe(true);
}); });
it('should style the component so that it `.has-body` for layout purposes', () => { it('should style the component so that it `.has-body` for layout purposes', () => {
...@@ -292,8 +294,10 @@ describe('DiffFile', () => { ...@@ -292,8 +294,10 @@ describe('DiffFile', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(findDiffContentArea(wrapper).html()).toContain('This diff is collapsed'); expect(findDiffContentArea(wrapper).html()).toContain(
expect(findToggleLinks(wrapper).length).toEqual(1); 'Files with large changes are collapsed by default.',
);
expect(findToggleButton(wrapper).exists()).toBe(true);
}); });
it.each` it.each`
......
...@@ -8,10 +8,10 @@ RSpec.describe GitlabSchema.types['ReleaseLinks'] do ...@@ -8,10 +8,10 @@ RSpec.describe GitlabSchema.types['ReleaseLinks'] do
it 'has the expected fields' do it 'has the expected fields' do
expected_fields = %w[ expected_fields = %w[
selfUrl selfUrl
openMergeRequestsUrl openedMergeRequestsUrl
mergedMergeRequestsUrl mergedMergeRequestsUrl
closedMergeRequestsUrl closedMergeRequestsUrl
openIssuesUrl openedIssuesUrl
closedIssuesUrl closedIssuesUrl
editUrl editUrl
mergeRequestsUrl mergeRequestsUrl
......
...@@ -18,6 +18,17 @@ RSpec.describe Gitlab::Ci::ArtifactFileReader do ...@@ -18,6 +18,17 @@ RSpec.describe Gitlab::Ci::ArtifactFileReader do
expect(YAML.safe_load(subject).keys).to contain_exactly('rspec', 'time', 'custom') expect(YAML.safe_load(subject).keys).to contain_exactly('rspec', 'time', 'custom')
end end
context 'when FF ci_new_artifact_file_reader is disabled' do
before do
stub_feature_flags(ci_new_artifact_file_reader: false)
end
it 'returns the content at the path' do
is_expected.to be_present
expect(YAML.safe_load(subject).keys).to contain_exactly('rspec', 'time', 'custom')
end
end
context 'when path does not exist' do context 'when path does not exist' do
let(:path) { 'file/does/not/exist.txt' } let(:path) { 'file/does/not/exist.txt' }
let(:expected_error) do let(:expected_error) do
......
...@@ -129,12 +129,11 @@ RSpec.describe Gitlab::Metrics::RequestsRackMiddleware, :aggregate_failures do ...@@ -129,12 +129,11 @@ RSpec.describe Gitlab::Metrics::RequestsRackMiddleware, :aggregate_failures do
describe '.initialize_metrics', :prometheus do describe '.initialize_metrics', :prometheus do
it "sets labels for http_requests_total" do it "sets labels for http_requests_total" do
feature_categories = YAML.load_file(Rails.root.join('config', 'feature_categories.yml')).map(&:strip) << described_class::FEATURE_CATEGORY_DEFAULT
expected_labels = [] expected_labels = []
described_class::HTTP_METHODS.each do |method, statuses| described_class::HTTP_METHODS.each do |method, statuses|
statuses.each do |status| statuses.each do |status|
feature_categories.each do |feature_category| described_class::FEATURE_CATEGORIES_TO_INITIALIZE.each do |feature_category|
expected_labels << { method: method.to_s, status: status.to_s, feature_category: feature_category.to_s } expected_labels << { method: method.to_s, status: status.to_s, feature_category: feature_category.to_s }
end end
end end
...@@ -152,6 +151,13 @@ RSpec.describe Gitlab::Metrics::RequestsRackMiddleware, :aggregate_failures do ...@@ -152,6 +151,13 @@ RSpec.describe Gitlab::Metrics::RequestsRackMiddleware, :aggregate_failures do
expect(described_class.http_request_duration_seconds.values.keys).to include(*expected_labels) expect(described_class.http_request_duration_seconds.values.keys).to include(*expected_labels)
end end
it 'has every label in config/feature_categories.yml' do
defaults = [described_class::FEATURE_CATEGORY_DEFAULT, 'not_owned']
feature_categories = YAML.load_file(Rails.root.join('config', 'feature_categories.yml')).map(&:strip) + defaults
expect(described_class::FEATURE_CATEGORIES_TO_INITIALIZE).to all(be_in(feature_categories))
end
end end
end end
end end
...@@ -64,8 +64,8 @@ RSpec.describe ReleasePresenter do ...@@ -64,8 +64,8 @@ RSpec.describe ReleasePresenter do
end end
end end
describe '#open_merge_requests_url' do describe '#opened_merge_requests_url' do
subject { presenter.open_merge_requests_url } subject { presenter.opened_merge_requests_url }
it 'returns merge requests url with state=open' do it 'returns merge requests url with state=open' do
is_expected.to eq(project_merge_requests_url(project, opened_url_params)) is_expected.to eq(project_merge_requests_url(project, opened_url_params))
...@@ -112,8 +112,8 @@ RSpec.describe ReleasePresenter do ...@@ -112,8 +112,8 @@ RSpec.describe ReleasePresenter do
end end
end end
describe '#open_issues_url' do describe '#opened_issues_url' do
subject { presenter.open_issues_url } subject { presenter.opened_issues_url }
it 'returns issues url with state=open' do it 'returns issues url with state=open' do
is_expected.to eq(project_issues_url(project, opened_url_params)) is_expected.to eq(project_issues_url(project, opened_url_params))
......
...@@ -184,10 +184,10 @@ RSpec.describe 'Query.project(fullPath).release(tagName)' do ...@@ -184,10 +184,10 @@ RSpec.describe 'Query.project(fullPath).release(tagName)' do
let(:release_fields) do let(:release_fields) do
query_graphql_field(:links, nil, %{ query_graphql_field(:links, nil, %{
selfUrl selfUrl
openMergeRequestsUrl openedMergeRequestsUrl
mergedMergeRequestsUrl mergedMergeRequestsUrl
closedMergeRequestsUrl closedMergeRequestsUrl
openIssuesUrl openedIssuesUrl
closedIssuesUrl closedIssuesUrl
mergeRequestsUrl mergeRequestsUrl
issuesUrl issuesUrl
...@@ -199,10 +199,10 @@ RSpec.describe 'Query.project(fullPath).release(tagName)' do ...@@ -199,10 +199,10 @@ RSpec.describe 'Query.project(fullPath).release(tagName)' do
expect(data).to eq( expect(data).to eq(
'selfUrl' => project_release_url(project, release), 'selfUrl' => project_release_url(project, release),
'openMergeRequestsUrl' => project_merge_requests_url(project, opened_url_params), 'openedMergeRequestsUrl' => project_merge_requests_url(project, opened_url_params),
'mergedMergeRequestsUrl' => project_merge_requests_url(project, merged_url_params), 'mergedMergeRequestsUrl' => project_merge_requests_url(project, merged_url_params),
'closedMergeRequestsUrl' => project_merge_requests_url(project, closed_url_params), 'closedMergeRequestsUrl' => project_merge_requests_url(project, closed_url_params),
'openIssuesUrl' => project_issues_url(project, opened_url_params), 'openedIssuesUrl' => project_issues_url(project, opened_url_params),
'closedIssuesUrl' => project_issues_url(project, closed_url_params), 'closedIssuesUrl' => project_issues_url(project, closed_url_params),
'mergeRequestsUrl' => project_merge_requests_url(project, opened_url_params), 'mergeRequestsUrl' => project_merge_requests_url(project, opened_url_params),
'issuesUrl' => project_issues_url(project, opened_url_params) 'issuesUrl' => project_issues_url(project, opened_url_params)
......
...@@ -42,10 +42,10 @@ RSpec.describe 'Query.project(fullPath).releases()' do ...@@ -42,10 +42,10 @@ RSpec.describe 'Query.project(fullPath).releases()' do
} }
links { links {
selfUrl selfUrl
openMergeRequestsUrl openedMergeRequestsUrl
mergedMergeRequestsUrl mergedMergeRequestsUrl
closedMergeRequestsUrl closedMergeRequestsUrl
openIssuesUrl openedIssuesUrl
closedIssuesUrl closedIssuesUrl
mergeRequestsUrl mergeRequestsUrl
issuesUrl issuesUrl
...@@ -111,10 +111,10 @@ RSpec.describe 'Query.project(fullPath).releases()' do ...@@ -111,10 +111,10 @@ RSpec.describe 'Query.project(fullPath).releases()' do
}, },
'links' => { 'links' => {
'selfUrl' => project_release_url(project, release), 'selfUrl' => project_release_url(project, release),
'openMergeRequestsUrl' => project_merge_requests_url(project, opened_url_params), 'openedMergeRequestsUrl' => project_merge_requests_url(project, opened_url_params),
'mergedMergeRequestsUrl' => project_merge_requests_url(project, merged_url_params), 'mergedMergeRequestsUrl' => project_merge_requests_url(project, merged_url_params),
'closedMergeRequestsUrl' => project_merge_requests_url(project, closed_url_params), 'closedMergeRequestsUrl' => project_merge_requests_url(project, closed_url_params),
'openIssuesUrl' => project_issues_url(project, opened_url_params), 'openedIssuesUrl' => project_issues_url(project, opened_url_params),
'closedIssuesUrl' => project_issues_url(project, closed_url_params), 'closedIssuesUrl' => project_issues_url(project, closed_url_params),
'mergeRequestsUrl' => project_merge_requests_url(project, opened_url_params), 'mergeRequestsUrl' => project_merge_requests_url(project, opened_url_params),
'issuesUrl' => project_issues_url(project, opened_url_params) 'issuesUrl' => project_issues_url(project, opened_url_params)
......
...@@ -9,9 +9,14 @@ RSpec.describe Ci::DeleteObjectsWorker do ...@@ -9,9 +9,14 @@ RSpec.describe Ci::DeleteObjectsWorker do
describe '#perform' do describe '#perform' do
it 'executes a service' do it 'executes a service' do
allow(worker).to receive(:max_running_jobs).and_return(25)
expect_next_instance_of(Ci::DeleteObjectsService) do |instance| expect_next_instance_of(Ci::DeleteObjectsService) do |instance|
expect(instance).to receive(:execute) expect(instance).to receive(:execute)
expect(instance).to receive(:remaining_batches_count).once.and_call_original expect(instance).to receive(:remaining_batches_count)
.with(max_batch_count: 25)
.once
.and_call_original
end end
worker.perform worker.perform
......
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