Skip to content

Instantly share code, notes, and snippets.

@timoxley
Created October 17, 2011 09:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timoxley/1292272 to your computer and use it in GitHub Desktop.
Save timoxley/1292272 to your computer and use it in GitHub Desktop.
Riak `remove` bugs
var db = require('riak-js').getClient({port: 8098, debug: true})
exports['can call remove then call getAll'] = function(test) {
var bucket = 'Bugs'
var key = 'KLM'
var object = {
"frustrating": true
}
db.save(bucket, key, {fleet: 111, country: 'NL'}, function(err, data, meta) {
test.ok(!err, 'save: ' + err)
db.remove(bucket, key, function(err){
test.ok(!err, 'remove: '+ err)
db.getAll(bucket, function(err, data){
test.ok(!err, 'getAll: ' + err)
test.equal(data.length, 0, 'data.length should be 0!')
test.done()
})
})
})
}
exports['can call remove and item will actually be removed'] = function(test) {
var bucket = 'airlines'
var key = 'KLM'
var object = {
frustrating: true
}
db.save(bucket, key, {fleet: 111, country: 'NL'}, function(err, data, meta) {
test.ok(!err, 'save: ' + err)
db.remove(bucket, key, function(err){
test.ok(!err, 'remove: '+ err)
db.keys(bucket, function(err, keys){
test.ok(!err, 'keys: ' + err)
test.equal(keys.length, 0, 'keys.length should be 0!')
test.done()
})
})
})
}
chamb% nodeunit test/units/test_bug.js
test_bug.js
[riak-js] PUT /riak/Bugs/KLM
[riak-js] DELETE /riak/Bugs/KLM
[riak-js] POST /mapred
✖ can call remove then call getAll
Assertion Message: getAll: Error: HTTP error 500: {"lineno":466,"message":"SyntaxError: syntax error","source":"()"}
AssertionError: false == true
at Object.ok (/usr/local/lib/node_modules/nodeunit/lib/types.js:83:39)
at .../test/units/test_bug.js:16:14
at HttpClient.<anonymous> (.../node_modules/riak-js/lib/http_client.js:378:18)
at IncomingMessage.<anonymous> (.../node_modules/riak-js/lib/http_client.js:10:95)
at IncomingMessage.emit (events.js:81:20)
at HTTPParser.onMessageComplete (http.js:133:23)
at Socket.ondata (http.js:1231:22)
at Socket._onReadable (net.js:677:27)
at IOWatcher.onReadable [as callback] (net.js:177:10)
Assertion Message: data.length should be 0!
AssertionError: undefined == 0
at Object.equal (/usr/local/lib/node_modules/nodeunit/lib/types.js:83:39)
at .../test/units/test_bug.js:17:14
at HttpClient.<anonymous> (.../node_modules/riak-js/lib/http_client.js:378:18)
at IncomingMessage.<anonymous> (.../node_modules/riak-js/lib/http_client.js:10:95)
at IncomingMessage.emit (events.js:81:20)
at HTTPParser.onMessageComplete (http.js:133:23)
at Socket.ondata (http.js:1231:22)
at Socket._onReadable (net.js:677:27)
at IOWatcher.onReadable [as callback] (net.js:177:10)
[riak-js] PUT /riak/airlines/KLM
[riak-js] DELETE /riak/airlines/KLM
[riak-js] GET /riak/airlines?keys=true
✖ can call remove and item will actually be removed
Assertion Message: keys.length should be 0!
AssertionError: 1 == 0
at Object.equal (/usr/local/lib/node_modules/nodeunit/lib/types.js:83:39)
at .../test/units/test_bug.js:36:14
at .../node_modules/riak-js/lib/http_client.js:98:18
at HttpClient.<anonymous> (.../node_modules/riak-js/lib/http_client.js:378:18)
at IncomingMessage.<anonymous> (.../node_modules/riak-js/lib/http_client.js:10:95)
at IncomingMessage.emit (events.js:81:20)
at HTTPParser.onMessageComplete (http.js:133:23)
at Socket.ondata (http.js:1231:22)
at Socket._onReadable (net.js:677:27)
at IOWatcher.onReadable [as callback] (net.js:177:10)
FAILURES: 3/8 assertions failed (51ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment