mozillascience / PaperBadger

Issuing badges to credit authors for their work on academic papers
https://badges.mozillascience.org/
Mozilla Public License 2.0
95 stars 45 forks source link

Update docker image to use node.js version 6 #202

Closed andreabedini closed 8 years ago

andreabedini commented 8 years ago

I tried running the webapp on the latest node (using the node:6 docker image) and it seems to work just fine. Also I managed to run the tests and only one fails, for unrelated reasons I guess

❯ docker exec -it paperbadger_paperbadger_1 bash -c 'cd /src && npm test'
npm info it worked if it ends with ok
npm info using npm@3.8.9
npm info using node@v6.2.0
npm info lifecycle PaperBadger@0.1.1~pretest: PaperBadger@0.1.1
npm info lifecycle PaperBadger@0.1.1~test: PaperBadger@0.1.1

> PaperBadger@0.1.1 test /src
> mocha test/*

  Integration test against the real Badge server
connection!
    ✓ get all the badges (834ms)
    1) render JSON data in pug with the pretty param
    ✓ get a count of all the badges (751ms)
    ✓ get all badge instances of a certain badge (1060ms)
    ✓ get a count of all badge instances of a certain badge (1055ms)
    ✓ get all badge instances earned by a user (625ms)
    ✓ get a count of all badge instances earned by a user (606ms)
    ✓ get all badge instances of a certain badge earned by a user (608ms)
    ✓ get a count of all badge instances of a certain badge earned by a user (611ms)
    ✓ get all badges of a certain paper (1798ms)
    ✓ get the number of badges of a certain paper (1798ms)
    ✓ get all badge instances of a certain badge for a paper (630ms)
    ✓ get the badge count for instances of a certain badge for a paper (617ms)
    ✓ get all badge instances earned by a user for a paper. (732ms)
    ✓ get a count of all badge instances earned by a user for a paper. (649ms)
    ✓ get all badge instances of a certain badge earned by a user for a paper. (673ms)
    ✓ get a count of all badge instances of a certain badge earned by a user for a paper. (631ms)

  helpers
    ✓ emailFromORCID creates an email address
    ✓ ORCIDFromEmail strips email leaving ORCID
    ✓ ORCIDFromEmail strips email leaving ORCID when ORCID ends in X
    ✓ modEntry removes email and adds ORCID ID
    ✓ modEntry deletes only email from entry
    ✓ urlFromDOI returns a doi.org URI given a DOI
    ✓ DOIFromURL returns a DOI given a URI

  23 passing (17s)
  1 failing

  1) Integration test against the real Badge server render JSON data in pug with the pretty param:
     Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.

npm info lifecycle PaperBadger@0.1.1~test: Failed to exec test script
npm ERR! Test failed.  See above for more details.

not entirely sure about the failing test

If I do curl -v 'http://localhost:5000/badges?pretty=true' I get what the test expects (without any delay).

* Connected to localhost (127.0.0.1) port 5000 (#0)
> GET /badges?pretty=true HTTP/1.1
> Host: localhost:5000
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< X-Powered-By: Express
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept
< Content-Type: text/html; charset=utf-8
< Content-Length: 22118
< ETag: W/"PXLxDwZqawDhgorXG09CKg=="
< set-cookie: sid=s%3AD-H7m5D924GyUPef06M6syJeNnmLKcSy.QL20t5xvHlZwTtdez4OK8oibhTtzrdERQeCe2vbobrM; Path=/; HttpOnly
< Date: Fri, 03 Jun 2016 02:40:52 GMT
< Connection: keep-alive
<

maybe I am running the tests again something else than my running copy :thinking_face:

Anyway, I'll open this PR as it's a starting point.

andreabedini commented 8 years ago

oh we got travis-ci! awesome

josmas commented 8 years ago

Hey @andreabedini thanks a million for this.

We are going to need to specify the engine in package.json as it will be needed for deployment to heroku. Also that test timing out... might be just a matter of giving mocha a few more (milli)seconds for that particular test. Integration tests are not run by TravisCI when the origin is a pull request (API keys), that's why it's passed above.

In any case, shall we take this over or will you have time at some point to make changes? I know you are done for the day, and we have another docker change in the pipeline #200 so might take this over so we get to close this later today, if you don't mind.

andreabedini commented 8 years ago

No problem with you taking over. It was great fun giving a hand!

Sent from my phone Andrea

On 3 Jun 2016, at 5:43 PM, Jos notifications@github.com wrote:

Hey @andreabedini thanks a million for this.

We are going to need to specify the engine in package.json as it will be needed for deployment to heroku. Also that test timing out... might be just a matter of giving mocha a few more (milli)seconds for that particular test. Integration tests are not run by TravisCI when the origin is a pull request (API keys), that's why it's passed above.

In any case, shall we take this over or will you have time at some point to make changes? I know you are done for the day, and we have another docker change in the pipeline #200 so might take this over so we get to close this later today, if you don't mind.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

josmas commented 8 years ago

thanks @andreabedini It was very helpful! Much appreciated.