-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async Discover search test #64388
Merged
Merged
Async Discover search test #64388
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
11628db
add x-pack test for discover async search with scripted field
674130c
one test for failed shards and one that *should* work but fails on BC8
421d7db
speed up setScriptedFieldScript by 20 sec for most cases
64c3150
use index pattern with scripted fields from esArchive
ad9e362
merge
ad80789
enable test for failed shards
8530255
Merge branch 'master' into asyncSearchTest
elasticmachine e3fa31c
added more to esArchive files to eliminate steps from test
13b4462
Merge branch 'asyncSearchTest' of github.com:LeeDr/kibana into asyncS…
6d2178a
Merge branch 'master' of github.com:elastic/kibana into asyncSearchTest
8413697
Merge branch 'master' into asyncSearchTest
elasticmachine 46538a8
Merge branch 'master' into asyncSearchTest
elasticmachine fdccf5c
Merge branch 'master' into asyncSearchTest
elasticmachine dcb02d9
Merge branch 'master' into asyncSearchTest
elasticmachine e501378
Merge branch 'master' of github.com:elastic/kibana into asyncSearchTest
48a1f24
fix lint errors
4672fd4
Merge branch 'master' of github.com:elastic/kibana into asyncSearchTest
208ba76
remove prefer_v2_templates: true
72b15a9
Merge branch 'asyncSearchTest' of github.com:LeeDr/kibana into asyncS…
0348d9b
delete bad yarn.lock file
aa58dc9
Merge branch 'master' of github.com:elastic/kibana into asyncSearchTest
169c36e
restore yarn.lock file
c238e60
Merge branch 'master' into asyncSearchTest
elasticmachine 2a0d480
Merge branch 'master' into asyncSearchTest
elasticmachine 4afcc20
un-commented the setup code but put it in unreachable condition
615a85f
Merge branch 'asyncSearchTest' of github.com:LeeDr/kibana into asyncS…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
x-pack/test/functional/apps/discover/async_scripted_fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,124 @@ | ||||
/* | ||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||||
* or more contributor license agreements. Licensed under the Elastic License; | ||||
* you may not use this file except in compliance with the Elastic License. | ||||
*/ | ||||
|
||||
// Tests for scripted field in default distribution where async search is used | ||||
import expect from '@kbn/expect'; | ||||
|
||||
export default function ({ getService, getPageObjects }) { | ||||
const kibanaServer = getService('kibanaServer'); | ||||
// const log = getService('log'); | ||||
const retry = getService('retry'); | ||||
const esArchiver = getService('esArchiver'); | ||||
const log = getService('log'); | ||||
const testSubjects = getService('testSubjects'); | ||||
|
||||
const PageObjects = getPageObjects(['common', 'settings', 'discover', 'timePicker']); | ||||
const queryBar = getService('queryBar'); | ||||
|
||||
describe('async search with scripted fields', function () { | ||||
this.tags(['skipFirefox']); | ||||
|
||||
before(async function () { | ||||
await esArchiver.load('kibana_scripted_fields_on_logstash'); | ||||
await esArchiver.loadIfNeeded('logstash_functional'); | ||||
// changing the timepicker default here saves us from having to set it in Discover (~8s) | ||||
await kibanaServer.uiSettings.update({ | ||||
'timepicker:timeDefaults': | ||||
'{ "from": "Sep 18, 2015 @ 19:37:13.000", "to": "Sep 23, 2015 @ 02:30:09.000"}', | ||||
}); | ||||
}); | ||||
|
||||
after(async function afterAll() { | ||||
await kibanaServer.uiSettings.replace({}); | ||||
await kibanaServer.uiSettings.update({}); | ||||
Comment on lines
+35
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is just a question, there is no way to replace a single uiSetting ? just asking because of
|
||||
await esArchiver.unload('logstash_functional'); | ||||
await esArchiver.load('empty_kibana'); | ||||
}); | ||||
|
||||
it('query should show failed shards pop up', async function () { | ||||
if (false) { | ||||
/* If you had to modify the scripted fields, you could un-comment all this, run it, use es_archiver to update 'kibana_scripted_fields_on_logstash' | ||||
*/ | ||||
await PageObjects.settings.navigateTo(); | ||||
await PageObjects.settings.clickKibanaIndexPatterns(); | ||||
await PageObjects.settings.createIndexPattern('logsta'); | ||||
await PageObjects.settings.clickScriptedFieldsTab(); | ||||
await log.debug('add scripted field'); | ||||
await PageObjects.settings.addScriptedField( | ||||
'sharedFail', | ||||
'painless', | ||||
'string', | ||||
null, | ||||
'1', | ||||
// Scripted field below with multiple string checking actually should cause share failure message | ||||
// bcause it's not checking if all the fields it uses exist in each doc (and they don't) | ||||
"if (doc['response.raw'].value == '200') { return 'good ' + doc['url.raw'].value } else { return 'bad ' + doc['machine.os.raw'].value } " | ||||
); | ||||
} | ||||
|
||||
await PageObjects.common.navigateToApp('discover'); | ||||
await PageObjects.discover.selectIndexPattern('logsta*'); | ||||
|
||||
await retry.tryForTime(20000, async function () { | ||||
// wait for shards failed message | ||||
const shardMessage = await testSubjects.getVisibleText('euiToastHeader'); | ||||
log.debug(shardMessage); | ||||
expect(shardMessage).to.be('1 of 3 shards failed'); | ||||
}); | ||||
}); | ||||
|
||||
it('query return results with valid scripted field', async function () { | ||||
if (false) { | ||||
/* the commented-out steps below were used to create the scripted fields in the logstash-* index pattern | ||||
which are now saved in the esArchive. | ||||
*/ | ||||
|
||||
await PageObjects.settings.navigateTo(); | ||||
await PageObjects.settings.clickKibanaIndexPatterns(); | ||||
await PageObjects.settings.clickIndexPatternLogstash(); | ||||
const startingCount = parseInt(await PageObjects.settings.getScriptedFieldsTabCount()); | ||||
await PageObjects.settings.clickScriptedFieldsTab(); | ||||
await log.debug('add scripted field'); | ||||
await PageObjects.settings.addScriptedField( | ||||
'goodScript', | ||||
'painless', | ||||
'string', | ||||
null, | ||||
'1', | ||||
// Scripted field below with should work | ||||
"if (doc['response.raw'].value == '200') { if (doc['url.raw'].size() > 0) { return 'good ' + doc['url.raw'].value } else { return 'good' } } else { if (doc['machine.os.raw'].size() > 0) { return 'bad ' + doc['machine.os.raw'].value } else { return 'bad' } }" | ||||
); | ||||
await retry.try(async function () { | ||||
expect(parseInt(await PageObjects.settings.getScriptedFieldsTabCount())).to.be( | ||||
startingCount + 1 | ||||
); | ||||
}); | ||||
|
||||
await PageObjects.settings.addScriptedField( | ||||
'goodScript2', | ||||
'painless', | ||||
'string', | ||||
null, | ||||
'1', | ||||
// Scripted field below which should work | ||||
"if (doc['url.raw'].size() > 0) { String tempString = \"\"; for ( int i = (doc['url.raw'].value.length() - 1); i >= 0 ; i--) { tempString = tempString + (doc['url.raw'].value).charAt(i); } return tempString; } else { return \"emptyUrl\"; }" | ||||
); | ||||
await retry.try(async function () { | ||||
expect(parseInt(await PageObjects.settings.getScriptedFieldsTabCount())).to.be( | ||||
startingCount + 2 | ||||
); | ||||
}); | ||||
} | ||||
|
||||
await PageObjects.discover.selectIndexPattern('logstash-*'); | ||||
await queryBar.setQuery('php* OR *jpg OR *css*'); | ||||
await testSubjects.click('querySubmitButton'); | ||||
await retry.tryForTime(30000, async function () { | ||||
expect(await PageObjects.discover.getHitCount()).to.be('13,301'); | ||||
}); | ||||
}); | ||||
}); | ||||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+2.74 KB
x-pack/test/functional/es_archives/kibana_scripted_fields_on_logstash/data.json.gz
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is nice, imagine how much time would be saved if we regularly do it that way. which reminds me, I recently created a helper for that, in the TimePickerProvider, but it's using a different start, end time
kibana/test/functional/page_objects/time_picker.ts
Line 58 in 3ee0bf2