updated docs to include config option, details about the new testing process added to CONTRIBUTING.md, grunt-saucelabs returned to upstream
This commit is contained in:
@ -4,15 +4,51 @@ The process for contributing to any of the Elasticsearch repositories is similar
|
||||
|
||||
1. Lint your codes
|
||||
|
||||
While developing, be sure to run JSHint on the files you modify. This is simple with most IDE's and the project has .jshintrc files in the proper places, make sure jshint is using them.
|
||||
While developing, be sure to run JSHint on the files you modify. This is simple with most IDE's and the project has [.jshintrc files](http://www.jshint.com/docs/) in the proper places, make sure jshint is using them.
|
||||
|
||||
2. Write tests
|
||||
|
||||
Please write test cases to exercise your changes.
|
||||
|
||||
2. When you're ready to run the tests
|
||||
2. When you are ready, run the test suite
|
||||
|
||||
1. Install dev dependenies.
|
||||
|
||||
```sh
|
||||
npm install
|
||||
```
|
||||
|
||||
2. Install Grunt.
|
||||
|
||||
```sh
|
||||
npm install -g grunt-cli
|
||||
```
|
||||
3. Run the tests This will lint the code, run the unit tests, install local versions of elasticsearch, and run the integration tests using those installations.
|
||||
|
||||
***WARNING***: If you are running Elasticsearch on your machine, and it is using port 9200, shut it down.
|
||||
|
||||
```sh
|
||||
grunt test
|
||||
```
|
||||
|
||||
Or to skip the integration tests:
|
||||
|
||||
```sh
|
||||
grunt test_unit
|
||||
```
|
||||
4. Optionally, run the browser tests. While this step is automated and simple, it can take several minutes for the test to complete. Unless you are making changes to browser specific portions of the code you can probably let Travis run the browser tests for you.
|
||||
|
||||
Quick Option: Run them locally in your browser
|
||||
```sh
|
||||
grunt run:browser_test_server
|
||||
# open http://localhost:8000/browser.html, angular.html, or jquery.html
|
||||
```
|
||||
|
||||
Run them on Sauce Labs across several browsers, operating systems, and browser versions
|
||||
```sh
|
||||
grunt saucelabs-mocha
|
||||
```
|
||||
|
||||
Integration and unit tests can be run by simply calling `npm test` or `grunt test`, but the integration tests require a running instance of elasticsearch and ***WILL WIPE ALL DATA FROM ELASTICSEARCH***. If you only want to run the unit tests, run `grunt unit_test` instead. Travis and Jenkins run the integration tests so your changes can be verified before they are merged.
|
||||
|
||||
3. Submit a pull request
|
||||
|
||||
|
||||
@ -25,6 +25,8 @@ Default:::
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
`log`[[config-log]]:: `String, String[], Object, Object[], Constructor` -- Unless a constructor is specified, this sets the output settings for the bundled logger. See the section on configuring-logging[logging] for more information.
|
||||
|
||||
Default in Node:::
|
||||
@ -39,25 +41,15 @@ Default in Node:::
|
||||
|
||||
|
||||
|
||||
`connectionClass`[[config-connectionClass]]:: `String, Constructor` -- Defines the class that will be used to create connections to store in the connection pool. If you are looking to implement additional protocols you should probably start by writing a Connection class that extends the ConnectionAbstract.
|
||||
|
||||
Defaults:::
|
||||
* Node: `"http"`
|
||||
* Browser Build: `"xhr"`
|
||||
* Angular Build: `"angular"`
|
||||
* jQuery Build: `"jquery"`
|
||||
|
||||
|
||||
`apiVersion`[[config-api-version]]:: `String` -- Change the API that they client provides, specify the major version of the Elasticsearch nodes you will be connecting to.
|
||||
|
||||
`selector`:: `String, Function` -- This function will be used to select a connection from the ConnectionPool. It should received a single argument, the list of "active" connections, and return the connection to use. Use this selector to implement special logic for your client such as preferring nodes in a certain rack or data-center.
|
||||
+
|
||||
To make this function asynchronous, accept a second argument which will be the callback to use. The callback should be called Node-style with a possible error like: `cb(err, selectedConnection)`.
|
||||
Default ::: `master`
|
||||
|
||||
Default::: `"roundRobin"`
|
||||
|
||||
Options:::
|
||||
* `"roundRobin"`
|
||||
* `"random"`
|
||||
Options :::
|
||||
* `"master"`
|
||||
* `"0.90"`
|
||||
|
||||
|
||||
|
||||
@ -123,6 +115,32 @@ Default::: `60000`
|
||||
|
||||
|
||||
|
||||
|
||||
`connectionClass`[[config-connectionClass]]:: `String, Constructor` -- Defines the class that will be used to create connections to store in the connection pool. If you are looking to implement additional protocols you should probably start by writing a Connection class that extends the ConnectionAbstract.
|
||||
|
||||
Defaults:::
|
||||
* Node: `"http"`
|
||||
* Browser Build: `"xhr"`
|
||||
* Angular Build: `"angular"`
|
||||
* jQuery Build: `"jquery"`
|
||||
|
||||
|
||||
|
||||
|
||||
`selector`:: `String, Function` -- This function will be used to select a connection from the ConnectionPool. It should received a single argument, the list of "active" connections, and return the connection to use. Use this selector to implement special logic for your client such as preferring nodes in a certain rack or data-center.
|
||||
+
|
||||
To make this function asynchronous, accept a second argument which will be the callback to use. The callback should be called Node-style with a possible error like: `cb(err, selectedConnection)`.
|
||||
|
||||
Default::: `"roundRobin"`
|
||||
|
||||
Options:::
|
||||
* `"roundRobin"`
|
||||
* `"random"`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
`defer`:: `Function` -- Override the way that the client creates promises. If you would rather use any other promise library this is how you'd do that. Elasticsearch.js expects that the defer object has a `promise` property (which will be returned to promise consumers), as well as `resolve` and `reject` methods.
|
||||
|
||||
Default:::
|
||||
|
||||
@ -23,17 +23,12 @@ module.exports = function (grunt) {
|
||||
|
||||
grunt.registerTask('unit_test', [
|
||||
'jshint',
|
||||
'mochacov:unit'
|
||||
'run:generate',
|
||||
'mochacov:unit',
|
||||
]);
|
||||
|
||||
grunt.registerTask('coverage', [
|
||||
'mochacov:make_coverage_html',
|
||||
'open:coverage'
|
||||
]);
|
||||
|
||||
grunt.registerTask('travis', [
|
||||
'test',
|
||||
'browser_clients:test',
|
||||
'mochacov:ship_coverage'
|
||||
]);
|
||||
};
|
||||
@ -48,7 +48,7 @@
|
||||
"expect.js": "~0.2.0",
|
||||
"aliasify": "~1.2.1",
|
||||
"express": "~3.4.7",
|
||||
"grunt-saucelabs": "git://github.com/spenceralger/grunt-saucelabs.git#mocha_pending_pass"
|
||||
"grunt-saucelabs": "git+ssh://git@github.com:axemclion/grunt-saucelabs.git#01b68705a6823ff86930f28296ac6467fbea244b"
|
||||
},
|
||||
"license": "Apache 2.0",
|
||||
"dependencies": {
|
||||
|
||||
Reference in New Issue
Block a user