Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-11-26 00:14:05 +00:00
parent c592490e7f
commit 118b785094
12 changed files with 79 additions and 30 deletions

View file

@ -0,0 +1,9 @@
# frozen_string_literal: true
class AddPolicyIdxToApprovalProjectRule < Gitlab::Database::Migration[1.0]
enable_lock_retries!
def change
add_column :approval_project_rules, :orchestration_policy_idx, :integer, limit: 2
end
end

View file

@ -0,0 +1,9 @@
# frozen_string_literal: true
class AddPolicyIdxToApprovalMergeRequestRule < Gitlab::Database::Migration[1.0]
enable_lock_retries!
def change
add_column :approval_merge_request_rules, :orchestration_policy_idx, :integer, limit: 2
end
end

View file

@ -0,0 +1,17 @@
# frozen_string_literal: true
class ChangeNamespaceTypeDefaultToUser < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
def up
with_lock_retries do
change_column_default :namespaces, :type, 'User'
end
end
def down
with_lock_retries do
change_column_default :namespaces, :type, nil
end
end
end

View file

@ -0,0 +1 @@
9e01b1817e4c578f5be7d7378dc12a8535c2bbbff5ecbc77f5a7cfdb148927f5

View file

@ -0,0 +1 @@
d71889bba2150265e9482be0b5ee89f43168d4a35b47469a36873d65f00df878

View file

@ -0,0 +1 @@
fc29e10717357f7dd57940042d69a6c43a0d17fdf3c951917a76eae8c1d93ba3

View file

@ -10547,6 +10547,7 @@ CREATE TABLE approval_merge_request_rules (
report_type smallint,
section text,
modified_from_project_rule boolean DEFAULT false NOT NULL,
orchestration_policy_idx smallint,
CONSTRAINT check_6fca5928b2 CHECK ((char_length(section) <= 255))
);
@ -10616,7 +10617,8 @@ CREATE TABLE approval_project_rules (
vulnerabilities_allowed smallint DEFAULT 0 NOT NULL,
severity_levels text[] DEFAULT '{}'::text[] NOT NULL,
report_type smallint,
vulnerability_states text[] DEFAULT '{newly_detected}'::text[] NOT NULL
vulnerability_states text[] DEFAULT '{newly_detected}'::text[] NOT NULL,
orchestration_policy_idx smallint
);
CREATE TABLE approval_project_rules_groups (
@ -16353,7 +16355,7 @@ CREATE TABLE namespaces (
owner_id integer,
created_at timestamp without time zone,
updated_at timestamp without time zone,
type character varying,
type character varying DEFAULT 'User'::character varying,
description character varying DEFAULT ''::character varying NOT NULL,
avatar character varying,
membership_lock boolean DEFAULT false,

View file

@ -663,8 +663,6 @@ module Gitlab
end
def redis_hll_counters
return {} unless Feature.enabled?(:redis_hll_tracking, type: :ops, default_enabled: :yaml)
{ redis_hll_counters: ::Gitlab::UsageDataCounters::HLLRedisCounter.unique_events_data }
end

View file

@ -38576,9 +38576,6 @@ msgstr ""
msgid "VulnerabilityManagement|Create Jira issue"
msgstr ""
msgid "VulnerabilityManagement|Detected"
msgstr ""
msgid "VulnerabilityManagement|Fetching linked Jira issues"
msgstr ""
@ -38594,6 +38591,9 @@ msgstr ""
msgid "VulnerabilityManagement|Related Jira issues"
msgstr ""
msgid "VulnerabilityManagement|Requires assessment"
msgstr ""
msgid "VulnerabilityManagement|Something went wrong while trying to delete the comment. Please try again later."
msgstr ""
@ -38639,10 +38639,10 @@ msgstr ""
msgid "VulnerabilityStatusTypes|Confirmed"
msgstr ""
msgid "VulnerabilityStatusTypes|Detected"
msgid "VulnerabilityStatusTypes|Dismissed"
msgstr ""
msgid "VulnerabilityStatusTypes|Dismissed"
msgid "VulnerabilityStatusTypes|Needs triage"
msgstr ""
msgid "VulnerabilityStatusTypes|Resolved"

View file

@ -1402,33 +1402,21 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
let(:categories) { ::Gitlab::UsageDataCounters::HLLRedisCounter.categories }
context 'with redis_hll_tracking feature enabled' do
it 'has all known_events' do
stub_feature_flags(redis_hll_tracking: true)
it 'has all known_events' do
expect(subject).to have_key(:redis_hll_counters)
expect(subject).to have_key(:redis_hll_counters)
expect(subject[:redis_hll_counters].keys).to match_array(categories)
expect(subject[:redis_hll_counters].keys).to match_array(categories)
categories.each do |category|
keys = ::Gitlab::UsageDataCounters::HLLRedisCounter.events_for_category(category)
categories.each do |category|
keys = ::Gitlab::UsageDataCounters::HLLRedisCounter.events_for_category(category)
metrics = keys.map { |key| "#{key}_weekly" } + keys.map { |key| "#{key}_monthly" }
metrics = keys.map { |key| "#{key}_weekly" } + keys.map { |key| "#{key}_monthly" }
if ::Gitlab::UsageDataCounters::HLLRedisCounter::CATEGORIES_FOR_TOTALS.include?(category)
metrics.append("#{category}_total_unique_counts_weekly", "#{category}_total_unique_counts_monthly")
end
expect(subject[:redis_hll_counters][category].keys).to match_array(metrics)
if ::Gitlab::UsageDataCounters::HLLRedisCounter::CATEGORIES_FOR_TOTALS.include?(category)
metrics.append("#{category}_total_unique_counts_weekly", "#{category}_total_unique_counts_monthly")
end
end
end
context 'with redis_hll_tracking disabled' do
it 'does not have redis_hll_tracking key' do
stub_feature_flags(redis_hll_tracking: false)
expect(subject).not_to have_key(:redis_hll_counters)
expect(subject[:redis_hll_counters][category].keys).to match_array(metrics)
end
end
end

View file

@ -0,0 +1,22 @@
# frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.describe ChangeNamespaceTypeDefaultToUser do
let(:namespaces) { table(:namespaces) }
it 'defaults type to User' do
some_namespace1 = namespaces.create!(name: 'magic namespace1', path: 'magicnamespace1', type: nil)
expect(some_namespace1.reload.type).to be_nil
migrate!
some_namespace2 = namespaces.create!(name: 'magic namespace2', path: 'magicnamespace2', type: nil)
expect(some_namespace1.reload.type).to be_nil
expect(some_namespace2.reload.type).to eq 'User'
end
end

View file

@ -9,6 +9,7 @@ RSpec.describe CaseSensitivity do
Class.new(ActiveRecord::Base) do
include CaseSensitivity
self.table_name = 'namespaces'
self.inheritance_column = :_type_disabled
end
end