Skip to content
Browse files

Fix bugs with running as a Selenium Grid node:

* Host IP number not used in solution for #104
* Exit on error (rather than hanging)
* Check that grid registration was successful
  • Loading branch information...
1 parent a6a6c01 commit 320cb5e7f5162b77c07dcac4f49fad80b2320417 @garyd203 garyd203 committed Oct 31, 2012
Showing with 9 additions and 5 deletions.
  1. +9 −5 src/hub_register.js
View
14 src/hub_register.js
@@ -55,7 +55,7 @@ var nodeconf = function(ip, port, hub){
};
module.exports = {
- register: function(port, hub){
+ register: function(ip, port, hub){
var page = require('webpage').create();
port = +port;
if (!hub.match(/\/$/)) {
@@ -65,16 +65,20 @@ module.exports = {
/* Register with selenium grid server */
page.open(hub + 'grid/register', {
operation: 'post',
- data: JSON.stringify(nodeconf(port, hub)),
+ data: JSON.stringify(nodeconf(ip, port, hub)),
headers: {
'Content-Type': 'application/json'
}
}, function(status){
if (status !== 'success') {
- return console.log("Unable to register with grid " + hub + ": " + status);
- } else {
- return console.log(("registered with grid hub: " + hub) + page.content);
+ console.error("Unable to contact grid " + hub + ": " + status);
+ phantom.exit(1);
}
+ if (page.framePlainText !== "ok") {
+ console.error("Problem registering with grid " + hub + ": " + page.content);
+ phantom.exit(1);
+ }
+ console.log("Registered with grid hub: " + hub + " (" + page.framePlainText +")");
});
}
};

0 comments on commit 320cb5e

Please sign in to comment.
Something went wrong with that request. Please try again.