You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/10/01 22:03:42 UTC
usergrid git commit: add consistency to rest integration
Repository: usergrid
Updated Branches:
refs/heads/2.1-release 9ceae7748 -> 62f41d011
add consistency to rest integration
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/62f41d01
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/62f41d01
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/62f41d01
Branch: refs/heads/2.1-release
Commit: 62f41d011b1ac73c3c5dc9e484f68d6461617395
Parents: 9ceae77
Author: Shawn Feldman <sf...@apache.org>
Authored: Thu Oct 1 14:03:39 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Thu Oct 1 14:03:39 2015 -0600
----------------------------------------------------------------------
stack/rest_integration_tests/config/default.js | 2 +
stack/rest_integration_tests/lib/entities.js | 2 +-
.../test/entities/create.js | 47 +++++++++++++-------
3 files changed, 33 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/62f41d01/stack/rest_integration_tests/config/default.js
----------------------------------------------------------------------
diff --git a/stack/rest_integration_tests/config/default.js b/stack/rest_integration_tests/config/default.js
index 5140638..f3b8c17 100644
--- a/stack/rest_integration_tests/config/default.js
+++ b/stack/rest_integration_tests/config/default.js
@@ -19,6 +19,8 @@ module.exports = {
orgName: "test-organization", //must
appName: "test-app", //must pre create app
numberOfUsers: 5,
+ numberOfEntitiesConsistent: 100,
+ consistentChecks:3,
numberOfEntities: 20,
org: {
clientId: "",
http://git-wip-us.apache.org/repos/asf/usergrid/blob/62f41d01/stack/rest_integration_tests/lib/entities.js
----------------------------------------------------------------------
diff --git a/stack/rest_integration_tests/lib/entities.js b/stack/rest_integration_tests/lib/entities.js
index 3693dcb..d9633a7 100644
--- a/stack/rest_integration_tests/lib/entities.js
+++ b/stack/rest_integration_tests/lib/entities.js
@@ -69,7 +69,7 @@ module.exports = {
body: options
}, function(e, r, body) {
var error = responseLib.getError(e, r);
- returnBody.push(body.entities[0]);
+ !error && returnBody.push(body.entities[0]);
cb(error, error ? error : body.entities[0]);
});
}, function(err,bodies) {
http://git-wip-us.apache.org/repos/asf/usergrid/blob/62f41d01/stack/rest_integration_tests/test/entities/create.js
----------------------------------------------------------------------
diff --git a/stack/rest_integration_tests/test/entities/create.js b/stack/rest_integration_tests/test/entities/create.js
index c7e6f42..faccee8 100644
--- a/stack/rest_integration_tests/test/entities/create.js
+++ b/stack/rest_integration_tests/test/entities/create.js
@@ -17,14 +17,15 @@
var entities = require("../../lib/entities");
var should = require("should");
var config = require('../../config');
-
+var async = require('async');
module.exports = {
test: function() {
- var numberOfRecords = 30;
var uuid = require("uuid");
- var id = "resttest_"+ uuid.v1().toString().replace("-", "");
+ var collectionName = "resttest_"+ uuid.v1().toString().replace("-", "");
describe("create entities", function() {
+ var numberOfRecords = config.numberOfEntities;
+
it("should create " + numberOfRecords.toString() + " entities in the " + config.entitiesTestCollection + " collection", function(done) {
this.slow(numberOfRecords * 500);
entities.create(config.entitiesTestCollection, numberOfRecords, function(err, body) {
@@ -36,24 +37,36 @@ module.exports = {
done();
})
});
- it("should create " + numberOfRecords.toString() + " entities in the " + id + " collection and check for consistency", function(done) {
- this.slow(numberOfRecords * 500);
- entities.createEach(id, numberOfRecords, function(err, bodies) {
- should(err).be.null;
- bodies.should.be.an.instanceOf(Array).and.have.lengthOf(numberOfRecords);
- bodyMap = {};
- bodies.forEach(function(body){
- bodyMap[body.uuid] = body;
- });
- entities.get(id, numberOfRecords, function (err,entityArray) {
+ var numberOfRecordsConsistent = config.numberOfEntitiesConsistent;
+ it("should create " + numberOfRecordsConsistent.toString() + " entities in the " + collectionName + " collection and check for consistency", function(done) {
+ this.timeout(60000*100);
+ bodyMap = {};
+
+ //this.slow(numberOfRecordsConsistent * 500);
+ async.times(config.consistentChecks, function(n, next) {
+ entities.createEach(collectionName+n, numberOfRecordsConsistent, function (err, bodies) {
should(err).be.null;
- entityArray.entities.forEach(function(entity){
- delete(bodyMap[entity.uuid]);
+ bodies.should.be.an.instanceOf(Array).and.have.lengthOf(numberOfRecordsConsistent);
+ bodies.forEach(function (body) {
+ bodyMap[body.uuid] = body;
+ });
+ entities.get(collectionName+n, numberOfRecordsConsistent, function (err, entityArray) {
+ should(err).be.null;
+ next(err,entityArray);
});
+ });
+ },
+ function(err,list){
+ list.forEach(function (listOfEntities) {
+ listOfEntities.entities.forEach(function(entity){
+ delete(bodyMap[entity.uuid]);
+ });
+ });
+ Object.keys(bodyMap).length && console.log(JSON.stringify(bodyMap));
should(Object.keys(bodyMap)).have.lengthOf(0);
done();
- });
- });
+ }
+ );
});
});
}