EBernhardson has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/396553 )
Change subject: Port remaining dump_* features to nodejs ...................................................................... Port remaining dump_* features to nodejs I changed these up a bit to make them simpler. Basically each one now has a specific Then( ... ) test for it. The previous tests were just string includes against the stringified json, this seemed perhaps better at verifying we have somewhat reasonable output. Change-Id: I4d2a0789ae17e880304cc42baeb58735e9b2c66b --- A tests/integration/features/dump_config.feature A tests/integration/features/dump_mapping.feature A tests/integration/features/dump_query.feature A tests/integration/features/dump_settings.feature M tests/integration/features/step_definitions/page_steps.js 5 files changed, 120 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch refs/changes/53/396553/1 diff --git a/tests/integration/features/dump_config.feature b/tests/integration/features/dump_config.feature new file mode 100644 index 0000000..fc85cf1 --- /dev/null +++ b/tests/integration/features/dump_config.feature @@ -0,0 +1,8 @@ +@clean @dump_config @phantomjs +Feature: You can dump CirrusSearch's configuration + Scenario: You can dump CirrusSearch's configuration + When I dump the cirrus config + Then the config dump contains CirrusSearchPhraseSuggestMaxErrors + And the config dump contains CirrusSearchNamespaceWeights + And the config dump text does not contain Password + And the config dump text does not contain password diff --git a/tests/integration/features/dump_mapping.feature b/tests/integration/features/dump_mapping.feature new file mode 100644 index 0000000..a0f1776 --- /dev/null +++ b/tests/integration/features/dump_mapping.feature @@ -0,0 +1,5 @@ +@clean @dump_mapping @phantomjs +Feature: You can dump the mapping CirrusSearch set on Elasticsearch's indexes + Scenario: You can dump the mapping CirrusSearch set on Elasticsearch's indexes + When I dump the cirrus mapping + Then A valid mapping dump is produced diff --git a/tests/integration/features/dump_query.feature b/tests/integration/features/dump_query.feature new file mode 100644 index 0000000..49aa588 --- /dev/null +++ b/tests/integration/features/dump_query.feature @@ -0,0 +1,5 @@ +@clean @dump_quer @phantomjs +Feature: Can dump the query syntax + Scenario: Can dump the query syntax + Given I request a query dump for main page + Then A valid query dump for main page is produced diff --git a/tests/integration/features/dump_settings.feature b/tests/integration/features/dump_settings.feature new file mode 100644 index 0000000..d0d9c43 --- /dev/null +++ b/tests/integration/features/dump_settings.feature @@ -0,0 +1,5 @@ +@clean @dump_settings @phantomjs +Feature: You can dump the settings CirrusSearch set on Elasticsearch's indexes + Scenario: You can dump the settings CirrusSearch set on Elasticsearch's indexes + When I dump the cirrus settings + Then A valid settings dump is produced diff --git a/tests/integration/features/step_definitions/page_steps.js b/tests/integration/features/step_definitions/page_steps.js index bb3eec6..dd1a56d 100644 --- a/tests/integration/features/step_definitions/page_steps.js +++ b/tests/integration/features/step_definitions/page_steps.js @@ -496,4 +496,101 @@ } ); } ); } ); + + When( /^I dump the cirrus config$/, Promise.coroutine( function* () { + let client = yield this.onWiki(); + try { + let response = yield client.request( { + action: 'cirrus-config-dump', + } ); + this.setApiResponse( response ); + } catch ( err ) { + this.setApiError( err ); + } + } ) ); + + Then( /^the config dump contains (.+)$/, function ( key ) { + return withApi( this, () => { + expect( this.apiResponse ).to.have.any.keys( key ); + } ); + } ); + + Then( /^the config dump text does not contain (.+)$/, function ( key ) { + return withApi( this, () => { + let text = JSON.stringify( this.apiResponse ); + expect( text ).to.not.include( key ); + } ); + } ); + + When( /^I dump the cirrus mapping$/, Promise.coroutine( function* () { + let client = yield this.onWiki(); + try { + let response = yield client.request( { + action: 'cirrus-mapping-dump', + } ); + this.setApiResponse( response ); + } catch ( err ) { + this.setApiError( err ); + } + } ) ); + + Then( /^A valid mapping dump is produced$/, function () { + return withApi( this, () => { + expect( this.apiError ).to.equal( undefined ); + expect( this.apiResponse ).to.include.all.keys( 'content', 'general' ) + expect( this.apiResponse.content ).to.have.all.keys( 'archive', 'namespace', 'page' ); + expect( this.apiResponse.content.page ).to.have.all.keys( + 'dynamic', '_all', 'properties' ); + expect( this.apiResponse.content.page.properties ).to.include.keys( + 'all', 'all_near_match', 'title', 'category', 'redirect' ); + } ); + } ); + + When( /^I dump the cirrus settings$/, Promise.coroutine( function* () { + let client = yield this.onWiki(); + try { + let response = yield client.request( { + action: 'cirrus-settings-dump', + } ); + this.setApiResponse( response ); + } catch ( err ) { + this.setApiError( err ); + } + } ) ); + + Then( /^A valid settings dump is produced$/, function () { + return withApi( this, () => { + expect( this.apiError ).to.equal( undefined ); + expect( this.apiResponse ).to.include.all.keys( 'content', 'general' ) + expect( this.apiResponse.content ).to.include.all.keys( 'page' ); + expect( this.apiResponse.content.page.index ).to.include.all.keys( 'refresh_interval' ); + } ); + } ); + + Given( /^I request a query dump for (.+)$/, function ( query ) { + return Promise.coroutine( function* () { + let client = yield this.onWiki(); + try { + let response = yield client.request( { + action: 'query', + list: 'search', + srsearch: query, + cirrusDumpQuery: 1 + } ); + this.setApiResponse( response ); + } catch ( err ) { + this.setApiError( err ); + } + } ).call( this ); + } ); + + Then( /^A valid query dump for (.+) is produced$/, function ( query ) { + return withApi( this, () => { + expect( this.apiResponse ).to.be.an( 'object' ); + expect( this.apiResponse ).to.include.keys( + 'description', 'path', 'params', 'query', 'options' ); + expect( this.apiResponse.description ).to.equal( + `full_text search for '${query}'` ); + } ); + } ); }); -- To view, visit https://gerrit.wikimedia.org/r/396553 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4d2a0789ae17e880304cc42baeb58735e9b2c66b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CirrusSearch Gerrit-Branch: master Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits