Skip to content
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

Run tests against an actual Kibana build #11237

Merged
merged 14 commits into from
Apr 21, 2017
18 changes: 18 additions & 0 deletions tasks/config/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module.exports = function (grunt) {
const root = p => resolve(__dirname, '../../', p);
const binScript = /^win/.test(platform) ? '.\\bin\\kibana.bat' : './bin/kibana';
const buildScript = /^win/.test(platform) ? '.\\build\\kibana\\bin\\kibana.bat' : './build/kibana/bin/kibana';
const pkgVersion = grunt.config.get('pkg.version');
const releaseBinScript = `./build/kibana-${pkgVersion}-linux-x86_64/bin/kibana`;
Copy link
Member

Choose a reason for hiding this comment

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

can we make this dynamic? a combination of os.platform() and os.arch() should get us there

Copy link
Author

@rhoboat rhoboat Apr 20, 2017

Choose a reason for hiding this comment

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

  • make dynamic; a combination of os.platform() and os.arch()
    Leaving this undone, we will want to revisit and make sure the tests can run on more than just linux-x86_64, but for now this it.

const uiConfig = require(root('test/server_config'));

const stdDevArgs = [
Expand Down Expand Up @@ -77,6 +79,22 @@ module.exports = function (grunt) {
]
},

testUIReleaseServer: {
options: {
wait: false,
ready: /Server running/,
quiet: false,
failOnError: false
},
cmd: releaseBinScript,
args: [
...stdDevArgs,
'--server.port=' + uiConfig.servers.kibana.port,
'--elasticsearch.url=' + format(uiConfig.servers.elasticsearch),
...kbnServerFlags,
]
},

Copy link
Author

Choose a reason for hiding this comment

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

This is copypasta from testUIServer. Is there a better way? Maybe reference the previous object and merge/extend it?

Copy link
Contributor

@thomasneirynck thomasneirynck Apr 20, 2017

Choose a reason for hiding this comment

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

It's your judgement call I'd say :). Something like the below isn't all that unwieldy.
const uiConfig = ...the thing...

 testUIServer: {
      ...uiConfig,
      cmd: binScript
    },

    testUIReleaseServer: {
      ...uiConfig,
      cmd: binScript
    },

Either way's fine IMHO

testUIDevServer: {
options: {
wait: false,
Expand Down
2 changes: 1 addition & 1 deletion tasks/jenkins.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = function (grunt) {
'jenkins:env',
'rejectRejFiles',

'test:ui'
'test:uiRelease'
]);

};
10 changes: 10 additions & 0 deletions tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ module.exports = function (grunt) {
'stop:testUIServer'
]);

grunt.registerTask('test:uiRelease', [
'checkPlugins',
'esvm:ui',
'run:testUIReleaseServer',
'clean:screenshots',
'functionalTestRunner',
'esvm_shutdown:ui',
'stop:testUIReleaseServer'
]);

Copy link
Author

Choose a reason for hiding this comment

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

Also copypasta. Hm. I suppose one could pass in an array that's reused except for certain items, but I don't think it looks so great in this case. Would be super unclear indirection.

grunt.registerTask('test:ui:server', [
'checkPlugins',
'esvm:ui',
Expand Down
2 changes: 2 additions & 0 deletions test/scripts/jenkins_selenium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
set -e
source "$(dirname $0)/_jenkins_setup.sh"

"$(npm bin)/grunt" build --release;
Copy link
Author

Choose a reason for hiding this comment

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

Is this ok to do? Do we care that we're not running tests against the SNAPSHOT build?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know, doesn't look bad to me. Maybe @LeeDr has input?


xvfb-run "$(npm bin)/grunt" jenkins:selenium;