Skip to content

Commit

Permalink
[8.11] [Data Discovery] Unskip and fix flaky Serverless examples tests (
Browse files Browse the repository at this point in the history
#168422) (#168664)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[Data Discovery] Unskip and fix flaky Serverless examples tests
(#168422)](#168422)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Davis
McPhee","email":"davis.mcphee@elastic.co"},"sourceCommit":{"committedDate":"2023-10-12T02:19:45Z","message":"[Data
Discovery] Unskip and fix flaky Serverless examples tests
(#168422)\n\n## Summary\r\n\r\nThis PR unskips and fixes the remaining
flaky Serverless examples tests.\r\n\r\nResolves #165730.\r\nResolves
#165735.\r\nResolves #165624.\r\nResolves #165623.\r\nResolves
#165635.\r\nResolves #165938.\r\nResolves #165927.\r\nResolves
#165882.\r\nResolves #165797.\r\nResolves #167939.\r\nResolves
#165503.\r\nResolves #165502.\r\nResolves #165379.\r\n\r\nFlaky test
runs:\r\n-
x300:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3430\r\n🟢\r\n-
x300:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3455\r\n🔴\r\n-
x100:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3478\r\n🟢\r\n\r\n###
Checklist\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"8bd40bcfb782c5a2b9258c41cf7fe3cdedfcb69d","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:DataDiscovery","v8.11.0","v8.12.0"],"number":168422,"url":"https://github.com/elastic/kibana/pull/168422","mergeCommit":{"message":"[Data
Discovery] Unskip and fix flaky Serverless examples tests
(#168422)\n\n## Summary\r\n\r\nThis PR unskips and fixes the remaining
flaky Serverless examples tests.\r\n\r\nResolves #165730.\r\nResolves
#165735.\r\nResolves #165624.\r\nResolves #165623.\r\nResolves
#165635.\r\nResolves #165938.\r\nResolves #165927.\r\nResolves
#165882.\r\nResolves #165797.\r\nResolves #167939.\r\nResolves
#165503.\r\nResolves #165502.\r\nResolves #165379.\r\n\r\nFlaky test
runs:\r\n-
x300:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3430\r\n🟢\r\n-
x300:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3455\r\n🔴\r\n-
x100:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3478\r\n🟢\r\n\r\n###
Checklist\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"8bd40bcfb782c5a2b9258c41cf7fe3cdedfcb69d"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/168422","number":168422,"mergeCommit":{"message":"[Data
Discovery] Unskip and fix flaky Serverless examples tests
(#168422)\n\n## Summary\r\n\r\nThis PR unskips and fixes the remaining
flaky Serverless examples tests.\r\n\r\nResolves #165730.\r\nResolves
#165735.\r\nResolves #165624.\r\nResolves #165623.\r\nResolves
#165635.\r\nResolves #165938.\r\nResolves #165927.\r\nResolves
#165882.\r\nResolves #165797.\r\nResolves #167939.\r\nResolves
#165503.\r\nResolves #165502.\r\nResolves #165379.\r\n\r\nFlaky test
runs:\r\n-
x300:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3430\r\n🟢\r\n-
x300:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3455\r\n🔴\r\n-
x100:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3478\r\n🟢\r\n\r\n###
Checklist\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"8bd40bcfb782c5a2b9258c41cf7fe3cdedfcb69d"}}]}]
BACKPORT-->
  • Loading branch information
