diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-09 21:08:21 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-09 21:08:21 +0000 |
commit | 64786982930713d095ccd3aebd812182a1879fed (patch) | |
tree | 542e79df02f79049d8a63b31388c7d1e3e3b9166 /spec/frontend/clusters_list/components | |
parent | 3d0474695407d24d49bb94f29a182739ee35e1f8 (diff) | |
download | gitlab-ce-64786982930713d095ccd3aebd812182a1879fed.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/clusters_list/components')
-rw-r--r-- | spec/frontend/clusters_list/components/clusters_spec.js | 62 |
1 files changed, 60 insertions, 2 deletions
diff --git a/spec/frontend/clusters_list/components/clusters_spec.js b/spec/frontend/clusters_list/components/clusters_spec.js index 9f76078a69a..3a5c4c4c008 100644 --- a/spec/frontend/clusters_list/components/clusters_spec.js +++ b/spec/frontend/clusters_list/components/clusters_spec.js @@ -5,6 +5,7 @@ import MockAdapter from 'axios-mock-adapter'; import { apiData } from '../mock_data'; import { mount } from '@vue/test-utils'; import { GlLoadingIcon, GlTable, GlPagination } from '@gitlab/ui'; +import * as Sentry from '@sentry/browser'; describe('Clusters', () => { let mock; @@ -36,7 +37,11 @@ describe('Clusters', () => { }; }; + let captureException; + beforeEach(() => { + captureException = jest.spyOn(Sentry, 'captureException'); + mock = new MockAdapter(axios); mockPollingApi(200, apiData, paginationHeader()); @@ -46,6 +51,7 @@ describe('Clusters', () => { afterEach(() => { wrapper.destroy(); mock.restore(); + captureException.mockRestore(); }); describe('clusters table', () => { @@ -106,8 +112,8 @@ describe('Clusters', () => { ${'Unknown'} | ${0} ${'1'} | ${1} ${'2'} | ${2} - ${'Unknown'} | ${3} - ${'Unknown'} | ${4} + ${'1'} | ${3} + ${'1'} | ${4} ${'Unknown'} | ${5} `('renders node size for each cluster', ({ nodeSize, lineNumber }) => { const sizes = findTable().findAll('td:nth-child(3)'); @@ -115,6 +121,58 @@ describe('Clusters', () => { expect(size.text()).toBe(nodeSize); }); + + describe('nodes with unknown quantity', () => { + it('notifies Sentry about all missing quantity types', () => { + expect(captureException).toHaveBeenCalledTimes(8); + }); + + it('notifies Sentry about CPU missing quantity types', () => { + const missingCpuTypeError = new Error('UnknownK8sCpuQuantity:1missingCpuUnit'); + + expect(captureException).toHaveBeenCalledWith(missingCpuTypeError); + }); + + it('notifies Sentry about Memory missing quantity types', () => { + const missingMemoryTypeError = new Error('UnknownK8sMemoryQuantity:1missingMemoryUnit'); + + expect(captureException).toHaveBeenCalledWith(missingMemoryTypeError); + }); + }); + }); + + describe('cluster CPU', () => { + it.each` + clusterCpu | lineNumber + ${''} | ${0} + ${'1.93 (87% free)'} | ${1} + ${'3.87 (86% free)'} | ${2} + ${'(% free)'} | ${3} + ${'(% free)'} | ${4} + ${''} | ${5} + `('renders total cpu for each cluster', ({ clusterCpu, lineNumber }) => { + const clusterCpus = findTable().findAll('td:nth-child(4)'); + const cpuData = clusterCpus.at(lineNumber); + + expect(cpuData.text()).toBe(clusterCpu); + }); + }); + + describe('cluster Memory', () => { + it.each` + clusterMemory | lineNumber + ${''} | ${0} + ${'5.92 (78% free)'} | ${1} + ${'12.86 (79% free)'} | ${2} + ${'(% free)'} | ${3} + ${'(% free)'} | ${4} + ${''} | ${5} + `('renders total memory for each cluster', ({ clusterMemory, lineNumber }) => { + const clusterMemories = findTable().findAll('td:nth-child(5)'); + const memoryData = clusterMemories.at(lineNumber); + + expect(memoryData.text()).toBe(clusterMemory); + }); }); describe('pagination', () => { |