Skip to content

Commit

Permalink
failing bytewise sublevel test hangs on createReadStream()
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Sep 24, 2014
1 parent 7344bf2 commit decff64
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test/bytewise_sublevel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
var test = require('tape');
var level = require('../');
var path = require('path');
var bsub = require('level-sublevel/bytewise');
var os = require('os');
var tmpdir = os.tmpdir ? os.tmpdir() : os.tmpDir();
var datadir = path.join(tmpdir, 'level-party-' + Math.random());
var bytewise = require('bytewise');

var lopts = { keyEncoding: bytewise, valueEncoding: 'json' };

test('bytewise sublevel', function (t) {
t.plan(5);
var a = level(datadir);
var b = level(datadir);
var adb = bsub(a, lopts);
var bdb = bsub(b, lopts);
var value = Math.floor(Math.random() * 100000);

adb.put([ 'a' ], value, function (err) {
if (err) t.fail(err);
var times = 0;

bdb.get([ 'a' ], function (err, x) {
t.equal(x, value);
});
adb.createReadStream().on('data', function (row) {
t.deepEqual(row.key, [ 'a' ]);
t.deepEqual(row.value, value);
});
bdb.createReadStream().on('data', function (row) {
t.deepEqual(row.key, [ 'a' ]);
t.deepEqual(row.value, value);
});
});

t.on('end', function () {
a.close();
b.close();
});
});

0 comments on commit decff64

Please sign in to comment.