-
Notifications
You must be signed in to change notification settings - Fork 12
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
Various tests improvements #18
Various tests improvements #18
Conversation
Please note that travis checks fail because the men-store used for the tests doesn't fully follow standards |
@@ -1,4 +1,6 @@ | |||
language: node_js | |||
node_js: | |||
- "0.11" | |||
- "4.1" |
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.
Can use "4"
instead
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.
do you think I should add "4" and also leave 4.1 and 4.0 since 4.2 has been released?
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 would make it "4" to test against the current 4.x release.
@paolochiodi Can you look at the failing tests? There are a couple of them. |
@@ -4,7 +4,7 @@ | |||
"description": "Standard test cases for seneca stores", | |||
"main": "store-test.js", | |||
"scripts": { | |||
"test": "./test.sh" | |||
"test": "lab test/*.test.js -r console -v -L" |
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.
You might want to set the timeout here to 3000 we have found travis can be slow at times and cause tests to fail due to overrun. 3000 seems to be the sweet spot.
@mcdonnelldean tests on this repot aren't real tests I've introduced some new test to better cover the data entities specification, and some them are failing because even men-store doesn't fully and correctly implement that. In order to have all tests green we should amend the mem-store |
@paolochiodi super, as discussed let's fix up mem store while we wait for @rjrodger to review. |
@paolochiodi this change looks good... I would like to get the changes to mem-store in first so that we can have all green tests. I went ahead and merged in #22, so you will need to pull down those changes and merge :/ |
I've rebased to incorporate latest changes in master branch. Releasing these will require some coordination and some work on package.json to highlight that these spec changes:
|
Also cover more of the specs
Rebased to bring this up-to-date with master |
scratch.foo2.p2 = 'v2' | ||
it('should allow to not merge during update with merge$: false', function (done) { | ||
var foo = si.make('foo') | ||
foo.id = 'to-be-updated' |
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.
@paolochiodi I think is better not to define id values in these tests. Some DB engines have rules about ids - like MongoDB that uses an ObjectId. So in order to use these tests as a standard maybe we should not have id values defined in these tests.
The id can be retrieved from callback of the save action.
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 guess this also relates to senecajs-labs/seneca-shard-store#11
On a general note I'm ok to rewrite tests in a way that createEntities
will store auto-generated ids for later uses (i.e.: when we want to update the entities, like this case).
I begin to feel that at this point may be better to remove the possibility to specify the id on create from the specs, if many of the DB engines can't support them. What do you think?
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 am the supporter of the idea that we should have something like this:
- define a set of functions that all stores will try to follow - the "standard" store functions that we have now
- support in the stores as many as possible "standard" functions offered by the DB engines. Here is also this function of allowing to specify the id or the entity to be saved if that is supported.
- clearly specify in the documentation when a certain store do not have support for a "standard" function.
So, from my point of view, if Riak do not support list$ is not a problem, but we should clearly specify this in its documentation. The developers that will use that store probably know already this thing.
I also think that the benefit of having a functional store with all necessary tools offered by a specific DB engine is greater than limiting all stores to the smallest set of common functions offered by all DB engines.
Shard-store can also have a list of specific functions that should not be used by developers if they want to have it run correctly - this should not limit the actual functions implemented in the used stores.
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 agree on the idea of having a basic set of standard functions, but I think all the stores must support that minimal set.
The entity framework is quite minimal and doesn't add much to the db driver beside a common api, I don't see the point of having a store for a db that can't support that api: sometimes may be better to directly go with the driver or a different type of abstraction (e.g: https://github.com/AdrianRossouw/seneca-knex-store)
Maybe @rjrodger and @geek can weight in their opinion?
Also let me know how to proceed with this PR, if I need to split the tests into different "levels" of support
This PR includes:
This PR does not include:
Notes: