Permalink
Browse files

Run `deleteIndex()` tests in a separate batch.

ElasticSearch seems to have a race condition when performing index
deletions asynchronously with other index operations (in particular
putMapping). Running the `deleteIndex()` tests in a separate batch from
the other tests works around this to avoid failures that aren't our
fault.
  • Loading branch information...
1 parent 8409340 commit 0ddb30a19a18ada361f5684e235188085a959fa5 @rgrove rgrove committed Sep 14, 2011
Showing with 40 additions and 26 deletions.
  1. +40 −26 tests/online-tests.js
View
@@ -82,32 +82,10 @@ vows.describe('Elastical').addBatch({
}
},
- '`deleteIndex()`': {
- 'when called with a single index name': {
- topic: function (client) {
- client.deleteIndex('elastical-test-deleteme', this.callback);
- },
-
- 'should delete the index': function (err, data) {
- assert.isNull(err);
- assert.isObject(data);
- assert.isTrue(data.ok);
- }
- },
-
- 'when called with multiple index names': {
- topic: function (client) {
- client.deleteIndex(['elastical-test-deleteme2', 'elastical-test-deleteme3'],
- this.callback);
- },
-
- 'should delete all the named indices': function (err, data) {
- assert.isNull(err);
- assert.isObject(data);
- assert.isTrue(data.ok);
- }
- }
- },
+ // deleteIndex() is tested below, after everything else, since
+ // ElasticSearch seems to have some race condition bugs when index
+ // deletions occur asynchronously with other index operations (in
+ // particular putMapping).
'`get()`': {
'when called with no options': {
@@ -508,4 +486,40 @@ vows.describe('Elastical').addBatch({
}
}
}
+}).addBatch({
+ 'Client (part deux)': {
+ topic: new elastical.Client(),
+
+ // deleteIndex() is tested after everything else since
+ // ElasticSearch seems to have some race condition bugs when index
+ // deletions occur asynchronously with other index operations (in
+ // particular putMapping).
+
+ '`deleteIndex()`': {
+ 'when called with a single index name': {
+ topic: function (client) {
+ client.deleteIndex('elastical-test-deleteme', this.callback);
+ },
+
+ 'should delete the index': function (err, data) {
+ assert.isNull(err);
+ assert.isObject(data);
+ assert.isTrue(data.ok);
+ }
+ },
+
+ 'when called with multiple index names': {
+ topic: function (client) {
+ client.deleteIndex(['elastical-test-deleteme2', 'elastical-test-deleteme3'],
+ this.callback);
+ },
+
+ 'should delete all the named indices': function (err, data) {
+ assert.isNull(err);
+ assert.isObject(data);
+ assert.isTrue(data.ok);
+ }
+ }
+ }
+ }
}).export(module);

0 comments on commit 0ddb30a

Please sign in to comment.