summaryrefslogtreecommitdiff
path: root/spec/frontend/monitoring/components
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/monitoring/components')
-rw-r--r--spec/frontend/monitoring/components/__snapshots__/dashboard_template_spec.js.snap1
-rw-r--r--spec/frontend/monitoring/components/charts/time_series_spec.js8
-rw-r--r--spec/frontend/monitoring/components/dashboard_panel_spec.js26
-rw-r--r--spec/frontend/monitoring/components/dashboard_spec.js44
-rw-r--r--spec/frontend/monitoring/components/dashboard_url_time_spec.js2
5 files changed, 54 insertions, 27 deletions
diff --git a/spec/frontend/monitoring/components/__snapshots__/dashboard_template_spec.js.snap b/spec/frontend/monitoring/components/__snapshots__/dashboard_template_spec.js.snap
index 98503636d33..08f9e07244f 100644
--- a/spec/frontend/monitoring/components/__snapshots__/dashboard_template_spec.js.snap
+++ b/spec/frontend/monitoring/components/__snapshots__/dashboard_template_spec.js.snap
@@ -7,7 +7,6 @@ exports[`Dashboard template matches the default snapshot 1`] = `
environmentstate="available"
metricsdashboardbasepath="/monitoring/monitor-project/-/environments/1/metrics"
metricsendpoint="/monitoring/monitor-project/-/environments/1/additional_metrics.json"
- prometheusstatus=""
>
<alerts-deprecation-warning-stub />
diff --git a/spec/frontend/monitoring/components/charts/time_series_spec.js b/spec/frontend/monitoring/components/charts/time_series_spec.js
index afa63bcff29..754ddd96c9b 100644
--- a/spec/frontend/monitoring/components/charts/time_series_spec.js
+++ b/spec/frontend/monitoring/components/charts/time_series_spec.js
@@ -208,7 +208,7 @@ describe('Time series component', () => {
});
it('formats tooltip title', () => {
- expect(wrapper.vm.tooltip.title).toBe('16 Jul 2019, 10:14AM (GMT+0000)');
+ expect(wrapper.vm.tooltip.title).toBe('16 Jul 2019, 10:14AM (UTC)');
});
it('formats tooltip content', () => {
@@ -282,7 +282,7 @@ describe('Time series component', () => {
});
it('formats tooltip title', () => {
- expect(wrapper.vm.tooltip.title).toBe('16 Jul 2019, 10:14AM (GMT+0000)');
+ expect(wrapper.vm.tooltip.title).toBe('16 Jul 2019, 10:14AM (UTC)');
});
it('formats tooltip sha', () => {
@@ -301,7 +301,7 @@ describe('Time series component', () => {
});
it('formats tooltip title', () => {
- expect(wrapper.vm.tooltip.title).toBe('16 Jul 2019, 10:14AM (GMT+0000)');
+ expect(wrapper.vm.tooltip.title).toBe('16 Jul 2019, 10:14AM (UTC)');
});
it('formats tooltip sha', () => {
@@ -334,7 +334,7 @@ describe('Time series component', () => {
it('formats tooltip title and sets tooltip content', () => {
const formattedTooltipData = wrapper.vm.formatAnnotationsTooltipText(mockMarkPoint);
- expect(formattedTooltipData.title).toBe('19 Feb 2020, 10:01AM (GMT+0000)');
+ expect(formattedTooltipData.title).toBe('19 Feb 2020, 10:01AM (UTC)');
expect(formattedTooltipData.content).toBe(annotationsMetadata.tooltipData.content);
});
});
diff --git a/spec/frontend/monitoring/components/dashboard_panel_spec.js b/spec/frontend/monitoring/components/dashboard_panel_spec.js
index a72dbbd0f41..c8951dff9ed 100644
--- a/spec/frontend/monitoring/components/dashboard_panel_spec.js
+++ b/spec/frontend/monitoring/components/dashboard_panel_spec.js
@@ -778,5 +778,31 @@ describe('Dashboard Panel', () => {
expect(findRunbookLinks().at(0).attributes('href')).toBe(invalidUrl);
});
});
+
+ describe('managed alert deprecation feature flag', () => {
+ beforeEach(() => {
+ setMetricsSavedToDb([metricId]);
+ });
+
+ it('shows alerts when alerts are not deprecated', () => {
+ createWrapper(
+ { alertsEndpoint: '/endpoint', prometheusAlertsAvailable: true },
+ { provide: { glFeatures: { managedAlertsDeprecation: false } } },
+ );
+
+ expect(findAlertsWidget().exists()).toBe(true);
+ expect(findMenuItemByText('Alerts').exists()).toBe(true);
+ });
+
+ it('hides alerts when alerts are deprecated', () => {
+ createWrapper(
+ { alertsEndpoint: '/endpoint', prometheusAlertsAvailable: true },
+ { provide: { glFeatures: { managedAlertsDeprecation: true } } },
+ );
+
+ expect(findAlertsWidget().exists()).toBe(false);
+ expect(findMenuItemByText('Alerts').exists()).toBe(false);
+ });
+ });
});
});
diff --git a/spec/frontend/monitoring/components/dashboard_spec.js b/spec/frontend/monitoring/components/dashboard_spec.js
index 0c2f85c7298..7ca1b97d849 100644
--- a/spec/frontend/monitoring/components/dashboard_spec.js
+++ b/spec/frontend/monitoring/components/dashboard_spec.js
@@ -1,9 +1,8 @@
-import { GlAlert } from '@gitlab/ui';
-import { shallowMount, mount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter';
import VueDraggable from 'vuedraggable';
import { TEST_HOST } from 'helpers/test_constants';
-import { deprecatedCreateFlash as createFlash } from '~/flash';
+import { mountExtended, shallowMountExtended } from 'helpers/vue_test_utils_helper';
+import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import { ESC_KEY } from '~/lib/utils/keys';
import { objectToQuery } from '~/lib/utils/url_utility';
@@ -17,7 +16,6 @@ import LinksSection from '~/monitoring/components/links_section.vue';
import { dashboardEmptyStates, metricStates } from '~/monitoring/constants';
import { createStore } from '~/monitoring/stores';
import * as types from '~/monitoring/stores/mutation_types';
-import AlertDeprecationWarning from '~/vue_shared/components/alerts_deprecation_warning.vue';
import {
metricsDashboardViewModel,
metricsDashboardPanelCount,
@@ -41,7 +39,7 @@ describe('Dashboard', () => {
let mock;
const createShallowWrapper = (props = {}, options = {}) => {
- wrapper = shallowMount(Dashboard, {
+ wrapper = shallowMountExtended(Dashboard, {
propsData: { ...dashboardProps, ...props },
store,
stubs: {
@@ -53,7 +51,7 @@ describe('Dashboard', () => {
};
const createMountedWrapper = (props = {}, options = {}) => {
- wrapper = mount(Dashboard, {
+ wrapper = mountExtended(Dashboard, {
propsData: { ...dashboardProps, ...props },
store,
stubs: {
@@ -818,24 +816,28 @@ describe('Dashboard', () => {
});
});
- describe('deprecation notice', () => {
+ describe('alerts deprecation', () => {
beforeEach(() => {
setupStoreWithData(store);
});
- const findDeprecationNotice = () =>
- wrapper.find(AlertDeprecationWarning).findComponent(GlAlert);
-
- it('shows the deprecation notice when available', () => {
- createMountedWrapper({}, { provide: { hasManagedPrometheus: true } });
-
- expect(findDeprecationNotice().exists()).toBe(true);
- });
-
- it('hides the deprecation notice when not available', () => {
- createMountedWrapper();
-
- expect(findDeprecationNotice().exists()).toBe(false);
- });
+ const findDeprecationNotice = () => wrapper.findByTestId('alerts-deprecation-warning');
+
+ it.each`
+ managedAlertsDeprecation | hasManagedPrometheus | isVisible
+ ${false} | ${false} | ${false}
+ ${false} | ${true} | ${true}
+ ${true} | ${false} | ${false}
+ ${true} | ${true} | ${false}
+ `(
+ 'when the deprecation feature flag is $managedAlertsDeprecation and has managed prometheus is $hasManagedPrometheus',
+ ({ hasManagedPrometheus, managedAlertsDeprecation, isVisible }) => {
+ createMountedWrapper(
+ {},
+ { provide: { hasManagedPrometheus, glFeatures: { managedAlertsDeprecation } } },
+ );
+ expect(findDeprecationNotice().exists()).toBe(isVisible);
+ },
+ );
});
});
diff --git a/spec/frontend/monitoring/components/dashboard_url_time_spec.js b/spec/frontend/monitoring/components/dashboard_url_time_spec.js
index 090613b0f1e..bea263f143a 100644
--- a/spec/frontend/monitoring/components/dashboard_url_time_spec.js
+++ b/spec/frontend/monitoring/components/dashboard_url_time_spec.js
@@ -1,6 +1,6 @@
import { mount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter';
-import { deprecatedCreateFlash as createFlash } from '~/flash';
+import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import {
queryToObject,