mozilla / fxa-auth-server

DEPRECATED - Migrated to https://github.com/mozilla/fxa
Mozilla Public License 2.0
399 stars 108 forks source link

"npm test" fails if not root #938

Closed Fmstrat closed 9 years ago

Fmstrat commented 9 years ago

This may be an update for the README to indicate what must be run as root vs a but in the server itself, but when installing for use as a non-root user, the npm test command fails.

root@groupware-vm:~# cat /etc/issue
Ubuntu 14.04.2 LTS \n \l

My install process:

# Create firefox user
groupadd firefox
useradd -g firefox firefox
mkdir /home/firefox
chown firefox:firefox /home/firefox
usermod --home /home/firefox firefox
usermod -s /bin/bash firefox

# Directory setup
mkdir /var/log/firefox
chown firefox:firefox /var/log/firefox
mkdir -p /opt/groupware/firefox
chown firefox:firefox /opt/groupware/firefox -R

# Install prerequisits
curl -sL https://deb.nodesource.com/setup | sudo bash -
apt-get install git nodejs
apt-get install libgmp3-dev
apt-get install libapache2-mod-wsgi
apt-get install python-dev git-core python-virtualenv
npm install -g grunt-cli
a2enmod proxy_http
a2enmod proxy

# Change to firefox user
su - firefox

# Install mysql backend
cd /opt/groupware/firefox
git clone https://github.com/mozilla/fxa-auth-db-mysql.git
cd /opt/groupware/firefox/fxa-auth-db-mysql
npm install
node bin/db_patcher.js

# Install auth server
cd /opt/groupware/firefox
git clone https://github.com/mozilla/fxa-auth-server.git
cd /opt/groupware/firefox-auth-server
npm install
#
# FAILS HERE
#
# If the below command is run without "su", it fails.
su - -c "npm test"
su - -c "chown firefox:firefox /opt/groupware/firefox -R"

# Install content server
cd /opt/groupware/firefox
git clone https://github.com/mozilla/fxa-content-server.git
cd /opt/groupware/firefox/fxa-content-server
#
# POTENTIAL FAILURE
#
# When the below command is not run as root, the tests fail
CONFIG_FILES=/opt/groupware/config/content-local.json npm install

# Install sync server
cd /opt/groupware/firefox
git clone https://github.com/mozilla-services/syncserver.git
cd syncserver
make build
make test
mv /opt/groupware/firefox/syncserver/syncserver.ini /opt/groupware/firefox/syncserver/syncserver.ini.orig
ln -s /opt/groupware/config/syncserver.ini /opt/groupware/firefox/syncserver/syncserver.ini

# Switch back to root and setup apache
exit
ln -s /opt/groupware/config/firefox.conf /etc/apache2/conf-enabled/firefox.conf
service apache2 restart

There are two indications of failures as non-root above. The first is specific to the auth server. If required, below is all of the information in the config files you see mentioned above.

content-local.json:

root@groupware-vm:~# cat /opt/groupware/config/content-local.json
{
  "fxaccount_url": "https://HOST:19900",
  "public_url": "https://remote.HOST.com:19303",
  "fxaccount_proxy": {
    "enabled": false
  },
  "oauth_url": "http://127.0.0.1:9010",
  "oauth_proxy": {
    "enabled": true
  },
  "client_sessions": {
    "cookie_name": "session",
    "secret": "<removed>",
    "duration": 86400000
  },
  "env": "production",
  "static_max_age" : 0,
  "i18n": {
    "supportedLanguages": ["af", "an", "ar", "as", "ast", "az", "be", "bg", "bn-BD", "bn-IN", "br", "bs", "ca", "cs", "cy", "da", "de", "dsb", "el", "en", "en-GB", "en-ZA", "eo", "es", "es-AR", "es-CL", "es-MX", "et", "eu", "fa", "ff", "fi", "fr", "fy", "fy-NL", "ga", "ga-IE", "gd", "gl", "gu", "gu-IN", "he", "hi-IN", "hr", "hsb", "ht", "hu", "hy-AM", "id", "is", "it", "it-CH", "ja", "kk", "km", "kn", "ko", "ku", "lij", "lt", "lv", "mai", "mk", "ml", "mr", "ms", "nb-NO", "ne-NP", "nl", "nn-NO", "or", "pa", "pa-IN", "pl", "pt", "pt-BR", "pt-PT", "rm", "ro", "ru", "si", "sk", "sl", "son", "sq", "sr", "sr-LATN", "sv", "sv-SE", "ta", "te", "th", "tr", "uk", "ur", "vi", "xh", "zh-CN", "zh-TW", "zu"]
  },

  "route_log_format": "dev_fxa",
  "static_directory": "app",
  "metrics": {
    "sample_rate": 0
  },
  "use_https": false,
  "port": 3030,
  "http_port": 3080
}

syncserver.ini:

root@groupware-vm:~# cat /opt/groupware/config/syncserver.ini
[server:main]
use = egg:Paste#http
host = 0.0.0.0
port = 5000

[app:main]
use = egg:syncserver

[syncserver]
# This must be edited to point to the public URL of your server,
# i.e. the URL as seen by Firefox.
public_url = https://remote.HOST.com:19443/

# This defines the database in which to store all server data.
#sqluri = sqlite:////tmp/syncserver.db
sqluri = pymysql://root@localhost/sync

# This is a secret key used for signing authentication tokens.
# It should be long and randomly-generated.
# The following command will give a suitable value on *nix systems:
#
#    head -c 20 /dev/urandom | sha1sum
#
# If not specified then the server will generate a temporary one at startup.
secret = <removed>

# Set this to "false" to disable new-user signups on the server.
# Only request by existing accounts will be honoured.
# allow_new_users = false

[browserid]
backend = tokenserver.verifiers.LocalVerifier
audiences = https://remote.HOST.com:19443

firefox.conf:

root@groupware-vm:~# cat /opt/groupware/config/firefox.conf
SSLPassPhraseDialog  builtin
SSLSessionCache         shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout  300
Mutex sysvsem default
SSLRandomSeed startup file:/dev/urandom  256
SSLRandomSeed connect builtin
SSLCryptoDevice builtin

LoadModule wsgi_module modules/mod_wsgi.so

<Directory /opt/groupware/firefox/syncserver>
  Require all granted
</Directory>

WSGISocketPrefix /var/run/wsgi

Listen 19443
<VirtualHost _default_:19443>
    ServerName remote.HOST.com
    DocumentRoot /opt/groupware/firefox/syncserver
    #WSGIApplicationGroup %{GLOBAL}
    WSGIProcessGroup sync
    WSGIDaemonProcess sync user=firefox group=firefox processes=2 threads=25 python-path=/opt/groupware/firefox/syncserver/local/lib/python2.7/site-packages/
    WSGIPassAuthorization On
    WSGIScriptAlias / /opt/groupware/firefox/syncserver/syncserver.wsgi
    LogLevel warn
    SSLEngine on
    SSLProtocol all -SSLv2 -SSLv3
    SSLHonorCipherOrder on
    SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"
    SSLCertificateFile /opt/groupware/certs/cert
    SSLCertificateKeyFile /opt/groupware/certs/key
    SSLCertificateChainFile /opt/groupware/certs/ca
    <Files ~ "\.(cgi|shtml|phtml|php3?)$">
        SSLOptions +StdEnvVars
    </Files>
    <Directory "/var/www/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>
    SetEnvIf User-Agent ".*MSIE.*" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0
    CustomLog /var/log/apache2/firefox_access combined
    ErrorLog /var/log/apache2/firefox_error
</VirtualHost>

Listen 19303
<VirtualHost _default_:19303>
    ServerName remote.HOST.com
    LogLevel warn
    SSLEngine on
    SSLProtocol all -SSLv2 -SSLv3
    SSLHonorCipherOrder on
    SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"
    SSLCertificateFile /opt/groupware/certs/cert
    SSLCertificateKeyFile /opt/groupware/certs/key
    SSLCertificateChainFile /opt/groupware/certs/ca
    <Files ~ "\.(cgi|shtml|phtml|php3?)$">
        SSLOptions +StdEnvVars
    </Files>
    <Directory "/var/www/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>
    SetEnvIf User-Agent ".*MSIE.*" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0
    ProxyPass / http://localhost:3030/
    ProxyPassReverse / http://localhost:3030/
    CustomLog /var/log/apache2/firefox_access combined
    ErrorLog /var/log/apache2/firefox_error
</VirtualHost>

Listen 19900
<VirtualHost _default_:19900>
    ServerName remote.HOST.com
    LogLevel warn
    SSLEngine on
    SSLProtocol all -SSLv2 -SSLv3
    SSLHonorCipherOrder on
    SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"
    SSLCertificateFile /opt/groupware/certs/cert
    SSLCertificateKeyFile /opt/groupware/certs/key
    SSLCertificateChainFile /opt/groupware/certs/ca
    <Files ~ "\.(cgi|shtml|phtml|php3?)$">
        SSLOptions +StdEnvVars
    </Files>
    <Directory "/var/www/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>
    SetEnvIf User-Agent ".*MSIE.*" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0
    ProxyPass / http://localhost:9000/
    ProxyPassReverse / http://localhost:9000/
    CustomLog /var/log/apache2/firefox_access combined
    ErrorLog /var/log/apache2/firefox_error
</VirtualHost>
beyerservice commented 9 years ago

I got this too:

fxa-auth-server@1.37.0 test /home/fxcloud/fxa-auth-server NODE_ENV=dev scripts/test-local.sh && grunt

OK: List of supported languages match content server config npm ERR! Test failed. See above for more details. npm WARN This failure might be due to the use of legacy binary "node" npm WARN For further explanations, please read /usr/share/doc/nodejs/README.Debian

npm ERR! not ok code 0

ok, I am on debian jessie and I need to install nodejs-legacy (symlink node to nodejs)

jrgm commented 9 years ago
# Install auth server
cd /opt/groupware/firefox
git clone https://github.com/mozilla/fxa-auth-server.git
cd /opt/groupware/firefox-auth-server
npm install
#
# FAILS HERE

So, if you are in /opt/groupware/firefox and clone the repo, you need to cd /opt/groupware/firefox/firefox-auth-server in order to do npm install. Or, are those not literally the commands you typed?

Fmstrat commented 9 years ago

Sorry, that was just a bad cut/paste. I was in the correct directory. It works with root, which I know we're not supposed to do, but fails with a normal user. Here is the full log with a normal user:

firefox@groupware-vm:/opt/groupware/firefox$ git clone https://github.com/mozilla/fxa-auth-server.git
Cloning into 'fxa-auth-server'...
remote: Counting objects: 7685, done.
remote: Compressing objects: 100% (67/67), done.
remote: Total 7685 (delta 23), reused 0 (delta 0), pack-reused 7618
Receiving objects: 100% (7685/7685), 2.91 MiB | 0 bytes/s, done.
Resolving deltas: 100% (4368/4368), done.
Checking connectivity... done.
firefox@groupware-vm:/opt/groupware/firefox$ cd /opt/groupware/firefox/fxa-auth-server
firefox@groupware-vm:/opt/groupware/firefox/fxa-auth-server$ npm install
npm WARN package.json fxa-auth-server@1.37.0 license should be a valid SPDX license expression
npm WARN peerDependencies The peer dependency grunt@>=0.4.0 included from grunt-contrib-jshint will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency grunt@>=0.4.0 included from grunt-bump will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency hapi@>=8.x.x included from hapi-auth-hawk will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.

> scrypt-hash@1.1.12 install /opt/groupware/firefox/fxa-auth-server/node_modules/scrypt-hash
> node-gyp rebuild

make: Entering directory `/opt/groupware/firefox/fxa-auth-server/node_modules/scrypt-hash/build'
  CC(target) Release/obj.target/scrypt/crypto_scrypt-sse.o
  CXX(target) Release/obj.target/scrypt/node_scrypt.o
  SOLINK_MODULE(target) Release/obj.target/scrypt.node
  SOLINK_MODULE(target) Release/obj.target/scrypt.node: Finished
  COPY Release/scrypt.node
make: Leaving directory `/opt/groupware/firefox/fxa-auth-server/node_modules/scrypt-hash/build'
npm WARN prefer global grunt-cli@0.1.13 should be installed with -g
grunt-copyright@0.2.0 node_modules/grunt-copyright

through@2.3.7 node_modules/through

hkdf@0.0.2 node_modules/hkdf

uuid@1.4.1 node_modules/uuid

poolee@1.0.0 node_modules/poolee
 keep-alive-agent@0.0.1

simplesmtp@0.3.35 node_modules/simplesmtp
 xoauth2@0.1.8
 rai@0.1.12

binary-split@0.1.2 node_modules/binary-split
 bops@0.0.6 (to-utf8@0.0.1, base64-js@0.0.2)

envc@2.2.0 node_modules/envc
 params@0.1.1 (type-detect@0.1.2)

grunt-bump@0.3.1 node_modules/grunt-bump
 semver@4.3.4

hapi-auth-hawk@2.0.0 node_modules/hapi-auth-hawk
 boom@2.7.1
 hoek@2.13.0

bluebird@2.9.25 node_modules/bluebird

scrypt-hash@1.1.12 node_modules/scrypt-hash
 bindings@1.2.1
 nan@1.8.4

pem-jwk@1.5.1 node_modules/pem-jwk
 asn1.js@1.0.3 (minimalistic-assert@1.0.0, inherits@2.0.1, bn.js@1.3.0)

mozlog@2.0.1 node_modules/mozlog
 merge@1.2.0
 intel@1.0.0 (stack-trace@0.0.9, dbug@0.4.2, symbol@0.2.1, utcstring@0.1.0, strftime@0.8.4, chalk@0.5.1)

hawk@2.3.1 node_modules/hawk
 cryptiles@2.0.4
 sntp@1.0.9
 boom@2.7.1
 hoek@2.13.0

load-grunt-tasks@3.1.0 node_modules/load-grunt-tasks
 multimatch@2.0.0 (array-differ@1.0.0, array-union@1.0.1, minimatch@2.0.7)
 findup-sync@0.2.1 (glob@4.3.5)

jws@3.0.0 node_modules/jws
 jwa@1.0.0 (buffer-equal-constant-time@1.0.1, base64url@0.0.6)
 base64url@1.0.4 (concat-stream@1.4.8, meow@2.0.0)

mailparser@0.5.1 node_modules/mailparser
 mime@1.3.4
 uue@2.1.0 (array.prototype.findindex@1.0.0, extend@2.0.1)
 mimelib@0.2.19 (addressparser@0.3.2)
 encoding@0.1.11 (iconv-lite@0.4.8)

fxa-jwtool@0.7.1 node_modules/fxa-jwtool
 bluebird@2.9.15
 fetch@0.3.6 (encoding@0.1.11)

request@2.55.0 node_modules/request
 caseless@0.9.0
 json-stringify-safe@5.0.0
 aws-sign2@0.5.0
 forever-agent@0.6.1
 stringstream@0.0.4
 oauth-sign@0.6.0
 tunnel-agent@0.4.0
 isstream@0.1.2
 node-uuid@1.4.3
 qs@2.4.2
 combined-stream@0.0.7 (delayed-stream@0.0.5)
 form-data@0.2.0 (async@0.9.0)
 mime-types@2.0.11 (mime-db@1.9.1)
 http-signature@0.10.1 (assert-plus@0.1.5, asn1@0.1.11, ctype@0.5.3)
 bl@0.9.4 (readable-stream@1.0.33)
 tough-cookie@1.1.0
 har-validator@1.7.0 (commander@2.8.1, chalk@1.0.0, is-my-json-valid@2.11.0)

grunt-cli@0.1.13 node_modules/grunt-cli
 resolve@0.3.1
 nopt@1.0.10 (abbrev@1.0.5)
 findup-sync@0.1.3 (glob@3.2.11, lodash@2.4.2)

grunt-nsp-shrinkwrap@0.0.3 node_modules/grunt-nsp-shrinkwrap
 colors@0.6.2
 text-table@0.2.0
 cli-color@0.2.3 (memoizee@0.2.6, es5-ext@0.9.2)

tap@0.7.1 node_modules/tap
 yamlish@0.0.6
 inherits@2.0.1
 buffer-equal@0.0.1
 slide@1.1.6
 deep-equal@1.0.0
 nopt@3.0.1 (abbrev@1.0.5)
 mkdirp@0.5.0 (minimist@0.0.8)
 difflet@0.2.6 (deep-is@0.1.3, charm@0.1.2, traverse@0.6.6)
 glob@4.5.3 (once@1.3.2, inflight@1.0.4, minimatch@2.0.7)
 runforcover@0.0.2 (bunker@0.1.2)

grunt@0.4.5 node_modules/grunt
 dateformat@1.0.2-1.2.3
 which@1.0.9
 eventemitter2@0.4.14
 getobject@0.1.0
 rimraf@2.2.8
 colors@0.6.2
 async@0.1.22
 grunt-legacy-util@0.2.0
 hooker@0.2.3
 exit@0.1.2
 nopt@1.0.10 (abbrev@1.0.5)
 lodash@0.9.2
 glob@3.1.21 (inherits@1.0.0, graceful-fs@1.2.3)
 minimatch@0.2.14 (sigmund@1.0.0, lru-cache@2.6.2)
 coffee-script@1.3.3
 underscore.string@2.2.1
 iconv-lite@0.2.11
 findup-sync@0.1.3 (glob@3.2.11, lodash@2.4.2)
 grunt-legacy-log@0.1.1 (underscore.string@2.3.3, lodash@2.4.2)
 js-yaml@2.0.5 (argparse@0.1.16, esprima@1.0.4)

nock@1.7.1 node_modules/nock
 propagate@0.3.1
 debug@1.0.4 (ms@0.6.2)
 mkdirp@0.5.0 (minimist@0.0.8)
 chai@1.10.0 (assertion-error@1.0.0, deep-eql@0.1.3)
 lodash@2.4.1

aws-sdk@2.1.26 node_modules/aws-sdk
 xmlbuilder@0.4.2
 xml2js@0.2.8
 sax@0.5.3

fxa-auth-db-mem@0.33.0 node_modules/fxa-auth-db-mem
 bluebird@2.2.2
 mozlog@2.0.0 (merge@1.2.0, intel@1.0.0)
 fxa-auth-db-server@0.36.0 (restify@2.8.2)

ass@0.0.4 node_modules/ass
 async@0.2.10
 temp@0.6.0 (osenv@0.0.3, rimraf@2.1.4)
 cheerio@0.12.4 (entities@0.5.0, underscore@1.4.4, htmlparser2@3.1.4, cheerio-select@0.0.3)
 blanket@1.1.7 (xtend@3.0.0, esprima@1.2.5, falafel@0.3.1)

convict@0.6.1 node_modules/convict
 depd@1.0.0
 validator@3.26.0
 optimist@0.6.1 (wordwrap@0.0.3, minimist@0.0.10)
 moment@2.8.4
 cjson@0.3.0 (jsonlint@1.6.0)

joi@6.4.1 node_modules/joi
 topo@1.0.2
 isemail@1.1.1
 hoek@2.13.0
 moment@2.10.3

