diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-17 06:12:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-17 06:12:26 +0300 |
commit | 3a3496a81b10b1e8da1d628c3d9f4dea15f89df1 (patch) | |
tree | 488f6a7554b762451653f5383d691aa35e76b4e7 /spec | |
parent | 1b1bd461da768b31adb730f42060b7d6adf548c5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
7 files changed, 45 insertions, 27 deletions
diff --git a/spec/controllers/projects/artifacts_controller_spec.rb b/spec/controllers/projects/artifacts_controller_spec.rb index 7995e88caeb..32cd10d9805 100644 --- a/spec/controllers/projects/artifacts_controller_spec.rb +++ b/spec/controllers/projects/artifacts_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::ArtifactsController do +RSpec.describe Projects::ArtifactsController, feature_category: :build_artifacts do include RepoHelpers let(:user) { project.first_owner } @@ -110,7 +110,7 @@ RSpec.describe Projects::ArtifactsController do end context 'when no file type is supplied' do - let(:filename) { job.artifacts_file.filename } + let(:filename) { job.job_artifacts_archive.filename } it 'sends the artifacts file' do expect(controller).to receive(:send_file) @@ -270,10 +270,14 @@ RSpec.describe Projects::ArtifactsController do end context 'when the user has update_build permissions' do + let(:filename) { job.job_artifacts_trace.file.filename } + it 'sends the trace' do download_artifact(file_type: file_type) expect(response).to have_gitlab_http_status(:ok) + expect(response.headers['Content-Disposition']) + .to eq(%Q(attachment; filename="#{filename}"; filename*=UTF-8''#{filename})) end end end diff --git a/spec/frontend/boards/board_card_inner_spec.js b/spec/frontend/boards/board_card_inner_spec.js index 2c8e6306431..0edc8359b6a 100644 --- a/spec/frontend/boards/board_card_inner_spec.js +++ b/spec/frontend/boards/board_card_inner_spec.js @@ -8,9 +8,9 @@ import { mountExtended } from 'helpers/vue_test_utils_helper'; import IssuableBlockedIcon from '~/vue_shared/components/issuable_blocked_icon/issuable_blocked_icon.vue'; import BoardCardInner from '~/boards/components/board_card_inner.vue'; import WorkItemTypeIcon from '~/work_items/components/work_item_type_icon.vue'; -import { issuableTypes } from '~/boards/constants'; import eventHub from '~/boards/eventhub'; import defaultStore from '~/boards/stores'; +import { TYPE_ISSUE } from '~/issues/constants'; import { updateHistory } from '~/lib/utils/url_utility'; import { mockLabelList, mockIssue, mockIssueFullPath } from './mock_data'; @@ -93,7 +93,7 @@ describe('Board card component', () => { rootPath: '/', scopedLabelsAvailable: false, isEpicBoard, - issuableType: issuableTypes.issue, + issuableType: TYPE_ISSUE, isGroupBoard, }, }); diff --git a/spec/frontend/boards/components/board_content_sidebar_spec.js b/spec/frontend/boards/components/board_content_sidebar_spec.js index 81fa28021dc..955267a415c 100644 --- a/spec/frontend/boards/components/board_content_sidebar_spec.js +++ b/spec/frontend/boards/components/board_content_sidebar_spec.js @@ -7,7 +7,8 @@ import SidebarDropdownWidget from 'ee_else_ce/sidebar/components/sidebar_dropdow import { stubComponent } from 'helpers/stub_component'; import BoardContentSidebar from '~/boards/components/board_content_sidebar.vue'; import BoardSidebarTitle from '~/boards/components/sidebar/board_sidebar_title.vue'; -import { ISSUABLE, issuableTypes } from '~/boards/constants'; +import { ISSUABLE } from '~/boards/constants'; +import { TYPE_ISSUE } from '~/issues/constants'; import SidebarDateWidget from '~/sidebar/components/date/sidebar_date_widget.vue'; import SidebarSeverityWidget from '~/sidebar/components/severity/sidebar_severity_widget.vue'; import SidebarSubscriptionsWidget from '~/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue'; @@ -53,7 +54,7 @@ describe('BoardContentSidebar', () => { canUpdate: true, rootPath: '/', groupId: 1, - issuableType: issuableTypes.issue, + issuableType: TYPE_ISSUE, isGroupBoard: false, }, store, diff --git a/spec/frontend/boards/stores/actions_spec.js b/spec/frontend/boards/stores/actions_spec.js index b3e90e34161..ab959abaa99 100644 --- a/spec/frontend/boards/stores/actions_spec.js +++ b/spec/frontend/boards/stores/actions_spec.js @@ -6,7 +6,6 @@ import { inactiveId, ISSUABLE, ListType, - issuableTypes, BoardType, DraggableItemTypes, } from 'ee_else_ce/boards/constants'; @@ -27,6 +26,7 @@ import actions from '~/boards/stores/actions'; import * as types from '~/boards/stores/mutation_types'; import mutations from '~/boards/stores/mutations'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; +import { TYPE_ISSUE } from '~/issues/constants'; import projectBoardMilestones from '~/boards/graphql/project_board_milestones.query.graphql'; import groupBoardMilestones from '~/boards/graphql/group_board_milestones.query.graphql'; @@ -167,7 +167,7 @@ describe('setFilters', () => { ])('should commit mutation SET_FILTERS %s', (_, { filters, filterVariables }) => { const state = { filters: {}, - issuableType: issuableTypes.issue, + issuableType: TYPE_ISSUE, }; testAction( @@ -299,9 +299,9 @@ describe('fetchLists', () => { }); it.each` - issuableType | boardType | fullBoardId | isGroup | isProject - ${issuableTypes.issue} | ${BoardType.group} | ${'gid://gitlab/Board/1'} | ${true} | ${false} - ${issuableTypes.issue} | ${BoardType.project} | ${'gid://gitlab/Board/1'} | ${false} | ${true} + issuableType | boardType | fullBoardId | isGroup | isProject + ${TYPE_ISSUE} | ${BoardType.group} | ${'gid://gitlab/Board/1'} | ${true} | ${false} + ${TYPE_ISSUE} | ${BoardType.project} | ${'gid://gitlab/Board/1'} | ${false} | ${true} `( 'calls $issuableType query with correct variables', async ({ issuableType, boardType, fullBoardId, isGroup, isProject }) => { @@ -719,7 +719,7 @@ describe('updateList', () => { boardType: 'group', disabled: false, boardLists: [{ type: 'closed' }], - issuableType: issuableTypes.issue, + issuableType: TYPE_ISSUE, boardItemsByListId, }); @@ -835,7 +835,7 @@ describe('removeList', () => { beforeEach(() => { state = { boardLists: mockListsById, - issuableType: issuableTypes.issue, + issuableType: TYPE_ISSUE, }; getters = { getListByTitle: jest.fn().mockReturnValue(mockList), @@ -1747,7 +1747,7 @@ describe('setActiveItemSubscribed', () => { [mockActiveIssue.id]: mockActiveIssue, }, fullPath: 'gitlab-org', - issuableType: issuableTypes.issue, + issuableType: TYPE_ISSUE, }; const getters = { activeBoardItem: mockActiveIssue, isEpicBoard: false }; const subscribedState = true; @@ -1800,7 +1800,7 @@ describe('setActiveItemSubscribed', () => { describe('setActiveItemTitle', () => { const state = { boardItems: { [mockIssue.id]: mockIssue }, - issuableType: issuableTypes.issue, + issuableType: TYPE_ISSUE, fullPath: 'path/f', }; const getters = { activeBoardItem: mockIssue, isEpicBoard: false }; diff --git a/spec/frontend/boards/stores/mutations_spec.js b/spec/frontend/boards/stores/mutations_spec.js index 87a183c0441..2d68c070b83 100644 --- a/spec/frontend/boards/stores/mutations_spec.js +++ b/spec/frontend/boards/stores/mutations_spec.js @@ -1,8 +1,8 @@ import { cloneDeep } from 'lodash'; -import { issuableTypes } from '~/boards/constants'; import * as types from '~/boards/stores/mutation_types'; import mutations from '~/boards/stores/mutations'; import defaultState from '~/boards/stores/state'; +import { TYPE_ISSUE } from '~/issues/constants'; import { mockBoard, mockLists, @@ -70,7 +70,7 @@ describe('Board Store Mutations', () => { const fullPath = 'gitlab-org'; const boardType = 'group'; const disabled = false; - const issuableType = issuableTypes.issue; + const issuableType = TYPE_ISSUE; mutations[types.SET_INITIAL_BOARD_DATA](state, { allowSubEpics, diff --git a/spec/frontend/vue_shared/issuable/issuable_blocked_icon_spec.js b/spec/frontend/vue_shared/issuable/issuable_blocked_icon_spec.js index d59cbce6633..a0b1d64b97c 100644 --- a/spec/frontend/vue_shared/issuable/issuable_blocked_icon_spec.js +++ b/spec/frontend/vue_shared/issuable/issuable_blocked_icon_spec.js @@ -8,6 +8,7 @@ import waitForPromises from 'helpers/wait_for_promises'; import IssuableBlockedIcon from '~/vue_shared/components/issuable_blocked_icon/issuable_blocked_icon.vue'; import { blockingIssuablesQueries } from '~/vue_shared/components/issuable_blocked_icon/constants'; import { issuableTypes } from '~/boards/constants'; +import { TYPE_ISSUE } from '~/issues/constants'; import { truncate } from '~/lib/utils/text_utility'; import { mockIssue, @@ -57,7 +58,7 @@ describe('IssuableBlockedIcon', () => { item = mockBlockedIssue1, blockingIssuablesSpy = jest.fn().mockResolvedValue(mockBlockingIssuablesResponse1), issuableItem = mockIssue, - issuableType = issuableTypes.issue, + issuableType = TYPE_ISSUE, } = {}) => { mockApollo = createMockApollo([ [blockingIssuablesQueries[issuableType].query, blockingIssuablesSpy], @@ -86,7 +87,7 @@ describe('IssuableBlockedIcon', () => { data = {}, loading = false, mockIssuable = mockIssue, - issuableType = issuableTypes.issue, + issuableType = TYPE_ISSUE, } = {}) => { wrapper = extendedWrapper( shallowMount(IssuableBlockedIcon, { @@ -120,9 +121,9 @@ describe('IssuableBlockedIcon', () => { }; it.each` - mockIssuable | issuableType | expectedIcon - ${mockIssue} | ${issuableTypes.issue} | ${'issue-block'} - ${mockEpic} | ${issuableTypes.epic} | ${'entity-blocked'} + mockIssuable | issuableType | expectedIcon + ${mockIssue} | ${TYPE_ISSUE} | ${'issue-block'} + ${mockEpic} | ${issuableTypes.epic} | ${'entity-blocked'} `( 'should render blocked icon for $issuableType', ({ mockIssuable, issuableType, expectedIcon }) => { @@ -152,9 +153,9 @@ describe('IssuableBlockedIcon', () => { describe('on mouseenter on blocked icon', () => { it.each` - item | issuableType | mockBlockingIssuable | issuableItem | blockingIssuablesSpy - ${mockBlockedIssue1} | ${issuableTypes.issue} | ${mockBlockingIssue1} | ${mockIssue} | ${jest.fn().mockResolvedValue(mockBlockingIssuablesResponse1)} - ${mockBlockedEpic1} | ${issuableTypes.epic} | ${mockBlockingEpic1} | ${mockEpic} | ${jest.fn().mockResolvedValue(mockBlockingEpicIssuablesResponse1)} + item | issuableType | mockBlockingIssuable | issuableItem | blockingIssuablesSpy + ${mockBlockedIssue1} | ${TYPE_ISSUE} | ${mockBlockingIssue1} | ${mockIssue} | ${jest.fn().mockResolvedValue(mockBlockingIssuablesResponse1)} + ${mockBlockedEpic1} | ${issuableTypes.epic} | ${mockBlockingEpic1} | ${mockEpic} | ${jest.fn().mockResolvedValue(mockBlockingEpicIssuablesResponse1)} `( 'should query for blocking issuables and render the result for $issuableType', async ({ item, issuableType, issuableItem, mockBlockingIssuable, blockingIssuablesSpy }) => { diff --git a/spec/uploaders/object_storage/cdn_spec.rb b/spec/uploaders/object_storage/cdn_spec.rb index a64e7000855..d6c638297fa 100644 --- a/spec/uploaders/object_storage/cdn_spec.rb +++ b/spec/uploaders/object_storage/cdn_spec.rb @@ -32,6 +32,7 @@ RSpec.describe ObjectStorage::CDN, feature_category: :build_artifacts do let(:object) { build_stubbed(:user) } let(:public_ip) { '18.245.0.1' } + let(:query_params) { { foo: :bar } } let_it_be(:project) { build(:project) } @@ -46,9 +47,9 @@ RSpec.describe ObjectStorage::CDN, feature_category: :build_artifacts do describe '#cdn_enabled_url' do it 'calls #cdn_signed_url' do expect(subject).not_to receive(:url) - expect(subject).to receive(:cdn_signed_url).and_call_original + expect(subject).to receive(:cdn_signed_url).with(query_params).and_call_original - result = subject.cdn_enabled_url(public_ip) + result = subject.cdn_enabled_url(public_ip, query_params) expect(result.used_cdn).to be true end @@ -76,6 +77,17 @@ RSpec.describe ObjectStorage::CDN, feature_category: :build_artifacts do uploader_class.options = Gitlab.config.uploads end + describe '#cdn_enabled_url' do + it 'calls #url' do + expect(subject).not_to receive(:cdn_signed_url) + expect(subject).to receive(:url).with(query: query_params).and_call_original + + result = subject.cdn_enabled_url(public_ip, query_params) + + expect(result.used_cdn).to be false + end + end + describe '#use_cdn?' do it 'returns false' do expect(subject.use_cdn?(public_ip)).to be false |