Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-05 15:08:24 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-05 15:08:24 +0300
commit38b39c50473ba58a80ddad5c22c96ccd5128ddfb (patch)
tree21a3dc9f9ab12f079f4f791f40ba175b872394ef /spec/frontend/monitoring
parent963838b90c1c121d16ec43353a4e0d44450664cf (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/monitoring')
-rw-r--r--spec/frontend/monitoring/store/utils_spec.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/frontend/monitoring/store/utils_spec.js b/spec/frontend/monitoring/store/utils_spec.js
index 02cdd3d7f41..6ba75cd984c 100644
--- a/spec/frontend/monitoring/store/utils_spec.js
+++ b/spec/frontend/monitoring/store/utils_spec.js
@@ -5,6 +5,7 @@ import {
parseAnnotationsResponse,
removeLeadingSlash,
mapToDashboardViewModel,
+ normalizeQueryResult,
} from '~/monitoring/stores/utils';
import { annotationsData } from '../mock_data';
import { NOT_IN_DB_PREFIX } from '~/monitoring/constants';
@@ -397,6 +398,28 @@ describe('mapToDashboardViewModel', () => {
});
});
+describe('normalizeQueryResult', () => {
+ const testData = {
+ metric: {
+ __name__: 'up',
+ job: 'prometheus',
+ instance: 'localhost:9090',
+ },
+ values: [[1435781430.781, '1'], [1435781445.781, '1'], [1435781460.781, '1']],
+ };
+
+ it('processes a simple matrix result', () => {
+ expect(normalizeQueryResult(testData)).toEqual({
+ metric: { __name__: 'up', job: 'prometheus', instance: 'localhost:9090' },
+ values: [
+ ['2015-07-01T20:10:30.781Z', 1],
+ ['2015-07-01T20:10:45.781Z', 1],
+ ['2015-07-01T20:11:00.781Z', 1],
+ ],
+ });
+ });
+});
+
describe('uniqMetricsId', () => {
[
{ input: { id: 1 }, expected: `${NOT_IN_DB_PREFIX}_1` },