Commit 3ed12ee6 authored by allison.browne's avatar allison.browne Committed by Ash McKenzie

Change oids to primary_keys

parent dcc3b50c
...@@ -16,7 +16,7 @@ module Clusters ...@@ -16,7 +16,7 @@ module Clusters
idempotent! idempotent!
def perform def perform
demo_project_ids = Gitlab::Monitor::DemoProjects.oids demo_project_ids = Gitlab::Monitor::DemoProjects.primary_keys
clusters = Clusters::Cluster.with_application_prometheus clusters = Clusters::Cluster.with_application_prometheus
.with_project_alert_service_data(demo_project_ids) .with_project_alert_service_data(demo_project_ids)
......
...@@ -5283,8 +5283,7 @@ CREATE TABLE public.project_settings ( ...@@ -5283,8 +5283,7 @@ CREATE TABLE public.project_settings (
created_at timestamp with time zone NOT NULL, created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL,
push_rule_id bigint, push_rule_id bigint,
show_default_award_emojis boolean DEFAULT true, show_default_award_emojis boolean DEFAULT true NOT NULL
CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL))
); );
CREATE TABLE public.project_statistics ( CREATE TABLE public.project_statistics (
......
...@@ -6,7 +6,7 @@ module Gitlab ...@@ -6,7 +6,7 @@ module Gitlab
DOT_COM_IDS = [14986497, 12507547].freeze DOT_COM_IDS = [14986497, 12507547].freeze
STAGING_IDS = [4422333].freeze STAGING_IDS = [4422333].freeze
def self.oids def self.primary_keys
if ::Gitlab.com? if ::Gitlab.com?
DOT_COM_IDS DOT_COM_IDS
elsif ::Gitlab.staging? elsif ::Gitlab.staging?
......
...@@ -3,22 +3,22 @@ ...@@ -3,22 +3,22 @@
require 'spec_helper' require 'spec_helper'
describe Gitlab::Monitor::DemoProjects do describe Gitlab::Monitor::DemoProjects do
describe '#oids' do describe '#primary_keys' do
subject { described_class.oids } subject { described_class.primary_keys }
it 'fetches oids when in test env' do it 'fetches primary_keys when in test env' do
project = create(:project) project = create(:project)
expect(subject).to eq([project.id]) expect(subject).to eq([project.id])
end end
it 'fetches oids when on gitlab.com' do it 'fetches primary_keys when on gitlab.com' do
expect(Gitlab).to receive(:'com?').and_return(true) expect(Gitlab).to receive(:'com?').and_return(true)
expect(subject).to eq(Gitlab::Monitor::DemoProjects::DOT_COM_IDS) expect(subject).to eq(Gitlab::Monitor::DemoProjects::DOT_COM_IDS)
end end
it 'fetches oids when on staging' do it 'fetches primary_keys when on staging' do
expect(Gitlab).to receive(:staging?).and_return(true) expect(Gitlab).to receive(:staging?).and_return(true)
expect(subject).to eq(Gitlab::Monitor::DemoProjects::STAGING_IDS) expect(subject).to eq(Gitlab::Monitor::DemoProjects::STAGING_IDS)
......
...@@ -7,7 +7,7 @@ describe Clusters::Applications::CheckPrometheusHealthWorker, '#perform' do ...@@ -7,7 +7,7 @@ describe Clusters::Applications::CheckPrometheusHealthWorker, '#perform' do
it 'triggers health service' do it 'triggers health service' do
cluster = create(:cluster) cluster = create(:cluster)
allow(Gitlab::Monitor::DemoProjects).to receive(:oids) allow(Gitlab::Monitor::DemoProjects).to receive(:primary_keys)
allow(Clusters::Cluster).to receive(:with_application_prometheus).and_return(double(with_project_alert_service_data: [cluster])) allow(Clusters::Cluster).to receive(:with_application_prometheus).and_return(double(with_project_alert_service_data: [cluster]))
service_instance = instance_double(Clusters::Applications::PrometheusHealthCheckService) service_instance = instance_double(Clusters::Applications::PrometheusHealthCheckService)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment