Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-minor New features that are backward compatible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant