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

Doesn't pass the PouchDB test suite #7

Open
nolanlawson opened this issue May 4, 2015 · 5 comments
Open

Doesn't pass the PouchDB test suite #7

nolanlawson opened this issue May 4, 2015 · 5 comments

Comments

@nolanlawson
Copy link

Steps to repro:

hub clone pouchdb/pouchdb
cd pouchdb
npm install medeadown
LEVEL_ADAPTER=medeadown npm run test-node

Fails on the very first test with Uncaught AssertionError: expected {} to not exist. My hunch is that this is due to MedeaDOWN not exporting a LevelDOWN-compatible API in the same way that most *down adapters do, but I haven't investigated yet. This issue is just a heads-up in case you're curious and want to investigate. 😃

For more info about how to set up your project to run the PouchDB test suite (e.g. in Travis) and how to debug, check out this guide. *down adapters that are known to pass the test include LevelDOWN, MemDOWN, localstorage-down, level-js, riakdown, and redisdown.

@Ivshti
Copy link
Contributor

Ivshti commented May 4, 2015

Can you please post the full error log? I tried to setup the test quickly but it turns out I have to set up CouchDB too, can't do that now.

It's probably something trivial.

@nolanlawson
Copy link
Author

Sorry, forgot that detail! You can also run a PouchDB Server backed by medeadown instead, but often it's easier to use CouchDB for debugging.

And you're right; the fix is easy. It looks like medeadown doesn't create a new database if the file isn't found?

"OpenError: _pouch_testdb: No such file or directory
    at LevelUP.open (/Users/nolan/workspace/node-levelup/lib/levelup.js:118:34)
    at MedeaDOWN._open (/Users/nolan/workspace/pouchdb/node_modules/medeadown/medeadown.js:28:14)
    at open (/Users/nolan/workspace/pouchdb/node_modules/medeadown/node_modules/leveldown-open/leveldown-open.js:15:18)
    at Object.cb [as oncomplete] (fs.js:169:19)"

@Ivshti
Copy link
Contributor

Ivshti commented May 4, 2015

Yes. I also met this issue once, I think it's a matter of mkdir vs mkdirp, but I solved it in my app instead of in Medea. It does make sense, Medea should not be expected to auto-create the directory the data should reside in. Unless of course LevelDB does that.

@nolanlawson
Copy link
Author

LevelDB does. :) In fact, the PouchDB test suite passes against LevelDOWN, MemDOWN, level.js, localstorage-down, riakdown, and redisdown. So medeadown would be joining the crowd. :D

@Ivshti
Copy link
Contributor

Ivshti commented May 4, 2015

Well from these only LevelDOWN uses the FS directly. But yes, I agree, a mkdirp should get in there.

Update: it's weird though, just looked into Medea and it does mkdirp the directory. So no idea what goes wrong. Maybe medeadown does not go through medea's open procedure.

Update 2: looking at MedeaDOWN.prototype._open, it first calls leveldown-open and then medea's open which creates the dir (as expected). The error is emitted in leveldown-open. So the problem is not in medea, it's in medeadown.
leveldown-open would create the directory if "createIfMissing" is set. I don't know why leveldown-open is needed in the first place though.
@kevinswiber ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants