From 3b1af5cc7ed2666ff18b718ce5d30fa5a2756674 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 20 Jun 2023 10:43:29 +0000 Subject: Add latest changes from gitlab-org/gitlab@16-1-stable-ee --- spec/db/development/import_common_metrics_spec.rb | 15 --------------- spec/db/production/import_common_metrics_spec.rb | 15 --------------- spec/db/schema_spec.rb | 13 +++++++------ 3 files changed, 7 insertions(+), 36 deletions(-) delete mode 100644 spec/db/development/import_common_metrics_spec.rb delete mode 100644 spec/db/production/import_common_metrics_spec.rb (limited to 'spec/db') diff --git a/spec/db/development/import_common_metrics_spec.rb b/spec/db/development/import_common_metrics_spec.rb deleted file mode 100644 index 396eae9293e..00000000000 --- a/spec/db/development/import_common_metrics_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'Import metrics on development seed' do - subject { load Rails.root.join('db', 'fixtures', 'development', '99_common_metrics.rb') } - - it "imports all prometheus metrics" do - expect(PrometheusMetric.common).to be_empty - - subject - - expect(PrometheusMetric.common).not_to be_empty - end -end diff --git a/spec/db/production/import_common_metrics_spec.rb b/spec/db/production/import_common_metrics_spec.rb deleted file mode 100644 index 1cc0c2fd77f..00000000000 --- a/spec/db/production/import_common_metrics_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'Import metrics on production seed' do - subject { load Rails.root.join('db', 'fixtures', 'production', '999_common_metrics.rb') } - - it "imports all prometheus metrics" do - expect(PrometheusMetric.common).to be_empty - - subject - - expect(PrometheusMetric.common).not_to be_empty - end -end diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb index 9f228c75127..4ec6d3ad4f5 100644 --- a/spec/db/schema_spec.rb +++ b/spec/db/schema_spec.rb @@ -13,7 +13,8 @@ RSpec.describe 'Database schema', feature_category: :database do # `search_index_id index_type` is the composite foreign key configured for `search_namespace_index_assignments`, # but in Search::NamespaceIndexAssignment model, only `search_index_id` is used as foreign key and indexed search_namespace_index_assignments: [%w[search_index_id index_type]], - slack_integrations_scopes: [%w[slack_api_scope_id]] + slack_integrations_scopes: [%w[slack_api_scope_id]], + namespaces: %w[organization_id] # this index is added in an async manner, hence it needs to be ignored in the first phase. }.with_indifferent_access.freeze TABLE_PARTITIONS = %w[ci_builds_metadata].freeze @@ -86,7 +87,7 @@ RSpec.describe 'Database schema', feature_category: :database do oauth_access_grants: %w[resource_owner_id application_id], oauth_access_tokens: %w[resource_owner_id application_id], oauth_applications: %w[owner_id], - p_ci_runner_machine_builds: %w[partition_id build_id], + p_ci_builds: %w[project_id runner_id user_id erased_by_id trigger_request_id partition_id], product_analytics_events_experimental: %w[event_id txn_id user_id], project_build_artifacts_size_refreshes: %w[last_job_artifact_id], project_data_transfers: %w[project_id namespace_id], @@ -205,7 +206,6 @@ RSpec.describe 'Database schema', feature_category: :database do 'Clusters::Cluster' => %w[platform_type provider_type], 'CommitStatus' => %w[failure_reason], 'GenericCommitStatus' => %w[failure_reason], - 'Gitlab::DatabaseImporters::CommonMetrics::PrometheusMetric' => %w[group], 'InternalId' => %w[usage], 'List' => %w[list_type], 'NotificationSetting' => %w[level], @@ -247,8 +247,7 @@ RSpec.describe 'Database schema', feature_category: :database do "Packages::Composer::Metadatum" => %w[composer_json], "RawUsageData" => %w[payload], # Usage data payload changes often, we cannot use one schema "Releases::Evidence" => %w[summary], - "Vulnerabilities::Finding::Evidence" => %w[data], # Validation work in progress - "EE::Gitlab::BackgroundMigration::FixSecurityScanStatuses::SecurityScan" => %w[info] # This is a migration model + "Vulnerabilities::Finding::Evidence" => %w[data] # Validation work in progress }.freeze # We are skipping GEO models for now as it adds up complexity @@ -258,8 +257,10 @@ RSpec.describe 'Database schema', feature_category: :database do next if models_by_table_name[hash["table_name"]].nil? models_by_table_name[hash["table_name"]].each do |model| - jsonb_columns = [hash["column_name"]] - ignored_jsonb_columns(model.name) + # Skip migration models + next if model.name.include?('Gitlab::BackgroundMigration') + jsonb_columns = [hash["column_name"]] - ignored_jsonb_columns(model.name) expect(model).to validate_jsonb_schema(jsonb_columns) end end -- cgit v1.2.3