Skip to content

Commit

Permalink
Merge pull request #15 from Pchelolo/index_remove
Browse files Browse the repository at this point in the history
Added a test for secondaryIndex removal
  • Loading branch information
eevans committed Sep 11, 2015
2 parents 62abecb + 9821678 commit c3dea66
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "restbase-mod-table-spec",
"version": "0.0.5",
"version": "0.0.6",
"description": "Tests and specification for RESTBase backend modules",
"main": "index.js",
"repository": {
Expand Down
45 changes: 45 additions & 0 deletions test/functional/schema_migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,4 +378,49 @@ describe('Schema migration', function() {
assert.deepEqual(response.status, 500);
});
});

// We can't add a secondary index back, so this test must be last in the test set.
it('removes a secondary index', function() {
var newSchema = clone(testTable0);
newSchema.version = 9;
delete newSchema.secondaryIndexes.by_rev;
return router.request({
uri: '/restbase.cassandra.test.local/sys/table/testTable0',
method: 'put',
body: newSchema
})
.then(function(response) {
assert.deepEqual(response.status, 201);
return router.request({
uri: '/restbase.cassandra.test.local/sys/table/testTable0/',
method: 'get',
body: {
table: 'testTable0',
index: 'by_rev',
attributes: {
rev: 1
}
}
});
})
.then(function(response) {
assert.deepEqual(response.status, 500);
// And check that the table is still usable and index updates didn't break
return router.request({
uri: '/restbase.cassandra.test.local/sys/table/testTable0/',
method: 'put',
body: {
table: 'testTable0',
attributes: {
title: 'add_test',
rev: 111,
tid: utils.testTidFromDate(new Date("2015-04-01 12:00:00-0500"))
}
}
});
})
.then(function(response) {
assert.deepEqual(response.status, 201);
});
});
});

0 comments on commit c3dea66

Please sign in to comment.