Skip to content
Snippets Groups Projects
Commit cefe554b authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 5ee120f4
No related branches found
No related tags found
No related merge requests found
Showing with 71 additions and 75 deletions
Loading
Loading
@@ -171,7 +171,17 @@ describe Projects::PipelinesController do
 
def create_build(pipeline, stage, stage_idx, name, user = nil)
status = %w[created running pending success failed canceled].sample
create(:ci_build, pipeline: pipeline, stage: stage, stage_idx: stage_idx, name: name, status: status, user: user)
create(
:ci_build,
:artifacts,
artifacts_expire_at: 2.days.from_now,
pipeline: pipeline,
stage: stage,
stage_idx: stage_idx,
name: name,
status: status,
user: user
)
end
end
 
Loading
Loading
Loading
Loading
@@ -187,6 +187,8 @@ shared_examples "installing applications on a cluster" do
page.within('.js-cluster-application-row-elastic_stack') do
click_button 'Install'
end
wait_for_requests
end
 
it 'shows status transition' do
Loading
Loading
Loading
Loading
@@ -152,61 +152,6 @@ describe 'Dashboard Projects' do
end
end
 
describe 'with a pipeline', :clean_gitlab_redis_shared_state do
let(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit.sha, ref: project.default_branch) }
before do
# Since the cache isn't updated when a new pipeline is created
# we need the pipeline to advance in the pipeline since the cache was created
# by visiting the login page.
pipeline.succeed
end
it 'shows that the last pipeline passed' do
visit dashboard_projects_path
page.within('.controls') do
expect(page).to have_xpath("//a[@href='#{pipelines_project_commit_path(project, project.commit, ref: pipeline.ref)}']")
expect(page).to have_css('.ci-status-link')
expect(page).to have_css('.ci-status-icon-success')
expect(page).to have_link('Pipeline: passed')
end
end
shared_examples 'hidden pipeline status' do
it 'does not show the pipeline status' do
visit dashboard_projects_path
page.within('.controls') do
expect(page).not_to have_xpath("//a[@href='#{pipelines_project_commit_path(project, project.commit, ref: pipeline.ref)}']")
expect(page).not_to have_css('.ci-status-link')
expect(page).not_to have_css('.ci-status-icon-success')
expect(page).not_to have_link('Pipeline: passed')
end
end
end
context 'guest user of project and project has private pipelines' do
let(:guest_user) { create(:user) }
before do
project.update(public_builds: false)
project.add_guest(guest_user)
sign_in(guest_user)
end
it_behaves_like 'hidden pipeline status'
end
context 'when dashboard_pipeline_status is disabled' do
before do
stub_feature_flags(dashboard_pipeline_status: false)
end
it_behaves_like 'hidden pipeline status'
end
end
context 'last push widget', :use_clean_rails_memory_store_caching do
before do
event = create(:push_event, project: project, author: user)
Loading
Loading
import createState from '~/ide/stores/state';
import { activityBarViews } from '~/ide/constants';
import { leftSidebarViews } from '~/ide/constants';
import * as getters from '~/ide/stores/modules/file_templates/getters';
 
describe('IDE file templates getters', () => {
Loading
Loading
@@ -17,7 +17,7 @@ describe('IDE file templates getters', () => {
});
 
it('returns true if template is found and currentActivityView is edit', () => {
rootState.currentActivityView = activityBarViews.edit;
rootState.currentActivityView = leftSidebarViews.edit.name;
 
expect(
getters.showFileTemplatesBar(
Loading
Loading
@@ -31,7 +31,7 @@ describe('IDE file templates getters', () => {
});
 
it('returns false if template is found and currentActivityView is not edit', () => {
rootState.currentActivityView = activityBarViews.commit;
rootState.currentActivityView = leftSidebarViews.commit.name;
 
expect(
getters.showFileTemplatesBar(
Loading
Loading
import Vue from 'vue';
import store from '~/ide/stores';
import { activityBarViews } from '~/ide/constants';
import { leftSidebarViews } from '~/ide/constants';
import ActivityBar from '~/ide/components/activity_bar.vue';
import { createComponentWithStore } from '../../helpers/vue_mount_component_helper';
import { resetStore } from '../helpers';
Loading
Loading
@@ -34,19 +34,19 @@ describe('IDE activity bar', () => {
it('calls updateActivityBarView with edit value on click', () => {
vm.$el.querySelector('.js-ide-edit-mode').click();
 
expect(vm.updateActivityBarView).toHaveBeenCalledWith(activityBarViews.edit);
expect(vm.updateActivityBarView).toHaveBeenCalledWith(leftSidebarViews.edit.name);
});
 
it('calls updateActivityBarView with commit value on click', () => {
vm.$el.querySelector('.js-ide-commit-mode').click();
 
expect(vm.updateActivityBarView).toHaveBeenCalledWith(activityBarViews.commit);
expect(vm.updateActivityBarView).toHaveBeenCalledWith(leftSidebarViews.commit.name);
});
 
it('calls updateActivityBarView with review value on click', () => {
vm.$el.querySelector('.js-ide-review-mode').click();
 
expect(vm.updateActivityBarView).toHaveBeenCalledWith(activityBarViews.review);
expect(vm.updateActivityBarView).toHaveBeenCalledWith(leftSidebarViews.review.name);
});
});
 
Loading
Loading
@@ -60,7 +60,7 @@ describe('IDE activity bar', () => {
});
 
it('sets commit item active', done => {
vm.$store.state.currentActivityView = activityBarViews.commit;
vm.$store.state.currentActivityView = leftSidebarViews.commit.name;
 
vm.$nextTick(() => {
expect(vm.$el.querySelector('.js-ide-commit-mode').classList).toContain('active');
Loading
Loading
Loading
Loading
@@ -4,7 +4,7 @@ import getSetTimeoutPromise from 'spec/helpers/set_timeout_promise_helper';
import { projectData } from 'spec/ide/mock_data';
import store from '~/ide/stores';
import CommitForm from '~/ide/components/commit_sidebar/form.vue';
import { activityBarViews } from '~/ide/constants';
import { leftSidebarViews } from '~/ide/constants';
import { resetStore } from '../../helpers';
 
describe('IDE commit form', () => {
Loading
Loading
@@ -71,7 +71,7 @@ describe('IDE commit form', () => {
vm.$el.querySelector('.btn-primary').click();
 
vm.$nextTick(() => {
expect(store.state.currentActivityView).toBe(activityBarViews.commit);
expect(store.state.currentActivityView).toBe(leftSidebarViews.commit.name);
 
done();
});
Loading
Loading
@@ -79,7 +79,7 @@ describe('IDE commit form', () => {
 
it('collapses if lastCommitMsg is set to empty and current view is not commit view', done => {
store.state.lastCommitMsg = 'abc';
store.state.currentActivityView = activityBarViews.edit;
store.state.currentActivityView = leftSidebarViews.edit.name;
 
vm.$nextTick(() => {
// if commit message is set, form is uncollapsed
Loading
Loading
@@ -133,7 +133,7 @@ describe('IDE commit form', () => {
vm.$el.querySelector('.btn-primary').click();
 
vm.$nextTick(() => {
expect(store.state.currentActivityView).toBe(activityBarViews.commit);
expect(store.state.currentActivityView).toBe(leftSidebarViews.commit.name);
expect(vm.isCompact).toBe(false);
 
done();
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@ import Vue from 'vue';
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import store from '~/ide/stores';
import ideSidebar from '~/ide/components/ide_side_bar.vue';
import { activityBarViews } from '~/ide/constants';
import { leftSidebarViews } from '~/ide/constants';
import { resetStore } from '../helpers';
import { projectData } from '../mock_data';
 
Loading
Loading
@@ -45,7 +45,7 @@ describe('IdeSidebar', () => {
});
 
it('renders commit component', done => {
vm.$store.state.currentActivityView = activityBarViews.commit;
vm.$store.state.currentActivityView = leftSidebarViews.commit.name;
 
vm.$nextTick(() => {
expect(vm.$el.querySelector('.multi-file-commit-panel-section')).not.toBeNull();
Loading
Loading
Loading
Loading
@@ -5,7 +5,7 @@ import axios from '~/lib/utils/axios_utils';
import store from '~/ide/stores';
import repoEditor from '~/ide/components/repo_editor.vue';
import Editor from '~/ide/lib/editor';
import { activityBarViews, FILE_VIEW_MODE_EDITOR, FILE_VIEW_MODE_PREVIEW } from '~/ide/constants';
import { leftSidebarViews, FILE_VIEW_MODE_EDITOR, FILE_VIEW_MODE_PREVIEW } from '~/ide/constants';
import { createComponentWithStore } from '../../helpers/vue_mount_component_helper';
import setTimeoutPromise from '../../helpers/set_timeout_promise_helper';
import { file, resetStore } from '../helpers';
Loading
Loading
@@ -359,7 +359,7 @@ describe('RepoEditor', () => {
});
 
it('hides tabs in review mode', done => {
vm.$store.state.currentActivityView = activityBarViews.review;
vm.$store.state.currentActivityView = leftSidebarViews.review.name;
 
vm.$nextTick(() => {
expect(vm.$el.querySelector('.nav-links')).toBe(null);
Loading
Loading
@@ -369,7 +369,7 @@ describe('RepoEditor', () => {
});
 
it('hides tabs in commit mode', done => {
vm.$store.state.currentActivityView = activityBarViews.commit;
vm.$store.state.currentActivityView = leftSidebarViews.commit.name;
 
vm.$nextTick(() => {
expect(vm.$el.querySelector('.nav-links')).toBe(null);
Loading
Loading
Loading
Loading
@@ -8,7 +8,7 @@ import actions, {
openMergeRequest,
} from '~/ide/stores/actions/merge_request';
import service from '~/ide/services';
import { activityBarViews, PERMISSION_READ_MR } from '~/ide/constants';
import { leftSidebarViews, PERMISSION_READ_MR } from '~/ide/constants';
import { resetStore } from '../../helpers';
 
const TEST_PROJECT = 'abcproject';
Loading
Loading
@@ -470,7 +470,7 @@ describe('IDE store merge request actions', () => {
.then(() => {
expect(store.dispatch).toHaveBeenCalledWith(
'updateActivityBarView',
activityBarViews.review,
leftSidebarViews.review.name,
);
 
testMergeRequestChanges.changes.forEach((change, i) => {
Loading
Loading
Loading
Loading
@@ -173,5 +173,44 @@ describe PipelineDetailsEntity do
expect(subject[:triggered].first[:project]).not_to be_nil
end
end
context 'when pipeline has expiring archive artifacts' do
let(:pipeline) { create(:ci_empty_pipeline) }
let!(:build_1) { create(:ci_build, :artifacts, pipeline: pipeline, artifacts_expire_at: 2.days.from_now, name: 'build_1') }
let!(:build_2) { create(:ci_build, :artifacts, pipeline: pipeline, artifacts_expire_at: 2.days.from_now, name: 'build_2') }
let!(:build_3) { create(:ci_build, :artifacts, pipeline: pipeline, artifacts_expire_at: 2.days.from_now, name: 'build_3') }
let(:names) { subject[:details][:artifacts].map { |a| a[:name] } }
context 'and preload_job_artifacts_archive is not defined in the options' do
it 'defaults to true and eager loads the job_artifacts_archive' do
recorder = ActiveRecord::QueryRecorder.new do
expect(names).to match_array(%w[build_1 build_2 build_3])
end
expected_queries = Gitlab.ee? ? 42 : 29
# This makes only one query to fetch all job artifacts
expect(recorder.count).to eq(expected_queries)
end
end
context 'and preload_job_artifacts_archive is set to false' do
let(:entity) do
described_class.represent(pipeline, request: request, preload_job_artifacts_archive: false)
end
it 'does not eager load the job_artifacts_archive' do
recorder = ActiveRecord::QueryRecorder.new do
expect(names).to match_array(%w[build_1 build_2 build_3])
end
expected_queries = Gitlab.ee? ? 44 : 31
# This makes one query for each job artifact
expect(recorder.count).to eq(expected_queries)
end
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment