-
-
Notifications
You must be signed in to change notification settings - Fork 52
make testCommon.js the default value for testCommon parameter + remove testBuffer #175
Conversation
abstract/put-get-del-test.js
Outdated
@@ -164,7 +164,9 @@ module.exports.tearDown = function (test, testCommon) { | |||
}) | |||
} | |||
|
|||
module.exports.all = function (leveldown, test, testCommon, testBuffer) { | |||
module.exports.all = function (leveldown, test, testBuffer, testCommon) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the order of testBuffer
and testCommon
parameters was swapped. So you can do:
Use default testBuffer
and default testCommon
abstract.all(leveldown, test)
Use custom testBuffer
and default testCommon
abstract.all(leveldown, test, testBuffer)
Or custom testBuffer
and custom testCommon
abstract.all(leveldown, test, testBuffer, testCommon)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose this approach because leveldown
, leveldown-hyper
, rocksdb
, memdown
and medeadown
all use testCommon
from abstract-leveldown
but also pass in a custom buffer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't we have the intention to remove testBuffer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vweevers Yeah, but I got cold feet. What if it's important for implementations to specify their custom buffers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd still like to remove it though :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also not 100% sure. Mainly because we don't know the original motivation or use case (if there ever was one).
The only case I can think of is if they do some kind of prefixing or encoding, for example, add my-db~
to every key. Then with a custom testBuffer
they could test edge cases, like putting a buffer that is the same as the prefix. They should probably have their own tests for that though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do a grep of this over the most common dependents to get some more information. Lets leave this hanging a little bit.
See complete search log at the bottom. Summary 1
Summary 2
Conclusion1 just pass a string and seem to have no meaning. 2 and 3 are essentially doing the same thing, only difference from 1 is length of buffer (as I see it) and the actual file content doesn't have any real meaning. 4 is basically the same as 1 with the only difference that the buffer is generated from a base64 encoded string 5 doesn't use abstract No one seems to be doing any funky stuff so we should be good by removing Search output
|
@vweevers @juliangruber Any thoughts on this? |
Haven't had the time yet, maybe tomorrow. |
Awesome research and summary @ralphtheninja!
👍
As long as stores can skip that test, for example because they have limited storage space. |
Thanks! This is why I implemented |
I saw and I starred! 😄 |
Closes #163
Also removes
testBuffer
input-get-del-test.js