hapi@8.4.0 node_modules/hapi
 cryptiles@2.0.4
 peekaboo@1.0.0
 ammo@1.0.0
 topo@1.0.2
 accept@1.0.0
 items@1.1.0
 kilt@1.1.1
 catbox-memory@1.1.1
 call@2.0.1
 qs@2.4.0
 shot@1.4.2
 boom@2.6.1
 iron@2.1.2
 wreck@5.2.0
 hoek@2.11.1
 catbox@4.2.2
 mimos@2.0.2 (mime-db@1.7.0)
 inert@2.1.4 (lru-cache@2.5.0)
 subtext@1.0.2 (content@1.0.1, pez@1.0.0)
 joi@6.0.8 (isemail@1.1.1, moment@2.9.0)
 statehood@2.0.0 (joi@5.1.0)
 h2o2@4.0.0 (joi@5.1.0)
 heavy@3.0.0 (joi@5.1.0)
 vision@2.0.0 (joi@5.1.0)

grunt-contrib-jshint@0.11.2 node_modules/grunt-contrib-jshint
 hooker@0.2.3
 jshint@2.7.0 (strip-json-comments@1.0.2, exit@0.1.2, shelljs@0.3.0, console-browserify@1.1.0, minimatch@2.0.7, cli@0.6.6, htmlparser2@3.8.2, lodash@3.6.0)

sjcl@1.0.2 node_modules/sjcl

fxa-auth-mailer@1.0.7 node_modules/fxa-auth-mailer
 jed@0.5.4
 rc@0.5.0 (strip-json-comments@0.1.3, deep-extend@0.2.11, ini@1.1.0, minimist@0.0.10)
 bluebird@2.2.2
 bunyan@1.0.0 (mv@2.0.3)
 restify@2.8.2 (assert-plus@0.1.5, escape-regexp-component@1.0.2, tunnel-agent@0.4.0, deep-equal@0.2.2, keep-alive-agent@0.0.1, negotiator@0.4.9, lru-cache@2.6.2, mime@1.3.4, formidable@1.0.17, qs@1.2.2, node-uuid@1.4.3, once@1
.3.2, semver@2.3.2, spdy@1.32.0, backoff@2.4.1, verror@1.6.0, http-signature@0.10.1, csv@0.4.2, bunyan@0.23.1)
 handlebars@1.3.0 (optimist@0.3.7, uglify-js@2.3.6)
 fxa-content-server-l10n@0.0.0
 nodemailer@0.7.1 (public-address@0.1.1, directmail@0.1.8, he@0.3.6, readable-stream@1.1.13, mailcomposer@0.2.12, aws-sdk@2.0.5)
 i18n-abide@0.0.22 (gobbledygook@0.0.4, async@0.1.22, optimist@0.3.4, jsxgettext@0.3.9, plist@0.4.3)
 po2json@0.3.0 (lodash@2.4.2, nomnom@1.5.2, gettext-parser@0.2.0)
firefox@groupware-vm:/opt/groupware/firefox/fxa-auth-server$ npm test

> fxa-auth-server@1.37.0 test /opt/groupware/firefox/fxa-auth-server
> NODE_ENV=dev scripts/test-local.sh && grunt

Generating keypair
Secret Key saved: /opt/groupware/firefox/fxa-auth-server/config/secret-key.json
Public Key saved: /opt/groupware/firefox/fxa-auth-server/config/public-key.json
OK: List of supported languages match content server config
npm ERR! Test failed.  See above for more details.
firefox@groupware-vm:/opt/groupware/firefox/fxa-auth-server$
jrgm commented 9 years ago

So what does NODE_ENV=dev ./scripts/tap-coverage.js test/local 2>/tmp/err.log output. (If it outputs nothing, what is show in /tmp/err.log?)

yiip87 commented 9 years ago

Last time I ran the tests they failed the same way. Something (ass?) tries to save a coverage report in /home/$USER/tmp and blows up if this directory doesn't exist. Just did a fresh clone on a testbox and was able to reproduce:

firefox@sync /opt/test/fxa-auth-server $ NODE_ENV=dev ./scripts/tap-coverage.js test/local

fs.js:654
  return binding.mkdir(pathModule._makeLong(path),
                 ^
Error: ENOENT, no such file or directory '/home/firefox/tmp/ass-coverage-data115420-30578-pnb5p1'
    at Object.fs.mkdirSync (fs.js:654:18)
    at Object.mkdirSync (/opt/test/fxa-auth-server/node_modules/ass/node_modules/temp/lib/temp.js:138:6)
    at Object.module.exports.enable (/opt/test/fxa-auth-server/node_modules/ass/index.js:34:15)
    at Object.<anonymous> (/opt/test/fxa-auth-server/scripts/tap-coverage.js:8:28)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)

When I create /home/firefox/tmp/ manually, the tests run fine.

Fmstrat commented 9 years ago

First it fails, looks like it assumes ~/tmp exists:

firefox@groupware-vm:/opt/groupware/firefox/fxa-auth-server$ NODE_ENV=dev ./scripts/tap-coverage.js test/local 2>/tmp/err.log
firefox@groupware-vm:/opt/groupware/firefox/fxa-auth-server$ cat /tmp/err.log 

fs.js:654
  return binding.mkdir(pathModule._makeLong(path),
                 ^
Error: ENOENT, no such file or directory '/home/firefox/tmp/ass-coverage-data115419-23709-1jp7ejn'
    at Object.fs.mkdirSync (fs.js:654:18)
    at Object.mkdirSync (/opt/groupware/firefox/fxa-auth-server/node_modules/ass/node_modules/temp/lib/temp.js:138:6)
    at Object.module.exports.enable (/opt/groupware/firefox/fxa-auth-server/node_modules/ass/index.js:34:15)
    at Object.<anonymous> (/opt/groupware/firefox/fxa-auth-server/scripts/tap-coverage.js:8:28)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)

If I create the directory it succeeds:

firefox@groupware-vm:/opt/groupware/firefox/fxa-auth-server$ mkdir /home/firefox/tmp
firefox@groupware-vm:/opt/groupware/firefox/fxa-auth-server$ ls -ld /home/firefox/tmp
drwxrwxr-x 2 firefox firefox 4096 May 19 21:15 /home/firefox/tmp
firefox@groupware-vm:/opt/groupware/firefox/fxa-auth-server$ NODE_ENV=dev ./scripts/tap-coverage.js test/local 2>/tmp/err.log
ok test/local/account_preverified_token_tests.js ........ 7/7
ok test/local/account_reset_token_tests.js ............ 10/10
ok test/local/base_path_tests.js ........................ 5/5
ok test/local/butil_tests.js ............................ 4/4
ok test/local/concurrent_tests.js ....................... 2/2
ok test/local/customs.js .............................. 31/31
ok test/local/db_tests.js ............................. 53/53
ok test/local/email_validity_tests.js ................. 15/15
ok test/local/forgot_password_token_tests.js .......... 16/16
ok test/local/hkdf_tests.js ............................. 6/6
ok test/local/key_fetch_token_tests.js ................ 19/19
ok test/local/mailer_locales_tests.js ................. 58/58
ok test/local/password_check_test.js .................... 6/6
ok test/local/password_tests.js ....................... 11/11
ok test/local/pbkdf2_tests.js ........................... 4/4
ok test/local/resend_blackout_tests.js .................. 2/2
ok test/local/scrypt_tests.js ........................... 6/6
ok test/local/session_token_tests.js .................. 12/12
ok test/local/token_expiry_tests.js ..................... 2/2
ok test/local/verifier_upgrade_tests.js ................. 3/3
total ............................................... 272/272

ok
code coverage: 82.2%
generating coverage.html...
- complete in 1.9s

Need to create ~/tmp if it doesn't exist?

jrgm commented 9 years ago

Need to create ~/tmp if it doesn't exist?

Yeah, ugh. So do that to unblock yourself for now. I have an alternate branch of node-ass that uses an updated node-temp that fixes this bug in node-temp that I'll freshen and put in a PR to switch to it in fxa-auth-server.

Sorry for the bother and thanks for digging into this.

Fmstrat commented 9 years ago

NP, thanks!