Skip to content

Tests should work out-of-the-box - #226

Closed
pulkitsinghal wants to merge 3 commits into
strongloop:masterfrom
pulkitsinghal:master
Closed

pulkitsinghal wants to merge 3 commits into
strongloop:masterfrom
pulkitsinghal:master

Conversation

@pulkitsinghal

@pulkitsinghal pulkitsinghal commented Jun 21, 2016 •

Copy link
Copy Markdown

Cloning and running tests doesn't "just work":
angular/angular.js#13794

So I've updated the code to get to a point where anyone new coming in isn't solving pre-existing problems. This doesn't mean I've fixed anything, I've only leveled the playing field. You still need to look at one of the problems more closely and when the regression occurred.

LOG: 'methods', ['get', 'save', 'query', 'remove', 'delete', 'create', 'createMany', 'upsert', 'exists', 'findById', 'find', 'findOne', 'updateAll', 'deleteById', 'count', 'prototype$updateAttributes', 'bind', 'modelName']
      ✖ has all methods including aliases
      ✔ has `modelName` property

possible reason behind crash when testing:
1.5.0-rc.1 fails to load in PhantomJS 1.x + Karma environment
angular/angular.js#13794

crash log:
```
PhantomJS 1.9.8 (Mac OS X 0.0.0) ERROR
  Error: [$injector:modulerr] Failed to instantiate module ng due to:
  TypeError: 'undefined' is not an object (evaluating 'Function.prototype.bind.apply')
      at ...
      at /Users/shahwarcoder/loopback-sdk-angular/test.e2e/given.js:19
```
these are missing as aliases?
'updateOrCreate', 'removeById', 'destroyById',

```
LOG: 'methods', ['get', 'save', 'query', 'remove', 'delete', 'create', 'createMany', 'upsert', 'exists', 'findById', 'find', 'findOne', 'updateAll', 'deleteById', 'count', 'prototype$updateAttributes', 'bind', 'modelName']
      ✖ has all methods including aliases
      ✔ has `modelName` property
```
@slnode

slnode commented Jun 21, 2016

Copy link
Copy Markdown

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@davidcheung

Copy link
Copy Markdown
Contributor

@pulkitsinghal please note that the pull-request points to the master branch of your fork
and the aliases you commented out are still in persisted-model, would you be able to provide more details about regression you're facing?

@pulkitsinghal

Copy link
Copy Markdown
Author

@davidcheung - I've recorded a screencast, please refer to the two mp4 files in this dropbox folder:
https://www.dropbox.com/sh/1gwqgdldgwg364o/AADFf0y3MGdwS0DDC0T6MCLna?dl=0

@davidcheung

Copy link
Copy Markdown
Contributor

@pulkitsinghal thanks for replying so quickly,
I misunderstood that you were using your master branch for your production seeing the package.json.

weird thing is out of the box the tests work for me, is your dependent node_moduels/loopback on version 2.29?

SUMMARY:
✔ 57 tests completed
ℹ 1 test skipped

it should be the dependent loopback that dictates what remoteMethod gets exposed from my understanding

@pulkitsinghal

pulkitsinghal commented Jul 6, 2016 •

Copy link
Copy Markdown
Author

@davidcheung - no the loopback dependency version 2.0.2
I can (should?) change my approach to only freeze PhantomJS version I suppose.
Will test and update PR soon.

... testing frameworks can be kept static by default to avoid surprises but loopback itself is meant to be tested alongside the sdk
@pulkitsinghal

pulkitsinghal commented Jul 8, 2016 •

Copy link
Copy Markdown
Author

@davidcheung - ok much simpler now and works out of the box, please let me know if you're ready to accept and I recommend "squashing" this PR when merging

@davidcheung

Copy link
Copy Markdown
Contributor

@pulkitsinghal I am actually not able to reproduce Test failing out of the box on master other than the phantomjs which theres a pending PR #215, and I don't think locking down the dependencies is the optimal solution, if anything loopback-sdk-angular (in the case tests fails out of the box because dependencies updated) we should probably update our code.

And ci is passing which I think the problem might be with the environment of you're setup

@pulkitsinghal

pulkitsinghal commented Jul 22, 2016 •

Copy link
Copy Markdown
Author
  1. @davidcheung - I know you're being fully upfront and respectful with me. But still it is a bit disappointing to get the works for me spiel. Tests should work for everyone who clones the project ... either that or a docker image should be provided (at least be a roadmap item) that circumvents statements like problem might be with the environment of your setup
  2. I agree that package.json doesn't have to be locked down so tightly but hopefully you can see the value of at least locking down phantomjs until someone:

    should probably update our code.

  3. You can either close this out or let me know if I should improve my PR such that it only limits phantomjs to a specific version. I will understand.

@slnode

slnode commented Jul 22, 2016

Copy link
Copy Markdown

Can one of the admins verify this patch?

@davidcheung

davidcheung commented Jul 22, 2016 •

Copy link
Copy Markdown
Contributor

@pulkitsinghal thank you for your patience, my concern for Locking down the versions are we don't know what we're actually fixing, we're only putting a patch onto an issue without finding out the cause, and it would stop people from receiving fixes.

For the missing or mismatching endpoints, the solution might be to bumped the depdency of loopback to something newer such as ^2.29.1(so the package.json actually correctly refers what dependency it needs), but I don't currently have the bandwidth to dig into what is causing

LOG: 'methods', ['get', 'save', 'query', 'remove', 'delete', 'create', 'createMany', 'upsert', 'exists', 'findById', 'find', 'findOne', 'updateAll', 'deleteById', 'count', 'prototype$updateAttributes', 'bind', 'modelName']
✖ has all methods including aliases
✔ has modelName property

and as for phantomJS, yes this is definitely a problem, we are trying to address it in this PR

I am not trying to say this is not my problem and call it a day, I dont want to close this PR until this is actually resolved, I'm just not convinced that locking down the version is the solution to this issue (and I dont even know how to reproduce the issue yet)

I know you're being fully upfront and respectful with me. But still it is a bit disappointing to get the works for me spiel. Tests should work for everyone who clones the project ... either that or a docker image should be provided (at least be a roadmap item) that circumvents statements like problem might be with the environment of your setup

@superkhau

Copy link
Copy Markdown
Contributor

@pulkitsinghal Hello, long time no talk. ;) We definitely should get tests to work out of box and locking down all the deps OOB isn't a valid solution.

  1. It would take way too much effort to manually check every change for each dependency
  2. CI should be doing this properly for us, we should just update when CI detects something has broken with new versions

Anyways, @davidcheung has some homework this sprint/next sprint to look into some of the CI issues around this repository. Thanks for your patience.

@davidcheung Please confirm how this project is cloned as part of the HW2 assignment for this repo. I agree with @pulkitsinghal that it should be as simple as git clone loopback-sdk-angular and npm test. If something is preventing this, we need to take note and make changes accordingly.

@pulkitsinghal

Copy link
Copy Markdown
Author

@davidcheung - gotcha

@bajtos

bajtos commented Jul 27, 2016

Copy link
Copy Markdown
Member

locking down all the deps OOB isn't a valid solution.

👍 ✖️ 💯

I agree with @pulkitsinghal that it should be as simple as git clone loopback-sdk-angular and npm test. If something is preventing this, we need to take note and make changes accordingly.

I would add the necessary npm install step in between. Other than that, I totally agree!

@davidcheung

Copy link
Copy Markdown
Contributor

@pulkitsinghal i believe the only problem with git clone loopback-sdk-angular and npm install && npm test was the phantomjs
this repo should be out of the box passing now, can you see if this still an issue, if so we could close this PR

@davidcheung

Copy link
Copy Markdown
Contributor

I believe the only issue that was causing the repo to fail out of the box was phantomjs, which is now solved, closing issue now, please reopen if you see fit @pulkitsinghal

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

Successfully merging this pull request may close these issues.

6 participants