HTTP.get fails
Closed this issue · 30 comments
Steps to reproduce:
git clone git@github.com:MeteorPackaging/isotope.git
cd isotope
git checkout 9e5c89bf0cb29f77c50f6cf94601ed418960d138
cp meteor/package.js .
Output:
$ spacejam test-packages ./
spacejam: spawning meteor
[[[[[ Tests ]]]]]
=> Started proxy.
=> Started MongoDB.
spacejam: meteor mongodb is ready
I20141129-21:00:50.532(-8)? test-in-console listening
=> Started your app.
=> App running at: http://localhost:4096/
spacejam: meteor is ready
spacejam: spawning phantomjs
phantomjs: Running tests at http://localhost:4096/ using test-in-console
C: tinytest - Isotope - fitRows : !!!!!!!!! FAIL !!!!!!!!!!!
{"groupPath":["tinytest","Isotope"],"test":"fitRows","events":[{"sequence":0,"type":"fail","details":{"message":"Error getting the test file. Do we have an Internet connection to rawgit.com?"},"cookie":{"name":"Isotope - fitRows","offset":0,"groupPath":["tinytest","Isotope"],"shortName":"fitRows"}}]}
~~~~~~~ THERE ARE FAILURES ~~~~~~~
passed/expected/failed/total 0 / 0 / 1 / 1
##_meteor_magic##state: done
spacejam: phantomjs exited with code: 2
spacejam: killing meteor
spacejam: meteor killed with signal: SIGTERM
The tests did run, but failed. git@github.com:MeteorPackaging/isotope.git is not our package. Submit the issue there.
Observation, why do you copy the meteor/package.js file into the repo root? If the package.js is in the meteor folder, you should run spacejam from there. Use it exactly as you would meteor test-packages, i.e. cd into the meteor package folder and then run spacejam test-packages ./
Hi Ronen, that's a Meteor integration package I'm working on with the Isotope devs. Wanted to make the tests run from their Gruntfile.
Obviously, I have run meteor test-packages
standalone and it works.
The package.js
is in the root folder for all direct Meteor packaging PRs I've been sent to a bunch of libraries. It refers to test files in the meteor
directory, which is perfectly fine. The reason for this is that there might be a package.js
already in the root directory, such as for Dojo.
I'm sorry Ronen, but I'm a bit disappointed. First closing the issue, then marking it invalid? This incidentally after I've just recommended spacejam on StackOverflow.
Would you not agree that if meteor test-packages ./
succeeds, so should spacejam test-packages ./
? Maybe I have explained the issue incorrectly, but I do believe it's valid.
I assumed it is a bug with isotope. Reopening it.
And used invalid because I need to still add a not a bug tag.
Will look at it Monday.
Thanks for reopening. Hope to get this fixed up, since many packages may make legit HTTP.get calls. (In my case it's a suboptimal solution because I haven't found an easy way to pull HTML files into Tinytests.)
What are you trying to do with html files in tniytests? Maybe I can help
The bug is triggered by using HTTPS in that HTTP.get
call. As a workaround, if I replace that URL with http://, the test passes.
So not a bug, can I close it? :)
For Isotope, I want to pull in an HTML from their own test suite, instantiate Isotope, then run a couple tests. I've found a need for that when wrapping various widget libraries.
Looks like a bug with HTTPS connections though. Maybe a phantom option? As long as it works with meteor test-packages ./
, it should work with spacejam test-packages ./
. I've updated my comment to mention that replacing https with http in the test itself is a workaround, and one that may not always be possible.
How about cloning their repo, and add a package.js to the root, then you have access to all the html files. you can then just add the html files to onTest the same way you do to unUse, and you can load them as assets, if you don't want to modify them to spacebar templates. onTest works exactly the same as unUse (at least it should) - it will add all the files in onTest to a 'test-packages' app that meteor creates on the fly.
We did something similar with package.js in our underscore.string package:
Unfortunately I've already tried the Assets route, and it's undefined in the Tinytest call.
Yes, it maybe a phantomjs option, we probably should support phantomjs command line options in spacejam. Can you help out on this to verify? Run:
meteor test-packages --driver-package test-in-console
And then run phantomjs with the following script:
https://github.com/practicalmeteor/spacejam/blob/master/lib/phantomjs-test-in-console.js
And see what option it needs, probably something about ignoring ssl / https errors. I can then add it by default, for a quick fix.
Interesting undocumented option, --driver-pacakge
,
Looks like I need webpage
, if I understand the instructions correctly.
$ curl -L https://raw.githubusercontent.com/practicalmeteor/spacejam/master/lib/phantomjs-test-in-console.js | node
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1134 100 1134 0 0 9460 0 --:--:-- --:--:-- --:--:-- 10800
module.js:340
throw err;
^
Error: Cannot find module 'webpage'
...
Um, that is exactly the URL I had used, as you can see in my comment?
Anyway, try adding {rejectUnauthorized: false}
. I had similar issues in the past.
Sorry, missed that. What version of phantomjs do you have?
phantom@0.7.0 node_modules/phantom
├── win-spawn@2.0.0
├── traverse@0.6.6
├── shoe@0.0.15 (sockjs@0.3.7)
└── dnode@1.2.0 (jsonify@0.0.0, dnode-protocol@0.2.2, weak@0.3.3)
Questions:
- If this is an npm package, i'm looking for the binary / executable version. spacejam uses phantomjs 1.9.7.
- Are you running on windows?
webpage is a built-in phantomjs module:
I'm running on Ubuntu 12 and have just installed phantom I believe, with npm install phantom
in that isotope project. I'm probably missing something:
$ npm install phantomjs
/
> phantomjs@1.9.12 install /home/dan/meteor-integrations/isotope/node_modules/phantomjs
> node install.js
PhantomJS detected, but wrong version 1.9.7 @ /usr/local/bin/phantomjs.
Download already available at /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2
Extracting tar contents (via spawned process)
Removing /home/dan/meteor-integrations/isotope/node_modules/phantomjs/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1417328356578/phantomjs-1.9.8-linux-x86_64 -> /home/dan/meteor-integrations/isotope/node_modules/phantomjs/lib/phantom
Removing /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1417328356578
Writing location.js file
Done. Phantomjs binary available at /home/dan/meteor-integrations/isotope/node_modules/phantomjs/lib/phantom/bin/phantomjs
phantomjs@1.9.12 node_modules/phantomjs
├── which@1.0.7
├── progress@1.1.8
├── rimraf@2.2.8
├── kew@0.4.0
├── ncp@1.0.1
├── request-progress@0.3.1 (throttleit@0.0.2)
├── mkdirp@0.5.0 (minimist@0.0.8)
├── adm-zip@0.4.4
├── npmconf@2.0.9 (uid-number@0.0.5, inherits@2.0.1, osenv@0.1.0, ini@1.3.2, once@1.3.1, nopt@3.0.1, semver@4.1.0, config-chain@1.1.8)
└── request@2.42.0 (caseless@0.6.0, json-stringify-safe@5.0.0, aws-sign2@0.5.0, forever-agent@0.5.2, stringstream@0.0.4, oauth-sign@0.4.0, tunnel-agent@0.4.0, node-uuid@1.4.1, qs@1.2.2, mime-types@1.0.2, tough-cookie@0.12.1, bl@0.9.3, hawk@1.1.1, http-signature@0.10.0, form-data@0.1.4)
22:19:19 [8s] dan:~/meteor-integrations/isotope$ curl -L https://raw.githubusercontent.com/practicalmeteor/spacejam/master/lib/phantomjs-test-in-console.js | node
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1134 100 1134 0 0 902 0 0:00:01 0:00:01 --:--:-- 912
module.js:340
throw err;
^
Error: Cannot find module 'webpage'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at [stdin]:5:10
at [stdin]:44:4
at Object.<anonymous> ([stdin]-wrapper:6:22)
at Module._compile (module.js:456:26)
at evalScript (node.js:536:25)
at Socket.<anonymous> (node.js:154:11)
22:19:24 [2s] dan:~/meteor-integrations/isotope$ phantom --version
phantom: command not found
I'm confused by the three versions of phantom involved here:
$ sudo -H npm -g install phantomjs
[sudo] password for dan:
/usr/bin/phantomjs -> /usr/lib/node_modules/phantomjs/bin/phantomjs
> phantomjs@1.9.12 install /usr/lib/node_modules/phantomjs
> node install.js
Looks like an `npm install -g`; unable to check for already installed version.
Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
Saving to /usr/lib/node_modules/phantomjs/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2
Receiving...
[===============================---------] 77% 0.0s
Received 12854K total.
Extracting tar contents (via spawned process)
Removing /usr/lib/node_modules/phantomjs/lib/phantom
Copying extracted folder /usr/lib/node_modules/phantomjs/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1417328454688/phantomjs-1.9.8-linux-x86_64 -> /usr/lib/node_modules/phantomjs/lib/phantom
Removing /usr/lib/node_modules/phantomjs/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1417328454688
Writing location.js file
Done. Phantomjs binary available at /usr/lib/node_modules/phantomjs/lib/phantom/bin/phantomjs
phantomjs@1.9.12 /usr/lib/node_modules/phantomjs
├── which@1.0.7
├── progress@1.1.8
├── rimraf@2.2.8
├── ncp@1.0.1
├── kew@0.4.0
├── request-progress@0.3.1 (throttleit@0.0.2)
├── mkdirp@0.5.0 (minimist@0.0.8)
├── adm-zip@0.4.4
├── npmconf@2.0.9 (uid-number@0.0.5, inherits@2.0.1, osenv@0.1.0, ini@1.3.2, once@1.3.1, config-chain@1.1.8, nopt@3.0.1, semver@4.1.0)
└── request@2.42.0 (caseless@0.6.0, json-stringify-safe@5.0.0, forever-agent@0.5.2, aws-sign2@0.5.0, tunnel-agent@0.4.0, stringstream@0.0.4, oauth-sign@0.4.0, node-uuid@1.4.1, qs@1.2.2, mime-types@1.0.2, tough-cookie@0.12.1, form-data@0.1.4, bl@0.9.3, http-signature@0.10.0, hawk@1.1.1)
22:21:05 [0s] dan:~/meteor-integrations/isotope$ phantomjs --version
1.9.7
Weird things are happening, indeed. Let me reproduce this with https on Monday, using your steps to reproduce and see what do I need to add to the phantomjs command line.
Dan, OK, figured it out, the phantomjs command line argument that fixed it is --ssl-protocol=TLSv1 and not --ignore-ssl-errors.
i'm going to add a --phantomjs-options command line option to spacejam which will default to:
--load-images=no --ssl-protocol=TLSv1
I'll publish a new spacejam version within the next couple of days.
FYI, check out this blogpost from today:
http://practicalmeteor.com/testing-meteor-packages-command-line-travis-ci/
Nice! Thanks. Good blog post too, I just added a for a Meteor 3rd party packaging. Only problems I noticed: that your editor has collapsed --
into emdash or such. perquisites
-> prerequisites
. you first
-> your
Sorry, took some time. Fixed in v1.1.4.