Skip to content

Comments

Add checkPlugins task to check for plugins before running tests.#8981

Merged
cjcenizal merged 3 commits intoelastic:masterfrom
cjcenizal:improvement/check-plugins-task
Nov 16, 2016
Merged

Add checkPlugins task to check for plugins before running tests.#8981
cjcenizal merged 3 commits intoelastic:masterfrom
cjcenizal:improvement/check-plugins-task

Conversation

@cjcenizal
Copy link
Contributor

@cjcenizal cjcenizal commented Nov 5, 2016

image

@cjcenizal cjcenizal force-pushed the improvement/check-plugins-task branch from cd60ff6 to 9e71c77 Compare November 5, 2016 13:04
@cjcenizal cjcenizal added the Team:Operations Kibana-Operations Team label Nov 5, 2016
Copy link
Member

@tylersmalley tylersmalley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple comments

package.json Outdated
"test:coverage": "grunt test:coverage",
"test:visualRegression": "grunt test:visualRegression",
"checkLicenses": "grunt licenses",
"checkPlugins": "grunt checkPlugins",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is more of a dependency for other tasks, what do you think about removing the definition here?

tasks/test.js Outdated
module.exports = function (grunt) {
grunt.registerTask('checkPlugins', 'Checks for plugins which may disrupt tests', function checkPlugins() {
const done = this.async();
const pluginsDir = path.resolve('./plugins/');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping there was a better way to get this path as opposed to assembling it, but that doesn't appear to be the case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the folder paths are defined in Gruntfile.js, thoughts on moving this there?

tasks/test.js Outdated
const visualRegression = require('../utilities/visual_regression');

module.exports = function (grunt) {
grunt.registerTask('checkPlugins', 'Checks for plugins which may disrupt tests', function checkPlugins() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is in the test task, we should namespace it to keep consistent with the rest of the tasks here. test:checkPlugins

(say test task 5 times fast)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test task tes tast tesk tast testass tesp tasp. No sweat!

I was thinking that this task is like checkLicenses, which isn't name-spaced. They're alike in that they both validate some conditions of the code, but don't execute any of it... so they're not really tests, in that sense. I think we should leave the name-space off. Are you OK with that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough

tasks/test.js Outdated
const done = this.async();
const pluginsDir = path.resolve('./plugins/');

fs.readdir(pluginsDir, (err, files) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should handle the error case as the message given isn't very helpful.

> kibana@6.0.0-alpha1 checkPlugins /Users/tyler/Code/tylersmalley/kibana-6
> grunt checkPlugins

Running "checkPlugins" task
Fatal error: Cannot read property 'filter' of undefined

npm ERR! Darwin 15.6.0
npm ERR! argv "/Users/tyler/.nvm/versions/node/v6.9.0/bin/node" "/Users/tyler/.nvm/versions/node/v6.9.0/bin/npm" "run" "checkPlugins"
npm ERR! node v6.9.0
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! kibana@6.0.0-alpha1 checkPlugins: `grunt checkPlugins`
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the kibana@6.0.0-alpha1 checkPlugins script 'grunt checkPlugins'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the kibana package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     grunt checkPlugins
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs kibana
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls kibana
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/tyler/Code/tylersmalley/kibana-6/npm-debug.log


grunt.registerTask('test:server', [ 'esvm:test', 'simplemocha:all', 'esvm_shutdown:test' ]);
grunt.registerTask('test:browser', ['run:testServer', 'karma:unit']);
grunt.registerTask('test:server', [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for line breaks

Copy link
Member

@tylersmalley tylersmalley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tylersmalley
Copy link
Member

@jbudz, mind being a second reviewer on this?

@jbudz
Copy link
Contributor

jbudz commented Nov 15, 2016

As a heads up, there are external tests already running with plugins that use these tasks - there's a wip at #8626 for integration tests, and x-plugins does use npm run test:(browser/dev) with a custom plugin dir. /cc @LeeDr

tasks/test.js Outdated
const visualRegression = require('../utilities/visual_regression');

module.exports = function (grunt) {
grunt.registerTask('checkPlugins', 'Checks for plugins which may disrupt tests', function checkPlugins() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thoughts on moving this task to its own file?

@cjcenizal
Copy link
Contributor Author

@jbudz When you say "plugins that use these tasks" which tasks are you referring to?

@cjcenizal cjcenizal merged commit 038a834 into elastic:master Nov 16, 2016
@cjcenizal cjcenizal deleted the improvement/check-plugins-task branch November 16, 2016 00:11
elastic-jasper added a commit that referenced this pull request Nov 16, 2016
Backports PR #8981

**Commit 1:**
Add checkPlugins task to check for plugins before running tests.

* Original sha: 9e71c77
* Authored by CJ Cenizal <cj@cenizal.com> on 2016-11-05T05:02:13Z

**Commit 2:**
Remove checkPlugins npm script. Gracefully handle error case.

* Original sha: 98ec182
* Authored by CJ Cenizal <cj@cenizal.com> on 2016-11-09T20:51:47Z

**Commit 3:**
Move checkPlugins task into its own module.

* Original sha: bba7274
* Authored by CJ Cenizal <cj@cenizal.com> on 2016-11-15T23:40:41Z
cjcenizal pushed a commit that referenced this pull request Nov 16, 2016
Backports PR #8981

**Commit 1:**
Add checkPlugins task to check for plugins before running tests.

* Original sha: 9e71c77
* Authored by CJ Cenizal <cj@cenizal.com> on 2016-11-05T05:02:13Z

**Commit 2:**
Remove checkPlugins npm script. Gracefully handle error case.

* Original sha: 98ec182
* Authored by CJ Cenizal <cj@cenizal.com> on 2016-11-09T20:51:47Z

**Commit 3:**
Move checkPlugins task into its own module.

* Original sha: bba7274
* Authored by CJ Cenizal <cj@cenizal.com> on 2016-11-15T23:40:41Z
@epixa epixa added v5.1.1 and removed v5.1.0 labels Dec 8, 2016
airow pushed a commit to airow/kibana that referenced this pull request Feb 16, 2017
…stic#9094)

Backports PR elastic#8981

**Commit 1:**
Add checkPlugins task to check for plugins before running tests.

* Original sha: 9e71c77
* Authored by CJ Cenizal <cj@cenizal.com> on 2016-11-05T05:02:13Z

**Commit 2:**
Remove checkPlugins npm script. Gracefully handle error case.

* Original sha: 98ec182
* Authored by CJ Cenizal <cj@cenizal.com> on 2016-11-09T20:51:47Z

**Commit 3:**
Move checkPlugins task into its own module.

* Original sha: bba7274
* Authored by CJ Cenizal <cj@cenizal.com> on 2016-11-15T23:40:41Z

Former-commit-id: 6d0cee0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants