usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mru...@apache.org
Subject usergrid git commit: Add some delay to node.js tests.
Date Sat, 27 Feb 2016 00:32:33 GMT
Repository: usergrid
Updated Branches:
  refs/heads/release-2.1.1 0eda1b683 -> 9c8944657


Add some delay to node.js tests.


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/9c894465
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/9c894465
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/9c894465

Branch: refs/heads/release-2.1.1
Commit: 9c8944657b1168b9f0929050c294ff807bfbea88
Parents: 0eda1b6
Author: Michael Russo <mrusso@apigee.com>
Authored: Fri Feb 26 16:32:31 2016 -0800
Committer: Michael Russo <mrusso@apigee.com>
Committed: Fri Feb 26 16:32:31 2016 -0800

----------------------------------------------------------------------
 .../test/notifications/notifications.js         | 72 ++++++++++++++++----
 .../test/queries/integerComparison.js           | 31 +++++----
 tests/integration/test/setup.js                 |  4 +-
 3 files changed, 78 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/9c894465/tests/integration/test/notifications/notifications.js
----------------------------------------------------------------------
diff --git a/tests/integration/test/notifications/notifications.js b/tests/integration/test/notifications/notifications.js
index 07e7642..644510f 100644
--- a/tests/integration/test/notifications/notifications.js
+++ b/tests/integration/test/notifications/notifications.js
@@ -72,7 +72,9 @@ module.exports = {
 
             payloads: {
                 gcm: "Usergrid Integration Push Test - GCM"
-            }
+            },
+            debug: true,
+            priority: 'high'
         };
 
 
