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

Support running test suite on a levelup db #364

Merged
merged 1 commit into from
Apr 11, 2020
Merged

Conversation

vweevers
Copy link
Member

@vweevers vweevers commented Apr 5, 2020

As well as skipping 'start' and 'end' tests (for multileveldown) (see also Level/community#86).

Doesn't change anything for existing abstract-leveldown implementations. Before releasing I do want to test it on:

  • multileveldown (as a levelup instance)
  • subleveldown (same)
  • level

Working towards Level/community#58.

@vweevers vweevers added the semver-minor New features that are backward compatible label Apr 5, 2020
test/batch-test.js Outdated Show resolved Hide resolved
@vweevers vweevers force-pushed the tests-for-levelup branch from d82e4b3 to 406a6ef Compare April 5, 2020 16:51
vweevers added a commit to Level/levelup that referenced this pull request Apr 5, 2020
- Add db property to chained batch
- Remove type checks that are also performed by abstract-leveldown

Goes hand in hand with Level/abstract-leveldown#364.
As well as skipping 'start' and 'end' tests (for multileveldown).
@vweevers
Copy link
Member Author

vweevers commented Apr 6, 2020

Almost works on level!

var test = require('tape')
var factory = require('level')
var tempy = require('tempy')
var suite = require('abstract-leveldown/test')

suite({
  test: test,
  factory: function () {
    return factory(tempy.directory())
  },
  clear: true,
  createIfMissing: false, // TODO: fails
  errorIfExists: false, // TODO: fails
  promises: true,
  status: false,
  serialize: false,
  encodings: true
})

And it also works when you take out encoding-down:

var factory = require('level-compose')(require('leveldown'), require('levelup'))

// same as above, but with `encodings: false`
// ..

@vweevers
Copy link
Member Author

vweevers commented Apr 6, 2020

The createIfMissing and errorIfExists tests can't be fixed without a semver-major change, because they do:

test('test database open createIfMissing:false', function (t) {
  // levelup db, opens itself
  var db = testCommon.factory()

  // options are ignored because it's already opening
  db.open({ createIfMissing: false }, function () { /* .. */ })
})

The easiest way forward is probably to move such options to the (abstract)-leveldown constructor.

vweevers added a commit to Level/levelup that referenced this pull request Apr 11, 2020
- Add db property to chained batch
- Remove type checks that are also performed by abstract-leveldown

Goes hand in hand with Level/abstract-leveldown#364.
@vweevers vweevers merged commit 9ca0ff4 into master Apr 11, 2020
@vweevers vweevers deleted the tests-for-levelup branch April 11, 2020 07:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
semver-minor New features that are backward compatible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant