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

Add latest changes from gitlab-org/gitlab@master

parent ed9165c2
No related branches found
No related tags found
No related merge requests found
Showing
with 187 additions and 35 deletions
# frozen_string_literal: true
class MigrateBotTypeToUserType < ActiveRecord::Migration[6.0]
DOWNTIME = false
def up
execute('UPDATE users SET user_type = bot_type WHERE bot_type IS NOT NULL AND user_type IS NULL')
end
def down
execute('UPDATE users SET user_type = NULL WHERE bot_type IS NOT NULL AND bot_type = user_type')
end
end
# frozen_string_literal: true
class AddUserStateIndex < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index(:users, [:state, :user_type], where: 'ghost IS NOT TRUE', name: 'index_users_on_state_and_user_type_internal')
remove_concurrent_index_by_name(:users, 'index_users_on_state_and_internal_ee')
remove_concurrent_index_by_name(:users, 'index_users_on_state_and_internal')
end
def down
add_concurrent_index(:users, :state, where: 'ghost IS NOT TRUE AND bot_type IS NULL', name: 'index_users_on_state_and_internal_ee')
add_concurrent_index(:users, :state, where: 'ghost IS NOT TRUE', name: 'index_users_on_state_and_internal')
remove_concurrent_index_by_name(:users, 'index_users_on_state_and_internal_ee')
end
end
Loading
Loading
@@ -738,6 +738,18 @@ ActiveRecord::Schema.define(version: 2020_03_13_123934) do
t.index ["build_id"], name: "index_ci_builds_runner_session_on_build_id", unique: true
end
 
create_table "ci_daily_report_results", force: :cascade do |t|
t.date "date", null: false
t.bigint "project_id", null: false
t.bigint "last_pipeline_id", null: false
t.float "value", null: false
t.bigint "param_type", null: false
t.string "ref_path", null: false
t.string "title", null: false
t.index ["last_pipeline_id"], name: "index_ci_daily_report_results_on_last_pipeline_id"
t.index ["project_id", "ref_path", "param_type", "date", "title"], name: "index_daily_report_results_unique_columns", unique: true
end
create_table "ci_group_variables", id: :serial, force: :cascade do |t|
t.string "key", null: false
t.text "value"
Loading
Loading
@@ -4419,9 +4431,8 @@ ActiveRecord::Schema.define(version: 2020_03_13_123934) do
t.index ["name"], name: "index_users_on_name_trigram", opclass: :gin_trgm_ops, using: :gin
t.index ["public_email"], name: "index_users_on_public_email", where: "((public_email)::text <> ''::text)"
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
t.index ["state", "user_type"], name: "index_users_on_state_and_user_type_internal", where: "(ghost IS NOT TRUE)"
t.index ["state"], name: "index_users_on_state"
t.index ["state"], name: "index_users_on_state_and_internal", where: "(ghost IS NOT TRUE)"
t.index ["state"], name: "index_users_on_state_and_internal_ee", where: "((ghost IS NOT TRUE) AND (bot_type IS NULL))"
t.index ["static_object_token"], name: "index_users_on_static_object_token", unique: true
t.index ["unconfirmed_email"], name: "index_users_on_unconfirmed_email", where: "(unconfirmed_email IS NOT NULL)"
t.index ["user_type"], name: "index_users_on_user_type"
Loading
Loading
@@ -4765,6 +4776,8 @@ ActiveRecord::Schema.define(version: 2020_03_13_123934) do
add_foreign_key "ci_builds_metadata", "ci_builds", column: "build_id", on_delete: :cascade
add_foreign_key "ci_builds_metadata", "projects", on_delete: :cascade
add_foreign_key "ci_builds_runner_session", "ci_builds", column: "build_id", on_delete: :cascade
add_foreign_key "ci_daily_report_results", "ci_pipelines", column: "last_pipeline_id", on_delete: :cascade
add_foreign_key "ci_daily_report_results", "projects", on_delete: :cascade
add_foreign_key "ci_group_variables", "namespaces", column: "group_id", name: "fk_33ae4d58d8", on_delete: :cascade
add_foreign_key "ci_job_artifacts", "ci_builds", column: "job_id", on_delete: :cascade
add_foreign_key "ci_job_artifacts", "projects", on_delete: :cascade
Loading
Loading
Loading
Loading
@@ -24,7 +24,7 @@ module Gitlab
end
 
def for_project_noteable?
!for_personal_snippet?
!for_personal_snippet? && !for_epic?
end
 
def skip_project_check?
Loading
Loading
Loading
Loading
@@ -21333,6 +21333,9 @@ msgstr ""
msgid "Undo"
msgstr ""
 
msgid "Undo Ignore"
msgstr ""
msgid "Undo ignore"
msgstr ""
 
Loading
Loading
Loading
Loading
@@ -132,6 +132,7 @@ describe 'Database schema' do
'Ci::Build' => %w[failure_reason],
'Ci::BuildMetadata' => %w[timeout_source],
'Ci::BuildTraceChunk' => %w[data_store],
'Ci::DailyReportResult' => %w[param_type],
'Ci::JobArtifact' => %w[file_type],
'Ci::Pipeline' => %w[source config_source failure_reason],
'Ci::Processable' => %w[failure_reason],
Loading
Loading
# frozen_string_literal: true
FactoryBot.define do
factory :ci_daily_report_result, class: 'Ci::DailyReportResult' do
ref_path { Gitlab::Git::BRANCH_REF_PREFIX + 'master' }
date { Time.zone.now.to_date }
project
last_pipeline factory: :ci_pipeline
param_type { Ci::DailyReportResult.param_types[:coverage] }
title { 'rspec' }
value { 77.0 }
end
end
Loading
Loading
@@ -24,7 +24,7 @@ FactoryBot.define do
end
 
trait :bot do
bot_type { User.bot_types[:alert_bot] }
user_type { :alert_bot }
end
 
trait :external do
Loading
Loading
import { shallowMount } from '@vue/test-utils';
import { GlButton } from '@gitlab/ui';
import ErrorTrackingActions from '~/error_tracking/components/error_tracking_actions.vue';
describe('Error Tracking Actions', () => {
let wrapper;
function mountComponent(props) {
wrapper = shallowMount(ErrorTrackingActions, {
propsData: {
error: {
id: '1',
title: 'PG::ConnectionBad: FATAL',
type: 'error',
userCount: 0,
count: '52',
firstSeen: '2019-05-30T07:21:46Z',
lastSeen: '2019-11-06T03:21:39Z',
status: 'unresolved',
},
...props,
},
stubs: { GlButton },
});
}
beforeEach(() => {
mountComponent();
});
afterEach(() => {
if (wrapper) {
wrapper.destroy();
}
});
const findButtons = () => wrapper.findAll(GlButton);
describe('when error status is unresolved', () => {
it('renders the correct actions buttons to allow ignore and resolve', () => {
expect(findButtons().exists()).toBe(true);
return wrapper.vm.$nextTick().then(() => {
expect(
findButtons()
.at(0)
.attributes('title'),
).toBe('Ignore');
expect(
findButtons()
.at(1)
.attributes('title'),
).toBe('Resolve');
});
});
});
describe('when error status is ignored', () => {
beforeEach(() => {
mountComponent({ error: { status: 'ignored' } });
});
it('renders the correct action button to undo ignore', () => {
expect(findButtons().exists()).toBe(true);
return wrapper.vm.$nextTick().then(() => {
expect(
findButtons()
.at(0)
.attributes('title'),
).toBe('Undo Ignore');
});
});
});
describe('when error status is resolved', () => {
beforeEach(() => {
mountComponent({ error: { status: 'resolved' } });
});
it('renders the correct action button to undo unresolve', () => {
expect(findButtons().exists()).toBe(true);
return wrapper.vm.$nextTick().then(() => {
expect(
findButtons()
.at(1)
.attributes('title'),
).toBe('Unresolve');
});
});
});
});
Loading
Loading
@@ -3,6 +3,7 @@ import Vuex from 'vuex';
import { GlEmptyState, GlLoadingIcon, GlFormInput, GlPagination, GlDropdown } from '@gitlab/ui';
import stubChildren from 'helpers/stub_children';
import ErrorTrackingList from '~/error_tracking/components/error_tracking_list.vue';
import ErrorTrackingActions from '~/error_tracking/components/error_tracking_actions.vue';
import errorsList from './list_mock.json';
 
const localVue = createLocalVue();
Loading
Loading
@@ -30,6 +31,7 @@ describe('ErrorTrackingList', () => {
.find(GlDropdown);
const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
const findPagination = () => wrapper.find(GlPagination);
const findErrorActions = () => wrapper.find(ErrorTrackingActions);
 
function mountComponent({
errorTrackingEnabled = true,
Loading
Loading
@@ -151,15 +153,9 @@ describe('ErrorTrackingList', () => {
});
});
 
it('each error in the list should have an ignore button', () => {
it('each error in the list should have an action button set', () => {
findErrorListRows().wrappers.forEach(row => {
expect(row.contains('glicon-stub[name="eye-slash"]')).toBe(true);
});
});
it('each error in the list should have a resolve button', () => {
findErrorListRows().wrappers.forEach(row => {
expect(row.contains('glicon-stub[name="check-circle"]')).toBe(true);
expect(row.contains(ErrorTrackingActions)).toBe(true);
});
});
 
Loading
Loading
@@ -237,8 +233,6 @@ describe('ErrorTrackingList', () => {
});
 
describe('When the ignore button on an error is clicked', () => {
const ignoreErrorButton = () => wrapper.find({ ref: 'ignoreError' });
beforeEach(() => {
store.state.list.loading = false;
store.state.list.errors = errorsList;
Loading
Loading
@@ -253,7 +247,10 @@ describe('ErrorTrackingList', () => {
});
 
it('sends the "ignored" status and error ID', () => {
ignoreErrorButton().trigger('click');
findErrorActions().vm.$emit('update-issue-status', {
errorId: errorsList[0].id,
status: 'ignored',
});
expect(actions.updateStatus).toHaveBeenCalledWith(
expect.anything(),
{
Loading
Loading
@@ -265,7 +262,7 @@ describe('ErrorTrackingList', () => {
});
 
it('calls an action to remove the item from the list', () => {
ignoreErrorButton().trigger('click');
findErrorActions().vm.$emit('update-issue-status', { errorId: '1', status: undefined });
expect(actions.removeIgnoredResolvedErrors).toHaveBeenCalledWith(
expect.anything(),
'1',
Loading
Loading
@@ -275,8 +272,6 @@ describe('ErrorTrackingList', () => {
});
 
describe('When the resolve button on an error is clicked', () => {
const resolveErrorButton = () => wrapper.find({ ref: 'resolveError' });
beforeEach(() => {
store.state.list.loading = false;
store.state.list.errors = errorsList;
Loading
Loading
@@ -291,7 +286,10 @@ describe('ErrorTrackingList', () => {
});
 
it('sends "resolved" status and error ID', () => {
resolveErrorButton().trigger('click');
findErrorActions().vm.$emit('update-issue-status', {
errorId: errorsList[0].id,
status: 'resolved',
});
expect(actions.updateStatus).toHaveBeenCalledWith(
expect.anything(),
{
Loading
Loading
@@ -303,7 +301,7 @@ describe('ErrorTrackingList', () => {
});
 
it('calls an action to remove the item from the list', () => {
resolveErrorButton().trigger('click');
findErrorActions().vm.$emit('update-issue-status', { errorId: '1', status: undefined });
expect(actions.removeIgnoredResolvedErrors).toHaveBeenCalledWith(
expect.anything(),
'1',
Loading
Loading
Loading
Loading
@@ -6,7 +6,8 @@
"userCount": 0,
"count": "52",
"firstSeen": "2019-05-30T07:21:46Z",
"lastSeen": "2019-11-06T03:21:39Z"
"lastSeen": "2019-11-06T03:21:39Z",
"status": "unresolved"
},
{
"id": "2",
Loading
Loading
@@ -15,7 +16,8 @@
"userCount": 0,
"count": "12",
"firstSeen": "2019-10-19T03:53:56Z",
"lastSeen": "2019-11-05T03:51:54Z"
"lastSeen": "2019-11-05T03:51:54Z",
"status": "unresolved"
},
{
"id": "3",
Loading
Loading
@@ -24,6 +26,7 @@
"userCount": 0,
"count": "275",
"firstSeen": "2019-02-12T07:22:36Z",
"lastSeen": "2019-10-22T03:20:48Z"
"lastSeen": "2019-10-22T03:20:48Z",
"status": "unresolved"
}
]
\ No newline at end of file
Loading
Loading
@@ -12,6 +12,7 @@ describe Gitlab::BackgroundMigration::UserMentions::CreateResourceUserMention, s
let(:namespaces) { table(:namespaces) }
let(:projects) { table(:projects) }
let(:notes) { table(:notes) }
let(:routes) { table(:routes) }
 
let(:author) { users.create!(email: 'author@example.com', notification_email: 'author@example.com', name: 'author', username: 'author', projects_limit: 10, state: 'active') }
let(:member) { users.create!(email: 'member@example.com', notification_email: 'member@example.com', name: 'member', username: 'member', projects_limit: 10, state: 'active') }
Loading
Loading
@@ -32,13 +33,14 @@ describe Gitlab::BackgroundMigration::UserMentions::CreateResourceUserMention, s
 
before do
# build personal namespaces and routes for users
mentioned_users.each { |u| u.becomes(User).save! }
mentioned_users.each do |u|
namespace = namespaces.create!(path: u.username, name: u.name, runners_token: "my-token-u#{u.id}", owner_id: u.id, type: nil)
routes.create!(path: namespace.path, source_type: 'Namespace', source_id: namespace.id)
end
 
# build namespaces and routes for groups
mentioned_groups.each do |gr|
gr.name += '-org'
gr.path += '-org'
gr.becomes(Namespace).save!
routes.create!(path: gr.path, source_type: 'Namespace', source_id: gr.id)
end
end
 
Loading
Loading
# frozen_string_literal: true
 
require 'spec_helper'
require 'lib/gitlab/cycle_analytics/shared_event_spec'
 
describe Gitlab::CycleAnalytics::CodeEventFetcher do
let(:stage_name) { :code }
Loading
Loading
# frozen_string_literal: true
 
require 'spec_helper'
require 'lib/gitlab/cycle_analytics/shared_stage_spec'
 
describe Gitlab::CycleAnalytics::CodeStage do
let(:stage_name) { :code }
Loading
Loading
# frozen_string_literal: true
 
require 'spec_helper'
require 'lib/gitlab/cycle_analytics/shared_event_spec'
 
describe Gitlab::CycleAnalytics::IssueEventFetcher do
let(:stage_name) { :issue }
Loading
Loading
# frozen_string_literal: true
 
require 'spec_helper'
require 'lib/gitlab/cycle_analytics/shared_stage_spec'
 
describe Gitlab::CycleAnalytics::IssueStage do
let(:stage_name) { :issue }
Loading
Loading
# frozen_string_literal: true
 
require 'spec_helper'
require 'lib/gitlab/cycle_analytics/shared_event_spec'
 
describe Gitlab::CycleAnalytics::PlanEventFetcher do
let(:stage_name) { :plan }
Loading
Loading
# frozen_string_literal: true
 
require 'spec_helper'
require 'lib/gitlab/cycle_analytics/shared_stage_spec'
 
describe Gitlab::CycleAnalytics::PlanStage do
let(:stage_name) { :plan }
Loading
Loading
# frozen_string_literal: true
 
require 'spec_helper'
require 'lib/gitlab/cycle_analytics/shared_event_spec'
 
describe Gitlab::CycleAnalytics::ProductionEventFetcher do
let(:stage_name) { :production }
Loading
Loading
# frozen_string_literal: true
 
require 'spec_helper'
require 'lib/gitlab/cycle_analytics/shared_stage_spec'
 
describe Gitlab::CycleAnalytics::ProductionStage do
let(:stage_name) { 'Total' }
Loading
Loading
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