[Observability] [Alerts] Regenerate archive data and amend tests (#115603)

* Regenerate archive data and amend test assertions
This commit is contained in:
Kerry Gallagher 2021-10-21 11:07:43 +01:00 committed by GitHub
parent 39aea6d9a8
commit d18e7c9158
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 54 additions and 25 deletions

View file

@ -14,7 +14,7 @@
},
"namespace": "default"
},
"dynamic": "strict",
"dynamic": "false",
"properties": {
"@timestamp": {
"type": "date"
@ -99,7 +99,7 @@
"type": "keyword"
},
"from": {
"type": "date"
"type": "keyword"
},
"interval": {
"type": "keyword"
@ -113,6 +113,10 @@
"note": {
"type": "keyword"
},
"params": {
"index": false,
"type": "keyword"
},
"producer": {
"type": "keyword"
},
@ -278,7 +282,7 @@
},
"namespace": "default"
},
"dynamic": "strict",
"dynamic": "false",
"properties": {
"@timestamp": {
"type": "date"
@ -363,7 +367,7 @@
"type": "keyword"
},
"from": {
"type": "date"
"type": "keyword"
},
"interval": {
"type": "keyword"
@ -377,6 +381,10 @@
"note": {
"type": "keyword"
},
"params": {
"index": false,
"type": "keyword"
},
"producer": {
"type": "keyword"
},
@ -518,7 +526,7 @@
},
"namespace": "default"
},
"dynamic": "strict",
"dynamic": "false",
"properties": {
"@timestamp": {
"type": "date"
@ -603,7 +611,7 @@
"type": "keyword"
},
"from": {
"type": "date"
"type": "keyword"
},
"interval": {
"type": "keyword"
@ -617,6 +625,10 @@
"note": {
"type": "keyword"
},
"params": {
"index": false,
"type": "keyword"
},
"producer": {
"type": "keyword"
},

View file

@ -11,8 +11,8 @@ import { WebElementWrapper } from '../../../../../../test/functional/services/li
// Based on the x-pack/test/functional/es_archives/observability/alerts archive.
const DATE_WITH_DATA = {
rangeFrom: '2021-09-01T13:36:22.109Z',
rangeTo: '2021-09-03T13:36:22.109Z',
rangeFrom: '2021-10-18T13:36:22.109Z',
rangeTo: '2021-10-20T13:36:22.109Z',
};
const ALERTS_FLYOUT_SELECTOR = 'alertsFlyout';
@ -32,6 +32,7 @@ export function ObservabilityAlertsCommonProvider({
const pageObjects = getPageObjects(['common']);
const retry = getService('retry');
const toasts = getService('toasts');
const kibanaServer = getService('kibanaServer');
const navigateToTimeWithData = async () => {
return await pageObjects.common.navigateToUrlWithBrowserHistory(
@ -42,6 +43,12 @@ export function ObservabilityAlertsCommonProvider({
);
};
const setKibanaTimeZoneToUTC = async () => {
await kibanaServer.uiSettings.update({
'dateFormat:tz': 'UTC',
});
};
const getTableColumnHeaders = async () => {
const table = await testSubjects.find(ALERTS_TABLE_CONTAINER_SELECTOR);
const tableHeaderRow = await testSubjects.findDescendant('dataGridHeader', table);
@ -220,6 +227,7 @@ export function ObservabilityAlertsCommonProvider({
getTableColumnHeaders,
getTableOrFail,
navigateToTimeWithData,
setKibanaTimeZoneToUTC,
openAlertsFlyout,
setWorkflowStatusForRow,
setWorkflowStatusFilter,

View file

@ -14,9 +14,9 @@ async function asyncForEach<T>(array: T[], callback: (item: T, index: number) =>
}
}
const ACTIVE_ALERTS_CELL_COUNT = 48;
const RECOVERED_ALERTS_CELL_COUNT = 24;
const TOTAL_ALERTS_CELL_COUNT = 72;
const ACTIVE_ALERTS_CELL_COUNT = 78;
const RECOVERED_ALERTS_CELL_COUNT = 120;
const TOTAL_ALERTS_CELL_COUNT = 198;
export default ({ getService }: FtrProviderContext) => {
const esArchiver = getService('esArchiver');
@ -30,7 +30,11 @@ export default ({ getService }: FtrProviderContext) => {
before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/observability/alerts');
await observability.alerts.common.navigateToTimeWithData();
const setup = async () => {
await observability.alerts.common.setKibanaTimeZoneToUTC();
await observability.alerts.common.navigateToTimeWithData();
};
await setup();
});
after(async () => {
@ -120,7 +124,7 @@ export default ({ getService }: FtrProviderContext) => {
const titleText = await (
await observability.alerts.common.getAlertsFlyoutTitle()
).getVisibleText();
expect(titleText).to.contain('Log threshold');
expect(titleText).to.contain('APM Failed Transaction Rate (one)');
});
});
@ -140,11 +144,11 @@ export default ({ getService }: FtrProviderContext) => {
];
const expectedDescriptions = [
'Active',
'Sep 2, 2021 @ 12:54:09.674',
'15 minutes',
'100.25',
'1957',
'Log threshold',
'Oct 19, 2021 @ 15:00:41.555',
'20 minutes',
'5',
'30.73',
'Failed transaction rate threshold',
];
await asyncForEach(flyoutTitles, async (title, index) => {

View file

@ -8,7 +8,7 @@
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
const OPEN_ALERTS_ROWS_COUNT = 12;
const OPEN_ALERTS_ROWS_COUNT = 33;
export default ({ getService }: FtrProviderContext) => {
const esArchiver = getService('esArchiver');
@ -40,7 +40,7 @@ export default ({ getService }: FtrProviderContext) => {
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(11);
expect(tableRows.length).to.be(32);
});
});
@ -49,7 +49,7 @@ export default ({ getService }: FtrProviderContext) => {
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(3);
expect(tableRows.length).to.be(6);
});
});
@ -58,7 +58,7 @@ export default ({ getService }: FtrProviderContext) => {
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(2);
expect(tableRows.length).to.be(5);
});
});
@ -67,7 +67,7 @@ export default ({ getService }: FtrProviderContext) => {
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(4);
expect(tableRows.length).to.be(3);
});
});
@ -76,7 +76,7 @@ export default ({ getService }: FtrProviderContext) => {
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(3);
expect(tableRows.length).to.be(2);
});
});
@ -85,7 +85,7 @@ export default ({ getService }: FtrProviderContext) => {
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(12);
expect(tableRows.length).to.be(3);
});
});
});

View file

@ -42,6 +42,11 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
'--xpack.ruleRegistry.write.enabled=true',
],
},
uiSettings: {
defaults: {
'dateFormat:tz': 'UTC',
},
},
testFiles: [resolve(__dirname, './apps/observability')],
junit: {
...xpackFunctionalConfig.get('junit'),