Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

Add tests for concurrent delete/iteration #46

Closed
wants to merge 1 commit into from

Conversation

nolanlawson
Copy link
Contributor

These tests sussed out bugs in localstorage-down
(No9/localstorage-down#61) and memdown
(Level/memdown#20), so they may be useful to add
to abstract-leveldown.

@nolanlawson
Copy link
Contributor Author

It might be a good idea to do an audit of different *down libraries, though, and see if they're already passing or failing the tests. I believe the second test fails in MemDOWN for instance, unless I'm just not running the tests correctly:

# test batch() with missing `value`

/Users/nolan/workspace/memdown/node_modules/tape/index.js:75
        throw err
              ^
TypeError: Object #<MemDOWN> has no method '_checkKeyValue'
    at MemDOWN._batch (/Users/nolan/workspace/memdown/memdown.js:120:18)
    at MemDOWN.AbstractLevelDOWN.batch (/Users/nolan/workspace/abstract-leveldown/abstract-leveldown.js:162:17)
    at Test.<anonymous> (/Users/nolan/workspace/abstract-leveldown/abstract/batch-test.js:20:8)
    at Test.bound [as _cb] (/Users/nolan/workspace/memdown/node_modules/tape/lib/test.js:59:32)
    at Test.run (/Users/nolan/workspace/memdown/node_modules/tape/lib/test.js:72:10)
    at Test.bound [as run] (/Users/nolan/workspace/memdown/node_modules/tape/lib/test.js:59:32)
    at Object.next [as _onImmediate] (/Users/nolan/workspace/memdown/node_modules/tape/lib/results.js:66:15)

@nolanlawson
Copy link
Contributor Author

/cc @calvinmetcalf who wrote the first test

t.notOk(err, 'no error')
iterator.next(function (err, key, value) {
t.notOk(err, 'no error')
t.equals(key, 'c')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be 'b' if they have a snapshot

@nolanlawson
Copy link
Contributor Author

Small fix pointed out by @calvinmetcalf - if you delete 'b' after iterating past 'a', then the next iterated element will be 'b' on backends that support snapshots, but 'c' on backends that don't. In any case, localstorage-down was returning undefined, so we can just test for that.

@ralphtheninja
Copy link
Member

I'm rebasing this branch.

These tests sussed out bugs in localstorage-down
(No9/localstorage-down#61) and memdown
(Level/memdown#20), so they may be useful to add
to abstract-leveldown.
@ralphtheninja ralphtheninja force-pushed the concurrent-del-iter branch from 21db440 to 935c947 Compare May 18, 2015 14:46
@vweevers vweevers mentioned this pull request Dec 23, 2017
9 tasks
@vweevers vweevers mentioned this pull request Jun 17, 2018
@vweevers
Copy link
Member

Superseded by #239.

@vweevers vweevers closed this Jun 17, 2018
@vweevers vweevers deleted the concurrent-del-iter branch June 17, 2018 15:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants