This is an automated email from the ASF dual-hosted git repository.

berstler pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/incubator-openwhisk-package-alarms.git


The following commit(s) were added to refs/heads/master by this push:
     new 5a7d68f  Add HOST_MACHINE and HOST_INDEX env vars (remove ACTIVE) (#69)
5a7d68f is described below

commit 5a7d68ff908ab038a253358738e5bc622e57dc24
Author: Jason Peterson <jason...@us.ibm.com>
AuthorDate: Tue Jun 27 14:50:36 2017 -0400

    Add HOST_MACHINE and HOST_INDEX env vars (remove ACTIVE) (#69)
---
 provider/lib/active.js                                            | 5 ++---
 provider/lib/utils.js                                             | 7 ++++---
 .../src/test/scala/system/redundancy/AlarmsRedundancyTests.scala  | 8 ++++----
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/provider/lib/active.js b/provider/lib/active.js
index 59e42fe..b5c7ea1 100644
--- a/provider/lib/active.js
+++ b/provider/lib/active.js
@@ -9,6 +9,7 @@ module.exports = function(logger, utils) {
       var response = {
           worker: utils.worker,
           host: utils.host,
+          hostMachine: utils.hostMachine,
           active: utils.host === utils.activeHost
       };
 
@@ -29,9 +30,7 @@ module.exports = function(logger, utils) {
                   .then(() => {
                       response.active = 'swapping';
                       utils.redisClient.publish(utils.redisHash, activeHost);
-                      var msg = 'Active host swap in progress';
-                      logger.info(method, msg);
-                      response.message = msg;
+                      logger.info(method, 'Active host swap in progress');
                       res.send(response);
                   })
                   .catch(err => {
diff --git a/provider/lib/utils.js b/provider/lib/utils.js
index 9b366e4..dcbdad5 100644
--- a/provider/lib/utils.js
+++ b/provider/lib/utils.js
@@ -1,8 +1,9 @@
 var _ = require('lodash');
 var request = require('request');
 var CronJob = require('cron').CronJob;
-var constants = require('./constants.js');
 var HttpStatus = require('http-status-codes');
+var constants = require('./constants.js');
+
 
 module.exports = function(
   logger,
@@ -14,7 +15,8 @@ module.exports = function(
     this.endpointAuth = process.env.ENDPOINT_AUTH;
     this.routerHost = process.env.ROUTER_HOST || 'localhost';
     this.worker = process.env.WORKER || "worker0";
-    this.host = process.env.ACTIVE !== undefined && 
process.env.ACTIVE.toLowerCase() === 'false' ? 'host1' : 'host0';
+    this.host = process.env.HOST_INDEX || 'host0';
+    this.hostMachine = process.env.HOST_MACHINE;
     this.activeHost = 'host0'; //default value on init (will be updated for 
existing redis)
     this.redisClient = redisClient;
     this.redisHash = triggerDB.config.db + '_' + this.worker;
@@ -24,7 +26,6 @@ module.exports = function(
     var retryAttempts = constants.RETRY_ATTEMPTS;
     var ddname = constants.DESIGN_DOC_NAME;
     var filter = constants.FILTER_FUNCTION;
-
     var utils = this;
 
     this.createTrigger = function(triggerIdentifier, newTrigger) {
diff --git a/tests/src/test/scala/system/redundancy/AlarmsRedundancyTests.scala 
b/tests/src/test/scala/system/redundancy/AlarmsRedundancyTests.scala
index 63d76d0..c55b3a7 100644
--- a/tests/src/test/scala/system/redundancy/AlarmsRedundancyTests.scala
+++ b/tests/src/test/scala/system/redundancy/AlarmsRedundancyTests.scala
@@ -27,8 +27,8 @@ import spray.json.{pimpAny, _}
 /**
  * These tests verify that an alarms redundancy (master/slave) configuration
  * works as expected.  They will only run properly in an environment with two
- * alarms containers running concurrently and env var ACTIVE set to true in
- * one container and false in the other.  This test also assumes that redis and
+ * alarms containers running concurrently and env var HOST_INDEX set to host0 
in
+ * one container and host1 in the other.  This test also assumes that redis and
  * the active endpoint authorization are configured.  For the auth set the
  * ENDPOINT_AUTH env var in your containers to match the testing.auth property
  * found in your whisk.properties.  To configure redis simply set the REDIS_URL
@@ -44,7 +44,7 @@ class AlarmsRedundancyTests
 
     val wskprops = WskProps()
     val wsk = new Wsk
-    var edgeHost = WhiskProperties.getEdgeHost()
+    var edgeHost = WhiskProperties.getEdgeHost
     val auth = WhiskProperties.getBasicAuth
     val user = auth.fst
     val password = auth.snd
@@ -145,7 +145,7 @@ class AlarmsRedundancyTests
                 get(endpointURL)
         assert(response.statusCode() == 200)
         var result = response.body.asString.parseJson.asJsObject
-        JsObject(result.fields - "message") shouldBe expectedResult
+        JsObject(result.fields - "hostMachine") shouldBe expectedResult
     }
 
     override def afterAll() {

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <commits@openwhisk.apache.org>'].

Reply via email to