CN-894: 单测用例--用例更新
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -2,6 +2,10 @@ import NpmAppEventTable from '@/views/charts2/charts/npm/NpmAppEventTable'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import axios from 'axios'
|
||||
import ElementPlus from 'element-plus'
|
||||
import { mockData } from './mockData/NpmAppEventByTable'
|
||||
|
||||
let wrapper = null
|
||||
const mockGet = mockData.common.data
|
||||
|
||||
const timeFilter = {
|
||||
dateRangeValue: -1,
|
||||
@@ -9,22 +13,30 @@ const timeFilter = {
|
||||
endTime: 1675731457
|
||||
}
|
||||
|
||||
const mockGet = { data: { status: 200, code: 200, queryKey: '88eeb92e0ddb40c0327db494cfe5c74c', success: true, message: null, statistics: { elapsed: 0, rows_read: 2, result_size: 752, result_rows: 10 }, job: null, formatType: 'json', meta: [{ name: 'app_name', type: 'string', category: 'Dimension' }, { name: 'event_severity', type: 'string', category: 'Dimension' }, { name: 'event_type', type: 'string', category: 'Dimension' }, { name: 'count', type: 'long', category: 'Metric' }], data: { resultType: 'table', result: [{ appName: 'youku', eventSeverity: 'info', eventType: 'http error', count: 6 }, { appName: 'uplive', eventSeverity: 'critical', eventType: 'http error', count: 5 }, { appName: 'youku', eventSeverity: 'low', eventType: 'http error', count: 4 }, { appName: 'apple_hls', eventSeverity: 'info', eventType: 'http error', count: 3 }, { appName: 'apple_hls', eventSeverity: 'low', eventType: 'http error', count: 3 }, { appName: 'apple_hls', eventSeverity: 'medium', eventType: 'http error', count: 2 }, { appName: 'uplive', eventSeverity: 'high', eventType: 'http error', count: 2 }, { appName: 'windows_update', eventSeverity: 'medium', eventType: 'http error', count: 2 }, { appName: 'apple_hls', eventSeverity: 'critical', eventType: 'http error', count: 1 }, { appName: 'cloudflare', eventSeverity: 'info', eventType: 'http error', count: 1 }] }, originalUrl: 'http://192.168.44.55:9999?query=SELECT%20app_name%20AS%20app_name%2C%20event_severity%20AS%20event_severity%2C%20event_type%20AS%20event_type%2C%20COUNT%28*%29%20AS%20count%20FROM%20performance_event%20WHERE%20start_time%20%3E%3D%201675580110%20AND%20end_time%20%3C%201675752910%20AND%20entity_type%20%3D%20%27app%27%20GROUP%20BY%20app_name%2Cevent_severity%2Cevent_type%20ORDER%20BY%20count%20DESC%20%20LIMIT%2010%20&format=json&option=real-time', msg: 'OK' } }
|
||||
/**
|
||||
* 进行axios请求,并挂载vue实例
|
||||
* @param data
|
||||
*/
|
||||
function axiosPostAndMounted (data) {
|
||||
require('vue-router').useRoute.mockReturnValue({ query: {} })
|
||||
const _data = data || mockGet
|
||||
// 模拟 axios 数据
|
||||
axios.get.mockResolvedValue(_data)
|
||||
|
||||
// 加载vue组件,获得实例
|
||||
wrapper = mount(NpmAppEventTable, {
|
||||
global: {
|
||||
plugins: [ElementPlus]
|
||||
},
|
||||
propsData: {
|
||||
timeFilter
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
describe('views/charts2/charts/npm/NpmAppEventTable.vue测试', () => {
|
||||
test('Npm 事件:APP事件信息表格 严重程度色块验证', async () => {
|
||||
require('vue-router').useRoute.mockReturnValue({ query: {} })
|
||||
// 模拟 axios 数据
|
||||
axios.get.mockResolvedValue(mockGet)
|
||||
// 加载vue组件,获得实例
|
||||
const wrapper = mount(NpmAppEventTable, {
|
||||
global: {
|
||||
plugins: [ElementPlus]
|
||||
},
|
||||
propsData: {
|
||||
timeFilter
|
||||
}
|
||||
})
|
||||
axiosPostAndMounted()
|
||||
|
||||
await new Promise(resolve => setTimeout(() => {
|
||||
// critical
|
||||
@@ -96,18 +108,7 @@ describe('views/charts2/charts/npm/NpmAppEventTable.vue测试', () => {
|
||||
}, 200))
|
||||
})
|
||||
test('Npm 事件:APP事件信息表格 数据验证(应用数据列)', async () => {
|
||||
require('vue-router').useRoute.mockReturnValue({ query: {} })
|
||||
// 模拟 axios 数据
|
||||
axios.get.mockResolvedValue(mockGet)
|
||||
// 加载vue组件,获得实例
|
||||
const wrapper = mount(NpmAppEventTable, {
|
||||
global: {
|
||||
plugins: [ElementPlus]
|
||||
},
|
||||
propsData: {
|
||||
timeFilter
|
||||
}
|
||||
})
|
||||
axiosPostAndMounted()
|
||||
|
||||
await new Promise(resolve => setTimeout(() => {
|
||||
const textNode0 = wrapper.find('[test-id="appName0"]')
|
||||
@@ -136,18 +137,7 @@ describe('views/charts2/charts/npm/NpmAppEventTable.vue测试', () => {
|
||||
}, 200))
|
||||
})
|
||||
test('Npm 事件:APP事件信息表格 数据验证(严重程度数据列)', async () => {
|
||||
require('vue-router').useRoute.mockReturnValue({ query: {} })
|
||||
// 模拟 axios 数据
|
||||
axios.get.mockResolvedValue(mockGet)
|
||||
// 加载vue组件,获得实例
|
||||
const wrapper = mount(NpmAppEventTable, {
|
||||
global: {
|
||||
plugins: [ElementPlus]
|
||||
},
|
||||
propsData: {
|
||||
timeFilter
|
||||
}
|
||||
})
|
||||
axiosPostAndMounted()
|
||||
|
||||
await new Promise(resolve => setTimeout(() => {
|
||||
const textNode0 = wrapper.find('[test-id="eventSeverity0"]')
|
||||
@@ -176,18 +166,7 @@ describe('views/charts2/charts/npm/NpmAppEventTable.vue测试', () => {
|
||||
}, 200))
|
||||
})
|
||||
test('Npm 事件:APP事件信息表格 数据验证(事件类型数据列)', async () => {
|
||||
require('vue-router').useRoute.mockReturnValue({ query: {} })
|
||||
// 模拟 axios 数据
|
||||
axios.get.mockResolvedValue(mockGet)
|
||||
// 加载vue组件,获得实例
|
||||
const wrapper = mount(NpmAppEventTable, {
|
||||
global: {
|
||||
plugins: [ElementPlus]
|
||||
},
|
||||
propsData: {
|
||||
timeFilter
|
||||
}
|
||||
})
|
||||
axiosPostAndMounted()
|
||||
|
||||
await new Promise(resolve => setTimeout(() => {
|
||||
const textNode0 = wrapper.find('[test-id="eventType0"]')
|
||||
@@ -216,18 +195,7 @@ describe('views/charts2/charts/npm/NpmAppEventTable.vue测试', () => {
|
||||
}, 200))
|
||||
})
|
||||
test('Npm 事件:APP事件信息表格 数据验证(事件数量数据列)', async () => {
|
||||
require('vue-router').useRoute.mockReturnValue({ query: {} })
|
||||
// 模拟 axios 数据
|
||||
axios.get.mockResolvedValue(mockGet)
|
||||
// 加载vue组件,获得实例
|
||||
const wrapper = mount(NpmAppEventTable, {
|
||||
global: {
|
||||
plugins: [ElementPlus]
|
||||
},
|
||||
propsData: {
|
||||
timeFilter
|
||||
}
|
||||
})
|
||||
axiosPostAndMounted()
|
||||
|
||||
await new Promise(resolve => setTimeout(() => {
|
||||
const textNode0 = wrapper.find('[test-id="count0"]')
|
||||
@@ -255,4 +223,13 @@ describe('views/charts2/charts/npm/NpmAppEventTable.vue测试', () => {
|
||||
resolve()
|
||||
}, 200))
|
||||
})
|
||||
test('Npm 事件:APP事件信息表格 无数据', async () => {
|
||||
axiosPostAndMounted(mockData.empty.data)
|
||||
|
||||
await new Promise(resolve => setTimeout(() => {
|
||||
const noData = wrapper.get('[test-id="noData"]')
|
||||
expect(noData.text()).toBe('npm.noData')
|
||||
resolve()
|
||||
}, 200))
|
||||
})
|
||||
})
|
||||
|
||||
@@ -11,6 +11,7 @@ const timeFilter = {
|
||||
startTime: 1673244000,
|
||||
endTime: 1673247600
|
||||
}
|
||||
|
||||
/**
|
||||
* 进行axios请求,并挂载vue实例
|
||||
* @param data
|
||||
|
||||
@@ -1,25 +1,35 @@
|
||||
import NpmEventsHeader from '@/views/charts2/charts/npm/NpmEventsHeader'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import axios from 'axios'
|
||||
import { mockData } from './mockData/NpmEventsHeader'
|
||||
|
||||
// 模拟数据
|
||||
const chartData = {
|
||||
data: { status: 200, code: 200, queryKey: '6480498979f7501d822572ebeb9e9665', success: true, message: null, statistics: { elapsed: 0, rows_read: 3, result_size: 167, result_rows: 5 }, job: null, formatType: 'json', meta: [{ name: 'event_severity', type: 'string', category: 'Dimension' }, { name: 'count', type: 'long', category: 'Metric' }], data: { resultType: 'table', result: [{ eventSeverity: 'critical', count: 322334 }, { eventSeverity: 'high', count: 1111 }, { eventSeverity: 'info', count: 122222 }, { eventSeverity: 'low', count: 14456678 }, { eventSeverity: 'medium', count: 2000000 }] }, originalUrl: 'http://192.168.44.55:9999?query=SELECT%20event_severity%20AS%20event_severity%2C%20COUNT%28*%29%20AS%20count%20FROM%20performance_event%20WHERE%20start_time%20%3E%3D%201675026686%20AND%20end_time%20%3C%201675048286%20GROUP%20BY%20event_severity&format=json&option=real-time', msg: 'OK' }
|
||||
}
|
||||
const chartData = mockData.common.data
|
||||
// type
|
||||
const type = 'severity'
|
||||
let wrapper = null
|
||||
|
||||
/**
|
||||
* 进行axios请求,并挂载vue实例
|
||||
* @param data
|
||||
*/
|
||||
function axiosPostAndMounted (data) {
|
||||
require('vue-router').useRoute.mockReturnValue({ query: {} })
|
||||
const _data = data || chartData
|
||||
// 模拟 axios 数据
|
||||
axios.get.mockResolvedValue(_data)
|
||||
|
||||
// 加载vue组件,获得实例
|
||||
wrapper = mount(NpmEventsHeader, {
|
||||
propsData: {
|
||||
type
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
describe('views/charts2/charts/npm/NpmEventsHeader.vue测试', () => {
|
||||
test('严重等级各等级个数:npm event 严重等级单值', async () => {
|
||||
require('vue-router').useRoute.mockReturnValue({ query: {} })
|
||||
// 模拟 axios 返回数据
|
||||
axios.get.mockResolvedValue(chartData)
|
||||
// 加载vue组件,获得实例
|
||||
const wrapper = mount(NpmEventsHeader, {
|
||||
propsData: {
|
||||
type
|
||||
}
|
||||
})
|
||||
axiosPostAndMounted()
|
||||
// 严重等级
|
||||
const severity0 = wrapper.get('[test-id="severity0"]')
|
||||
const severity1 = wrapper.get('[test-id="severity1"]')
|
||||
@@ -51,4 +61,40 @@ describe('views/charts2/charts/npm/NpmEventsHeader.vue测试', () => {
|
||||
resolve()
|
||||
}, 200))
|
||||
})
|
||||
test('请求无数据', async () => {
|
||||
axiosPostAndMounted(mockData.empty.data)
|
||||
// 各等级个数
|
||||
const total0 = wrapper.get('[test-id="total0"]')
|
||||
const total1 = wrapper.get('[test-id="total1"]')
|
||||
const total2 = wrapper.get('[test-id="total2"]')
|
||||
const total3 = wrapper.get('[test-id="total3"]')
|
||||
const total4 = wrapper.get('[test-id="total4"]')
|
||||
|
||||
await new Promise(resolve => setTimeout(() => {
|
||||
expect(total0.text()).toEqual('-')
|
||||
expect(total1.text()).toEqual('-')
|
||||
expect(total2.text()).toEqual('-')
|
||||
expect(total3.text()).toEqual('-')
|
||||
expect(total4.text()).toEqual('-')
|
||||
resolve()
|
||||
}, 200))
|
||||
})
|
||||
test('数据为0或极大', async () => {
|
||||
axiosPostAndMounted(mockData.boundary.data)
|
||||
// 各等级个数
|
||||
const total0 = wrapper.get('[test-id="total0"]')
|
||||
const total1 = wrapper.get('[test-id="total1"]')
|
||||
const total2 = wrapper.get('[test-id="total2"]')
|
||||
const total3 = wrapper.get('[test-id="total3"]')
|
||||
const total4 = wrapper.get('[test-id="total4"]')
|
||||
|
||||
await new Promise(resolve => setTimeout(() => {
|
||||
expect(total0.text()).toEqual('0')
|
||||
expect(total1.text()).toEqual('0')
|
||||
expect(total2.text()).toEqual('0')
|
||||
expect(total3.text()).toEqual('14,456,678')
|
||||
expect(total4.text()).toEqual('1,222,225,432,456,789')
|
||||
resolve()
|
||||
}, 200))
|
||||
})
|
||||
})
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2,52 +2,45 @@ import NpmRecentEvents from '@/views/charts2/charts/npm/NpmRecentEvents'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import axios from 'axios'
|
||||
import ElementPlus from 'element-plus'
|
||||
import { mockData } from './mockData/NpmRecentEvents'
|
||||
|
||||
// 未下钻
|
||||
const mockGet = {
|
||||
data: { status: 200, code: 200, queryKey: '68d8aa5867b08b926b5bd38c36add9e5', success: true, message: null, statistics: { elapsed: 0, rows_read: 2, result_size: 550, result_rows: 5 }, job: null, formatType: 'json', meta: [{ name: 'event_id', type: 'long', category: 'Metric' }, { name: 'event_severity', type: 'string', category: 'Metric' }, { name: 'event_key', type: 'string', category: 'Metric' }, { name: 'event_type', type: 'string', category: 'Metric' }], data: { resultType: 'table', result: [{ eventId: 1173511643475208200, eventSeverity: 'critical', eventKey: '114.114.114.114 dns error', eventType: 'dns error' }, { eventId: 1173504415263352800, eventSeverity: 'high', eventKey: '116.178.78.241 http error', eventType: 'http error' }, { eventId: 1173492761289025500, eventSeverity: 'medium', eventKey: '223.6.6.6 dns error', eventType: 'dns error' }, { eventId: 1173489002890651600, eventSeverity: 'low', eventKey: '114.114.114.114 dns error', eventType: 'dns error' }, { eventId: 1173482380537620500, eventSeverity: 'info', eventKey: '1.1.1.2 dns error', eventType: 'http error' }, { eventId: 1173482380537620500, eventSeverity: 'critical', eventKey: '1.1.1.2 dns error', eventType: 'dns error' }] }, originalUrl: 'http://192.168.44.55:9999?query=SELECT%20event_id%20AS%20event_id%2Cevent_severity%20AS%20event_severity%2C%20event_key%20AS%20event_key%2C%20event_type%20AS%20event_type%20FROM%20performance_event%20WHERE%20start_time%20%3E%3D%201675227528%20AND%20end_time%20%3C%201675231128%20ORDER%20BY%20start_time%20DESC%20%20LIMIT%208%20&format=json&option=real-time', msg: 'OK' }
|
||||
}
|
||||
|
||||
const mockGet = mockData.common.data1
|
||||
// 下钻
|
||||
const mockGet1 = {
|
||||
data: { status: 200, code: 200, queryKey: 'fc0bd92bf3b48a37310d5c004d8b7a7b', success: true, message: null, statistics: { elapsed: 0, rows_read: 2, result_size: 689, result_rows: 7 }, job: null, formatType: 'json', meta: [{ name: 'event_id', type: 'long', category: 'Metric' }, { name: 'event_severity', type: 'string', category: 'Metric' }, { name: 'event_type', type: 'string', category: 'Metric' }, { name: 'start_time', type: 'long', category: 'Metric' }], data: { resultType: 'table', result: [{ eventId: 1132790825086844900, eventSeverity: 'critical', eventType: 'http error', startTime: 1672802700 }, { eventId: 1132132403379142700, eventSeverity: 'high', eventType: 'dns error', startTime: 1672763400 }, { eventId: 1131441760155689000, eventSeverity: 'low', eventType: 'dns error', startTime: 1672722300 }, { eventId: 1131411523384598500, eventSeverity: 'medium', eventType: 'http error', startTime: 1672720500 }, { eventId: 1131390214323789800, eventSeverity: 'info', eventType: 'dns error', startTime: 1672719300 }, { eventId: 1131306200132968400, eventSeverity: 'critical', eventType: 'http error', startTime: 1672714200 }] }, originalUrl: 'http://192.168.44.55:9999?query=SELECT%20event_id%20AS%20event_id%2Cevent_severity%20AS%20event_severity%2C%20event_type%20AS%20event_type%2C%20start_time%20AS%20start_time%20FROM%20performance_event%20WHERE%20start_time%20%3E%3D%201672675200%20AND%20start_time%20%3C%201677513600%20AND%20server_ip%20%3D%20%27116.178.236.216%27%20ORDER%20BY%20start_time%20DESC&format=json&option=real-time', msg: 'OK' }
|
||||
}
|
||||
|
||||
const query = {
|
||||
curTab: 'country',
|
||||
dimensionType: 'ip',
|
||||
fourthMenu: '116.178.214.84',
|
||||
fourthPanel: '8',
|
||||
networkOverviewBeforeTab: 'ip',
|
||||
panelName: '116.178.214.84',
|
||||
queryCondition: "common_client_ip='116.178.214.84' OR common_server_ip='116.178.214.84'",
|
||||
t: '1675236779453',
|
||||
tabIndex: '1',
|
||||
tabOperationBeforeType: '',
|
||||
tabOperationType: '4',
|
||||
thirdMenu: 'network.ips',
|
||||
thirdPanel: '12'
|
||||
}
|
||||
const mockGet1 = mockData.common.data2
|
||||
const query = mockData.common.query
|
||||
|
||||
const timeFilter = {
|
||||
dateRangeValue: -1,
|
||||
startTime: 1675043912,
|
||||
endTime: 1675047512
|
||||
}
|
||||
let wrapper = null
|
||||
/**
|
||||
* 进行axios请求,并挂载vue实例
|
||||
* @param data
|
||||
* @param query
|
||||
*/
|
||||
function axiosPostAndMounted (data, query) {
|
||||
const _query = query || {}
|
||||
require('vue-router').useRoute.mockReturnValue({ query: _query })
|
||||
const _data = data || mockGet
|
||||
axios.get.mockResolvedValue(_data)
|
||||
|
||||
wrapper = mount(NpmRecentEvents, {
|
||||
propsData: {
|
||||
timeFilter
|
||||
},
|
||||
global: {
|
||||
plugins: [ElementPlus]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
describe('views/charts2/charts/npm/NpmRecentEvents.vue测试', () => {
|
||||
test('npm events 近期事件表格 未下钻', async () => {
|
||||
require('vue-router').useRoute.mockReturnValue({ query: {} })
|
||||
// 模拟 axios 返回数据
|
||||
axios.get.mockResolvedValue(mockGet)
|
||||
axiosPostAndMounted()
|
||||
|
||||
const wrapper = mount(NpmRecentEvents, {
|
||||
propsData: {
|
||||
timeFilter
|
||||
},
|
||||
global: {
|
||||
plugins: [ElementPlus]
|
||||
}
|
||||
})
|
||||
await new Promise(resolve => setTimeout(() => {
|
||||
const severity0 = wrapper.get('[test-id="eventSeverity-critical-0"]')
|
||||
const severity1 = wrapper.get('[test-id="eventSeverity-high-1"]')
|
||||
@@ -98,18 +91,8 @@ describe('views/charts2/charts/npm/NpmRecentEvents.vue测试', () => {
|
||||
}, 200))
|
||||
})
|
||||
test('npm events 近期事件表格 下钻', async () => {
|
||||
require('vue-router').useRoute.mockReturnValue({ query: query })
|
||||
// 模拟 axios 返回数据
|
||||
axios.get.mockResolvedValue(mockGet1)
|
||||
axiosPostAndMounted(mockGet1, query)
|
||||
|
||||
const wrapper = mount(NpmRecentEvents, {
|
||||
propsData: {
|
||||
timeFilter
|
||||
},
|
||||
global: {
|
||||
plugins: [ElementPlus]
|
||||
}
|
||||
})
|
||||
await new Promise(resolve => setTimeout(() => {
|
||||
const severity0 = wrapper.get('[test-id="eventSeverity-critical-0"]')
|
||||
const severity1 = wrapper.get('[test-id="eventSeverity-high-1"]')
|
||||
@@ -159,4 +142,13 @@ describe('views/charts2/charts/npm/NpmRecentEvents.vue测试', () => {
|
||||
resolve()
|
||||
}, 300))
|
||||
})
|
||||
test('npm events 近期事件表格 未下钻、未下钻无数据', async () => {
|
||||
axiosPostAndMounted(mockData.empty.data)
|
||||
|
||||
await new Promise(resolve => setTimeout(() => {
|
||||
const noData = wrapper.get('[test-id="noData"]')
|
||||
expect(noData.text()).toBe('npm.thereNoEvents')
|
||||
resolve()
|
||||
}, 200))
|
||||
})
|
||||
})
|
||||
|
||||
665
test/views/charts2/charts/npm/mockData/NpmAppCategoryScore.js
Normal file
665
test/views/charts2/charts/npm/mockData/NpmAppCategoryScore.js
Normal file
File diff suppressed because one or more lines are too long
20
test/views/charts2/charts/npm/mockData/NpmAppEventByTable.js
Normal file
20
test/views/charts2/charts/npm/mockData/NpmAppEventByTable.js
Normal file
@@ -0,0 +1,20 @@
|
||||
export const mockData = {
|
||||
common: {
|
||||
data: {
|
||||
data: { status: 200, code: 200, queryKey: '88eeb92e0ddb40c0327db494cfe5c74c', success: true, message: null, statistics: { elapsed: 0, rows_read: 2, result_size: 752, result_rows: 10 }, job: null, formatType: 'json', meta: [{ name: 'app_name', type: 'string', category: 'Dimension' }, { name: 'event_severity', type: 'string', category: 'Dimension' }, { name: 'event_type', type: 'string', category: 'Dimension' }, { name: 'count', type: 'long', category: 'Metric' }], data: { resultType: 'table', result: [{ appName: 'youku', eventSeverity: 'info', eventType: 'http error', count: 6 }, { appName: 'uplive', eventSeverity: 'critical', eventType: 'http error', count: 5 }, { appName: 'youku', eventSeverity: 'low', eventType: 'http error', count: 4 }, { appName: 'apple_hls', eventSeverity: 'info', eventType: 'http error', count: 3 }, { appName: 'apple_hls', eventSeverity: 'low', eventType: 'http error', count: 3 }, { appName: 'apple_hls', eventSeverity: 'medium', eventType: 'http error', count: 2 }, { appName: 'uplive', eventSeverity: 'high', eventType: 'http error', count: 2 }, { appName: 'windows_update', eventSeverity: 'medium', eventType: 'http error', count: 2 }, { appName: 'apple_hls', eventSeverity: 'critical', eventType: 'http error', count: 1 }, { appName: 'cloudflare', eventSeverity: 'info', eventType: 'http error', count: 1 }] }, originalUrl: 'http://192.168.44.55:9999?query=SELECT%20app_name%20AS%20app_name%2C%20event_severity%20AS%20event_severity%2C%20event_type%20AS%20event_type%2C%20COUNT%28*%29%20AS%20count%20FROM%20performance_event%20WHERE%20start_time%20%3E%3D%201675580110%20AND%20end_time%20%3C%201675752910%20AND%20entity_type%20%3D%20%27app%27%20GROUP%20BY%20app_name%2Cevent_severity%2Cevent_type%20ORDER%20BY%20count%20DESC%20%20LIMIT%2010%20&format=json&option=real-time', msg: 'OK' }
|
||||
}
|
||||
},
|
||||
empty: {
|
||||
data: {
|
||||
data: {
|
||||
status: 200,
|
||||
code: 200,
|
||||
data: {
|
||||
resultType: 'table',
|
||||
result: []
|
||||
},
|
||||
msg: 'OK'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
48
test/views/charts2/charts/npm/mockData/NpmEventsHeader.js
Normal file
48
test/views/charts2/charts/npm/mockData/NpmEventsHeader.js
Normal file
@@ -0,0 +1,48 @@
|
||||
export const mockData = {
|
||||
common: {
|
||||
data: {
|
||||
data: { status: 200, code: 200, queryKey: '6480498979f7501d822572ebeb9e9665', success: true, message: null, statistics: { elapsed: 0, rows_read: 3, result_size: 167, result_rows: 5 }, job: null, formatType: 'json', meta: [{ name: 'event_severity', type: 'string', category: 'Dimension' }, { name: 'count', type: 'long', category: 'Metric' }], data: { resultType: 'table', result: [{ eventSeverity: 'critical', count: 322334 }, { eventSeverity: 'high', count: 1111 }, { eventSeverity: 'info', count: 122222 }, { eventSeverity: 'low', count: 14456678 }, { eventSeverity: 'medium', count: 2000000 }] }, originalUrl: 'http://192.168.44.55:9999?query=SELECT%20event_severity%20AS%20event_severity%2C%20COUNT%28*%29%20AS%20count%20FROM%20performance_event%20WHERE%20start_time%20%3E%3D%201675026686%20AND%20end_time%20%3C%201675048286%20GROUP%20BY%20event_severity&format=json&option=real-time', msg: 'OK' }
|
||||
}
|
||||
},
|
||||
empty: {
|
||||
data: {
|
||||
data: {
|
||||
status: 200,
|
||||
code: 200,
|
||||
data: {
|
||||
resultType: 'table',
|
||||
result: []
|
||||
},
|
||||
msg: 'OK'
|
||||
}
|
||||
}
|
||||
},
|
||||
boundary: {
|
||||
data: {
|
||||
data: {
|
||||
status: 200,
|
||||
code: 200,
|
||||
data: {
|
||||
resultType: 'table',
|
||||
result: [
|
||||
{
|
||||
eventSeverity: 'critical',
|
||||
count: 0
|
||||
}, {
|
||||
eventSeverity: 'high',
|
||||
count: 0
|
||||
}, {
|
||||
eventSeverity: 'info',
|
||||
count: 1222225432456789
|
||||
}, {
|
||||
eventSeverity: 'low',
|
||||
count: 14456678
|
||||
}, {
|
||||
eventSeverity: 'medium',
|
||||
count: 0
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
157
test/views/charts2/charts/npm/mockData/NpmNetworkQuantity.js
Normal file
157
test/views/charts2/charts/npm/mockData/NpmNetworkQuantity.js
Normal file
File diff suppressed because one or more lines are too long
66
test/views/charts2/charts/npm/mockData/NpmRecentEvents.js
Normal file
66
test/views/charts2/charts/npm/mockData/NpmRecentEvents.js
Normal file
@@ -0,0 +1,66 @@
|
||||
export const mockData = {
|
||||
common: {
|
||||
data1: {
|
||||
data: { status: 200, code: 200, queryKey: '68d8aa5867b08b926b5bd38c36add9e5', success: true, message: null, statistics: { elapsed: 0, rows_read: 2, result_size: 550, result_rows: 5 }, job: null, formatType: 'json', meta: [{ name: 'event_id', type: 'long', category: 'Metric' }, { name: 'event_severity', type: 'string', category: 'Metric' }, { name: 'event_key', type: 'string', category: 'Metric' }, { name: 'event_type', type: 'string', category: 'Metric' }], data: { resultType: 'table', result: [{ eventId: 1173511643475208200, eventSeverity: 'critical', eventKey: '114.114.114.114 dns error', eventType: 'dns error' }, { eventId: 1173504415263352800, eventSeverity: 'high', eventKey: '116.178.78.241 http error', eventType: 'http error' }, { eventId: 1173492761289025500, eventSeverity: 'medium', eventKey: '223.6.6.6 dns error', eventType: 'dns error' }, { eventId: 1173489002890651600, eventSeverity: 'low', eventKey: '114.114.114.114 dns error', eventType: 'dns error' }, { eventId: 1173482380537620500, eventSeverity: 'info', eventKey: '1.1.1.2 dns error', eventType: 'http error' }, { eventId: 1173482380537620500, eventSeverity: 'critical', eventKey: '1.1.1.2 dns error', eventType: 'dns error' }] }, originalUrl: 'http://192.168.44.55:9999?query=SELECT%20event_id%20AS%20event_id%2Cevent_severity%20AS%20event_severity%2C%20event_key%20AS%20event_key%2C%20event_type%20AS%20event_type%20FROM%20performance_event%20WHERE%20start_time%20%3E%3D%201675227528%20AND%20end_time%20%3C%201675231128%20ORDER%20BY%20start_time%20DESC%20%20LIMIT%208%20&format=json&option=real-time', msg: 'OK' }
|
||||
},
|
||||
data2: {
|
||||
data: { status: 200, code: 200, queryKey: 'fc0bd92bf3b48a37310d5c004d8b7a7b', success: true, message: null, statistics: { elapsed: 0, rows_read: 2, result_size: 689, result_rows: 7 }, job: null, formatType: 'json', meta: [{ name: 'event_id', type: 'long', category: 'Metric' }, { name: 'event_severity', type: 'string', category: 'Metric' }, { name: 'event_type', type: 'string', category: 'Metric' }, { name: 'start_time', type: 'long', category: 'Metric' }], data: { resultType: 'table', result: [{ eventId: 1132790825086844900, eventSeverity: 'critical', eventType: 'http error', startTime: 1672802700 }, { eventId: 1132132403379142700, eventSeverity: 'high', eventType: 'dns error', startTime: 1672763400 }, { eventId: 1131441760155689000, eventSeverity: 'low', eventType: 'dns error', startTime: 1672722300 }, { eventId: 1131411523384598500, eventSeverity: 'medium', eventType: 'http error', startTime: 1672720500 }, { eventId: 1131390214323789800, eventSeverity: 'info', eventType: 'dns error', startTime: 1672719300 }, { eventId: 1131306200132968400, eventSeverity: 'critical', eventType: 'http error', startTime: 1672714200 }] }, originalUrl: 'http://192.168.44.55:9999?query=SELECT%20event_id%20AS%20event_id%2Cevent_severity%20AS%20event_severity%2C%20event_type%20AS%20event_type%2C%20start_time%20AS%20start_time%20FROM%20performance_event%20WHERE%20start_time%20%3E%3D%201672675200%20AND%20start_time%20%3C%201677513600%20AND%20server_ip%20%3D%20%27116.178.236.216%27%20ORDER%20BY%20start_time%20DESC&format=json&option=real-time', msg: 'OK' }
|
||||
},
|
||||
query: {
|
||||
curTab: 'country',
|
||||
dimensionType: 'ip',
|
||||
fourthMenu: '116.178.214.84',
|
||||
fourthPanel: '8',
|
||||
networkOverviewBeforeTab: 'ip',
|
||||
panelName: '116.178.214.84',
|
||||
queryCondition: "common_client_ip='116.178.214.84' OR common_server_ip='116.178.214.84'",
|
||||
t: '1675236779453',
|
||||
tabIndex: '1',
|
||||
tabOperationBeforeType: '',
|
||||
tabOperationType: '4',
|
||||
thirdMenu: 'network.ips',
|
||||
thirdPanel: '12'
|
||||
}
|
||||
},
|
||||
empty: {
|
||||
data: {
|
||||
data: {
|
||||
status: 200,
|
||||
code: 200,
|
||||
data: {
|
||||
resultType: 'table',
|
||||
result: []
|
||||
},
|
||||
msg: 'OK'
|
||||
}
|
||||
}
|
||||
},
|
||||
boundary: {
|
||||
data: {
|
||||
data: {
|
||||
status: 200,
|
||||
code: 200,
|
||||
data: {
|
||||
resultType: 'table',
|
||||
result: [
|
||||
{
|
||||
eventSeverity: 'critical',
|
||||
count: 0
|
||||
}, {
|
||||
eventSeverity: 'high',
|
||||
count: 0
|
||||
}, {
|
||||
eventSeverity: 'info',
|
||||
count: 1222225432456789
|
||||
}, {
|
||||
eventSeverity: 'low',
|
||||
count: 14456678
|
||||
}, {
|
||||
eventSeverity: 'medium',
|
||||
count: 0
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user