davismcphee committed Oct 13, 2023
1 parent 885f469 commit 5dc69b4
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ export default function ({ getService, getPageObjects, loadTestFile }: FtrProvid
const retry = getService('retry');
const kibanaServer = getService('kibanaServer');

// FLAKY: https://github.com/elastic/kibana/issues/167939
describe.skip('data view field editor example', function () {
describe('data view field editor example', function () {
before(async () => {
// TODO: Serverless tests require login first
await PageObjects.svlCommonPage.login();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { WebElementWrapper } from '../../../../../../../test/functional/ser
import type { FtrProviderContext } from '../../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'timePicker']);
const PageObjects = getPageObjects(['common', 'timePicker', 'svlCommonPage']);
const testSubjects = getService('testSubjects');
const find = getService('find');
const retry = getService('retry');
Expand All @@ -23,14 +23,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const comboBox = getService('comboBox');
const kibanaServer = getService('kibanaServer');
const esArchiver = getService('esArchiver');
const monacoEditor = getService('monacoEditor');

// Failing: See https://github.com/elastic/kibana/issues/165623
// FLAKY: https://github.com/elastic/kibana/issues/165379
// FLAKY: https://github.com/elastic/kibana/issues/165502
// FLAKY: https://github.com/elastic/kibana/issues/165503
// FLAKY: https://github.com/elastic/kibana/issues/165624
// FLAKY: https://github.com/elastic/kibana/issues/165635
describe.skip('handling warnings with search source fetch', function () {
describe('handling warnings with search source fetch', function () {
const dataViewTitle = 'sample-01,sample-01-rollup';
const fromTime = 'Jun 17, 2022 @ 00:00:00.000';
const toTime = 'Jun 23, 2022 @ 00:00:00.000';
Expand All @@ -51,6 +46,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
};

before(async () => {
// TODO: Serverless tests require login first
await PageObjects.svlCommonPage.login();
// create rollup data
log.info(`loading ${testIndex} index...`);
await esArchiver.loadIfNeeded(testArchive);
Expand Down Expand Up @@ -104,43 +101,44 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.common.clearAllToasts();
});

it('shows shard failure warning notifications by default', async () => {
it('should show search warnings as toasts', async () => {
await testSubjects.click('searchSourceWithOther');

// wait for response - toasts appear before the response is rendered
let response: estypes.SearchResponse | undefined;
await retry.try(async () => {
response = await getTestJson('responseTab', 'responseCodeBlock');
expect(response).not.to.eql({});
});

// toasts
const toasts = await find.allByCssSelector(toastsSelector);
expect(toasts.length).to.be(2);
const expects = ['2 of 4 shards failed', 'Query result'];
await asyncForEach(toasts, async (t, index) => {
expect(await t.getVisibleText()).to.eql(expects[index]);
const toasts = await find.allByCssSelector(toastsSelector);
expect(toasts.length).to.be(2);
const expects = ['The data might be incomplete or wrong.', 'Query result'];
await asyncForEach(toasts, async (t, index) => {
expect(await t.getVisibleText()).to.eql(expects[index]);
});
});

// click "see full error" button in the toast
const [openShardModalButton] = await testSubjects.findAll('openShardFailureModalBtn');
const [openShardModalButton] = await testSubjects.findAll('viewWarningBtn');
await openShardModalButton.click();

await retry.waitFor('modal title visible', async () => {
const modalHeader = await testSubjects.find('shardFailureModalTitle');
return (await modalHeader.getVisibleText()) === '2 of 4 shards failed';
// request
await retry.try(async () => {
await testSubjects.click('inspectorRequestDetailRequest');
const requestText = await monacoEditor.getCodeEditorValue(0);
expect(requestText).to.contain(testRollupField);
});

// request
await testSubjects.click('shardFailuresModalRequestButton');
const requestBlock = await testSubjects.find('shardsFailedModalRequestBlock');
expect(await requestBlock.getVisibleText()).to.contain(testRollupField);
// response
await testSubjects.click('shardFailuresModalResponseButton');
const responseBlock = await testSubjects.find('shardsFailedModalResponseBlock');
expect(await responseBlock.getVisibleText()).to.contain(shardFailureReason);
await retry.try(async () => {
await testSubjects.click('inspectorRequestDetailResponse');
const responseText = await monacoEditor.getCodeEditorValue(0);
expect(responseText).to.contain(shardFailureReason);
});

await testSubjects.click('closeShardFailureModal');
await testSubjects.click('euiFlyoutCloseButton');

// wait for response - toasts appear before the response is rendered
let response: estypes.SearchResponse | undefined;
await retry.try(async () => {
response = await getTestJson('responseTab', 'responseCodeBlock');
expect(response).not.to.eql({});
});

// response tab
assert(response && response._shards.failures);
Expand All @@ -158,61 +156,24 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(warnings).to.eql([]);
});

it('able to handle shard failure warnings and prevent default notifications', async () => {
it('should show search warnings in results tab', async () => {
await testSubjects.click('searchSourceWithoutOther');

// wait for toasts - toasts appear after the response is rendered
let toasts: WebElementWrapper[] = [];
await retry.try(async () => {
toasts = await find.allByCssSelector(toastsSelector);
expect(toasts.length).to.be(2);
});
const expects = ['Query result', '2 of 4 shards failed'];
await asyncForEach(toasts, async (t, index) => {
expect(await t.getVisibleText()).to.eql(expects[index]);
});

// click "see full error" button in the toast
const [openShardModalButton] = await testSubjects.findAll('openShardFailureModalBtn');
await openShardModalButton.click();

await retry.waitFor('modal title visible', async () => {
const modalHeader = await testSubjects.find('shardFailureModalTitle');
return (await modalHeader.getVisibleText()) === '2 of 4 shards failed';
const expects = ['The data might be incomplete or wrong.', 'Query result'];
await asyncForEach(toasts, async (t, index) => {
expect(await t.getVisibleText()).to.eql(expects[index]);
});
});

// request
await testSubjects.click('shardFailuresModalRequestButton');
const requestBlock = await testSubjects.find('shardsFailedModalRequestBlock');
expect(await requestBlock.getVisibleText()).to.contain(testRollupField);
// response
await testSubjects.click('shardFailuresModalResponseButton');
const responseBlock = await testSubjects.find('shardsFailedModalResponseBlock');
expect(await responseBlock.getVisibleText()).to.contain(shardFailureReason);

await testSubjects.click('closeShardFailureModal');

// response tab
const response = await getTestJson('responseTab', 'responseCodeBlock');
expect(response._shards.total).to.be(4);
expect(response._shards.successful).to.be(2);
expect(response._shards.skipped).to.be(0);
expect(response._shards.failed).to.be(2);
expect(response._shards.failures.length).to.equal(1);
expect(response._shards.failures[0].index).to.equal(testRollupIndex);
expect(response._shards.failures[0].reason.type).to.equal(shardFailureType);
expect(response._shards.failures[0].reason.reason).to.equal(shardFailureReason);

// warnings tab
const warnings = await getTestJson('warningsTab', 'warningsCodeBlock');
expect(warnings).to.eql([
{
type: 'shard_failure',
message: '2 of 4 shards failed',
reason: { reason: shardFailureReason, type: shardFailureType },
text: 'The data might be incomplete or wrong.',
},
]);
expect(warnings.length).to.be(1);
expect(warnings[0].type).to.be('incomplete');
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ import type { FtrProviderContext } from '../../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['common', 'timePicker']);
const PageObjects = getPageObjects(['common', 'timePicker', 'svlCommonPage']);
const retry = getService('retry');
const comboBox = getService('comboBox');
const toasts = getService('toasts');

// Failing: See https://github.com/elastic/kibana/issues/165730
// FLAKY: https://github.com/elastic/kibana/issues/165735
describe.skip('Search example', () => {
describe('Search example', () => {
before(async () => {
// TODO: Serverless tests require login first
await PageObjects.svlCommonPage.login();
});

describe('with bfetch', () => {
testSearchExample();
});
Expand Down Expand Up @@ -83,7 +86,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});

it('should handle warnings', async () => {
// TODO: This test fails in Serverless because it relies on
// `error_query` which doesn't seem to be supported in Serverless
it.skip('should handle warnings', async () => {
await testSubjects.click('searchWithWarning');
await retry.waitFor('', async () => {
const toastCount = await toasts.getToastCount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ const TEST_START_TIME = 'Sep 19, 2015 @ 06:31:44.000';
const TEST_END_TIME = 'Sep 23, 2015 @ 18:31:44.000';

export default ({ getService, getPageObjects }: FtrProviderContext) => {
const PageObjects = getPageObjects(['common', 'timePicker', 'header', 'unifiedFieldList']);
const PageObjects = getPageObjects([
'common',
'timePicker',
'header',
'unifiedFieldList',
'svlCommonPage',
]);
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const comboBox = getService('comboBox');
Expand All @@ -21,9 +27,10 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => {
const filterBar = getService('filterBar');
const dataViewTitle = 'logstash-2015.09.22';

// FLAKY: https://github.com/elastic/kibana/issues/165882
describe.skip('Field stats', () => {
describe('Field stats', () => {
before(async () => {
// TODO: Serverless tests require login first
await PageObjects.svlCommonPage.login();
await kibanaServer.savedObjects.cleanStandardList();
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
await kibanaServer.importExport.load(
Expand Down Expand Up @@ -59,8 +66,7 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => {
await PageObjects.unifiedFieldList.cleanSidebarLocalStorage();
});

// FLAKY: https://github.com/elastic/kibana/issues/165797
describe.skip('field distribution', () => {
describe('field distribution', () => {
before(async () => {
await PageObjects.unifiedFieldList.toggleSidebarSection('empty'); // it will allow to render more fields in Available fields section
});
Expand Down

0 comments on commit 5dc69b4

Please sign in to comment.