Continue initialization if redundant provider is creating the filter (#117)
* Continue initialization if redundant provider is creating the filter
* fix serialization self reference error for bulk document tests
diff --git a/provider/app.js b/provider/app.js
index 54b8934..4e37f85 100644
--- a/provider/app.js
+++ b/provider/app.js
@@ -51,7 +51,7 @@
if (!err) {
logger.info(method, 'created trigger database:', databaseName);
}
- else {
+ else if (err.statusCode !== 412) {
logger.info(method, 'failed to create trigger database:', databaseName, err);
}
var db = nanop.db.use(databaseName);
@@ -68,7 +68,7 @@
only_triggers_by_worker: only_triggers_by_worker
},
}, ddname, function (error, body) {
- if (error) {
+ if (error && error.statusCode !== 409) {
reject("filter could not be created: " + error);
}
resolve(db);
diff --git a/tests/src/test/scala/system/CloudantUtil.java b/tests/src/test/scala/system/CloudantUtil.java
index 91a7743..a861743 100755
--- a/tests/src/test/scala/system/CloudantUtil.java
+++ b/tests/src/test/scala/system/CloudantUtil.java
@@ -251,7 +251,7 @@
docs.add("docs", bulkDocs);
// use GET to get the document
String dbname = credential.dbname;
- Response response = given().port(443).baseUri(cloudantAccount(credential.user)).auth().basic(credential.user, credential.password).contentType("application/json").body(docs).post("/" + credential.dbname + "/_bulk_docs?include_docs=true");
+ Response response = given().port(443).baseUri(cloudantAccount(credential.user)).auth().basic(credential.user, credential.password).contentType("application/json").body(docs.toString()).post("/" + credential.dbname + "/_bulk_docs?include_docs=true");
String responseStr = response.asString();
if (responseStr.length() > 500)
responseStr = responseStr.substring(0, 500);