@@ -97,8 +99,9 @@ module.exports = {
 
         describe("users", function () {
             it("should create some users", function (done) {
-                this.slow(2000);
-                async.each(usersArray, function (user, cb) {
+                this.slow(5000);
+
+                async.eachSeries(usersArray, function (user, cb) {
                     users.add(user, function (err, user) {
                         should(err).be.null;
                         user.should.not.be.null;
@@ -106,7 +109,13 @@ module.exports = {
                     });
                 }, function (err) {
 
-                    done();
+                    setTimeout(function() {
+
+                        // wait a second before proceeding
+                        done();
+
+                    }, 1000);
+
 
                 });
 
@@ -117,7 +126,7 @@ module.exports = {
 
         describe("devices", function () {
             it("should create some devices", function (done) {
-                this.slow(2000);
+                this.slow(5000);
                 async.each(devicesArray, function (device, cb) {
                     devices.add(device, function (err, device) {
                         should(err).be.null;
@@ -127,7 +136,12 @@ module.exports = {
 
                 }, function (err) {
 
-                    done()
+                    setTimeout(function() {
+
+                        // wait a second before proceeding
+                        done();
+
+                    }, 1000);
 
                 });
 
@@ -149,7 +163,12 @@ module.exports = {
                     if (err) {
                         console.log("error adding users " + err);
                     }
-                    done();
+                    setTimeout(function() {
+
+                        // wait a second before proceeding
+                        done();
+
+                    }, 1000);
                 });
 
             })
@@ -159,7 +178,7 @@ module.exports = {
 
         describe("groups", function () {
             it("should create some groups", function (done) {
-                this.slow(2000);
+                this.slow(5000);
                 var group1 = {
                     path: "notificationgroup1"
                 };
@@ -191,7 +210,12 @@ module.exports = {
                     }
                 ], function (err, results) {
 
-                    done();
+                    setTimeout(function() {
+
+                        // wait a second before proceeding
+                        done();
+
+                    }, 1000);
 
                 });
 
@@ -203,7 +227,7 @@ module.exports = {
 
         describe("groups<->users", function () {
             it("should connect users to groups", function (done) {
-                this.slow(2000);
+                this.slow(5000);
                 async.each(usersArray, function (user, cb) {
 
                     async.series([
@@ -229,7 +253,12 @@ module.exports = {
                     });
 
                 }, function (err) {
-                    done();
+                    setTimeout(function() {
+
+                        // wait a second before proceeding
+                        done();
+
+                    }, 1000);
                 });
 
             })
@@ -245,12 +274,17 @@ module.exports = {
                 this.slow(5000);
                 setTimeout(function () {
 
-                    notifications.send("users/" + usersArray[1].username, gcmNotification,
+                    notifications.send("users/" + usersArray[0].username, gcmNotification,
                         function (err, notification) {
                             should(err).be.null;
                             notification.should.not.be.null;
                             notification.expectedCount.should.be.equal(1);
-                            done();
+                            setTimeout(function() {
+
+                                // wait a second before proceeding
+                                done();
+
+                            }, 1000);
 
                     });
 
@@ -273,7 +307,12 @@ module.exports = {
                             should(err).be.null;
                             notification.should.not.be.null;
                             notification.expectedCount.should.be.equal(1);
-                            done();
+                            setTimeout(function() {
+
+                                // wait a second before proceeding
+                                done();
+
+                            }, 1000);
 
                     });
 
@@ -298,8 +337,13 @@ module.exports = {
                             // we set up 2 groups of the same 5 users.  if duplicate filtering
is working,
                             // we'll only have 5 expected
                             notification.expectedCount.should.be.equal(5);
+                        setTimeout(function() {
+
+                            // wait a second before proceeding
                             done();
 
+                        }, 1000);
+
                     });
 
                 }, 1000);

http://git-wip-us.apache.org/repos/asf/usergrid/blob/9c894465/tests/integration/test/queries/integerComparison.js
----------------------------------------------------------------------
diff --git a/tests/integration/test/queries/integerComparison.js b/tests/integration/test/queries/integerComparison.js
index f3036f1..372a00c 100644
--- a/tests/integration/test/queries/integerComparison.js
+++ b/tests/integration/test/queries/integerComparison.js
@@ -57,19 +57,24 @@ module.exports = {
         var query3 = "select * where location within 10000 of 37.3236882,-121.9373442"; //San
Jose Airport
         describe("get horses " + query3, function() {
             it('should return a subset of results ' + query3, function() {
-                entities.getWithQuery('horses', query3, 10, function(err, body) {
-                    should(err).be.null;
-                    body.entities.should.be.an.instanceOf(Array);
-                    body.entities.length.should.be.greaterThan(0);
-                    if (body.entities.length > 0) {
-                        body.entities.length.should.be.greaterThan(0).and.lessThan(11);
-                        body.entities.forEach(function(entity) {
-                            // Apigee San Jose
-                            entity.location.latitude.should.be.equal(37.3338716);
-                            entity.location.longitude.should.be.equal(-121.894249);
-                        });
-                    }
-                });
+                //add some delay
+                setTimeout(function(){
+                    entities.getWithQuery('horses', query3, 10, function(err, body) {
+                        should(err).be.null;
+                        body.entities.should.be.an.instanceOf(Array);
+                        body.entities.length.should.be.greaterThan(0);
+                        if (body.entities.length > 0) {
+                            body.entities.length.should.be.greaterThan(0).and.lessThan(11);
+                            body.entities.forEach(function(entity) {
+                                // Apigee San Jose
+                                entity.location.latitude.should.be.equal(37.3338716);
+                                entity.location.longitude.should.be.equal(-121.894249);
+                            });
+                        }
+                    });
+
+                }, 2000);
+
             });
         });
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/9c894465/tests/integration/test/setup.js
----------------------------------------------------------------------
diff --git a/tests/integration/test/setup.js b/tests/integration/test/setup.js
index d254d8d..a31eef3 100644
--- a/tests/integration/test/setup.js
+++ b/tests/integration/test/setup.js
@@ -61,7 +61,7 @@ module.exports = {
                             email: id + "@uge2e.com"
                         });
                     }
-                    async.each(
+                    async.eachSeries(
                         userArr,
                         function(user, cb) {
                             users.add(user, function(err, user) {
@@ -86,7 +86,7 @@ module.exports = {
                             longitude: -121.894249
                         }
                     };
-                    async.parallel([
+                    async.series([
                             function(cb) {
 
                                 entities.create('dogs', entity, numberOfRecords, function(err,
body) {


Mime
View raw message