GithubHelp home page GithubHelp logo

Comments (6)

adrienjoly avatar adrienjoly commented on July 26, 2024

Hypothesis:

This is caused by the fact that mongodb is reachable only by the mongo service, not the web service on which the npm test command is executed.

from openwhyd.

adrienjoly avatar adrienjoly commented on July 26, 2024

=> Trying to add the following lines in Dockerfile:

RUN sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
RUN sudo apt-get install -y mongodb-org-shell
RUN sudo apt-get install -y mongodb-org-tools

(as recommended there: http://corpus.hubwiz.com/2/node.js/27050643.html)

from openwhyd.

adrienjoly avatar adrienjoly commented on July 26, 2024

...then:

$ docker-compose build

(as recommended there: docker/compose#1487 (comment))

=> getting sudo: not found

=> trying without sudo

from openwhyd.

adrienjoly avatar adrienjoly commented on July 26, 2024

getting Unable to locate package mongodb-org-shell

=> replacing new lines in Dockerfile by:

RUN apt-get update
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
RUN apt-get install -y mongodb

(as recommended there: https://stackoverflow.com/a/28966356/592254 and https://hub.docker.com/r/richardxxx0x/docker-leanote/builds/bh3enhrdrfscxzrgxxybqol/)

=> now getting couldn't connect to server 127.0.0.1:27017:

> mongo openwhyd_test --eval "db.dropDatabase();" && mongo openwhyd_test ../whydDB/initdb.js && mongo openwhyd_test ../whydDB/initdb_team.js

MongoDB shell version: 2.4.10
connecting to: openwhyd_test
Thu Jul 13 09:04:10.052 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
exception: connect failed

=> Considering another alternative: run mongodb init scripts from the app server instead.

from openwhyd.

adrienjoly avatar adrienjoly commented on July 26, 2024

(WIP) currently experimenting with:

  • running db init scripts from web server (app.js) --> 4e7674c
  • clearing the database and starting/stoping web server from the acceptance test script

current problem: it seems complicated to mix webdriver-based code (synchronous) and callback-based code with console.logs. => my tests start running before I'm done with my before() checks and db inits...

EDIT: it would probably make more sense to execute just unit tests in the container, while providing an easy way to run acceptance/end-to-end tests from outside the container (but connecting to the app server running inside the container)

from openwhyd.

adrienjoly avatar adrienjoly commented on July 26, 2024

Different approach was chosen: run tests outside of Docker container,
but enable DB to be also updated from the outside, in order for test scripts to reset the database (#81)

from openwhyd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.