Code Monkey home page Code Monkey logo

testdriven-app-2.3's Introduction

testdriven-app-2.3's People

Contributors

mjhea0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

testdriven-app-2.3's Issues

Bug in Form tests after added "prop-types"

Just after added the package prop-types I had the following error in Form tests:

FAIL src/components/tests/Form.test.jsx
● When not authenticated › Register Form submits the form properly

expect(jest.fn()).toHaveBeenCalledTimes(1)

Expected mock function to have been called one time, but it was called three times.
  
  at Object.it (src/components/__tests__/Form.test.jsx:58:47)
      at new Promise (<anonymous>)
  at Promise.resolve.then.el (node_modules/p-map/index.js:46:16)
  at process._tickCallback (internal/process/next_tick.js:68:7)

● When not authenticated › Login Form submits the form properly

expect(jest.fn()).toHaveBeenCalledTimes(1)

Expected mock function to have been called one time, but it was called three times.
  
  at Object.it (src/components/__tests__/Form.test.jsx:58:47)
      at new Promise (<anonymous>)
  at Promise.resolve.then.el (node_modules/p-map/index.js:46:16)
  at process._tickCallback (internal/process/next_tick.js:68:7)

Has anyone had the same problem and can help me?

linux vs windows sh files

Earlier I was following this tutorial, and when it came to the postgres docker configuration in section 1. I was getting this strange error about no such file or directory. I already asked and answered it on stackoverflow: https://stackoverflow.com/questions/53165021/postgres-docker-exits-with-code-1-and-exec-user-process-caused-no-such-file-or/53165415#53165415

long story short it was the end of line character was different from dos to linux. once I changed it from crlf to lf worked flawlessly!

I just wanted to let you know , and maybe you could include this for future revisions to help someone else out! feel free to close this issue

amazing tutorial so far!

python test scripts doesn't actually fail

@cli.command()
def test():
    """Runs the tests without code coverage"""
    tests = unittest.TestLoader().discover("project/tests", pattern="test*.py")
    result = unittest.TextTestRunner(verbosity=2).run(tests)
    if result.wasSuccessful():
        return 0
    return 1

I've tried creating a few of my own services and noticed that the tests didn't actually fail the test.sh script.
I found out that we need a concrete error for this to register to the inspect $? users etc.

I recommend changing the return 1 to sys.exit(result) instead, or another message.

I haven't tested it in the test-ci.sh, but I guess it might be the same. I also recall that @mjhea0 mentioned it in the book, but here is a solution that works for me at least.

if result.wasSuccessful():
    return 0
sys.exit(result)

#edit forgot changed code

Recreating 754df5bbf2a9_testdriven-app_users_1 ... error

ERROR: for 754df5bbf2a9_testdriven-app_users_1 Cannot start service users: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: "/usr/src/app/entrypoint.sh": permission denied": unknown ERROR: for users Cannot start service users: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: "/usr/src/app/entrypoint.sh": permission denied": unknown

users manage.py commands broken

I'm sure its some package that I haven't tracked yet - though it could be something with docker itself - but if you build the project currently the flask cli commands aren't recognized. Below is from cloning and building the repository about 5 minutes before posting this issue.

$ docker-compose -f docker-compose-dev.yml run users python manage.py recreate_db
Starting testdriven-app-23_users-db_1 ... done
Usage: manage.py [OPTIONS] COMMAND [ARGS]...
Try "manage.py --help" for help.

Error: No such command "recreate_db".

travis ci build fails due to entrypoint.sh permisions

Hi ,
It seems Travis CI build (when push to GitHub) fails always with the same error:

Creating flask-docker-react_users-db_1 ... 
ERROR: for flask-docker-react_users_1  Cannot start service users: oci runtime error: container_linux.go:265: starting container process caused "exec: \"/usr/src/app/entrypoint.sh\": permission denied"
ERROR: for users  Cannot start service users: oci runtime error: container_linux.go:265: starting container process caused "exec: \"/usr/src/app/entrypoint.sh\": permission denied"
ERROR: Encountered errors while bringing up the project.
The command "docker-compose -f docker-compose-dev.yml up --build -d" failed and exited with 1 during .
Your build has been stopped.

I have successfully followed the course until the travis CI point. I can run it locally or on AmazonEC2 but the same build fails on Travis CI.

I am using Windows 10 Pro and latest release of Docker for Windows as of November 2018.
My docker-compose version is 1.23.2

When i check the permissions of the entrypoint.sh file from commander cmd i get

-rwxr-xr-x 1 nikos 197121 155 Dec 28 16:44 entrypoint.sh*

my docker-dev file is:

# base image
FROM python:3.6.5-alpine

# install dependencies
RUN apk update && \
    apk add --virtual build-deps gcc python-dev musl-dev && \
    apk add postgresql-dev && \
    apk add netcat-openbsd

# set working directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

# add and install requirements
COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip install -r requirements.txt

# add emtrypoint.sh
COPY ./entrypoint.sh /usr/src/app/entrypoint.sh

# add app
COPY . /usr/src/app
RUN chmod +x /usr/src/app/entrypoint.sh

# run server
CMD ["/usr/src/app/entrypoint.sh"]

and my docker-compose-dev

version: '3.6'

services: 

  users:
    build: 
      context: ./services/users
      dockerfile: Dockerfile-dev
    volumes: 
      - './services/users:/usr/src/app'
    ports: 
      - 5001:5000
    environment: 
      - FLASK_ENV=development
      - APP_SETTINGS=project.config.DevelopmentConfig 
      - DATABASE_URL=postgres://postgres:postgres@users-db:5432/users_dev
      - DATABASE_TEST_URL=postgres://postgres:postgres@users-db:5432/users_test
    depends_on: 
      - users-db  

  users-db:
    build: 
      context: ./services/users/project/db
      dockerfile: Dockerfile
    ports: 
      - 5435:5432
    environment: 
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres

  nginx:
    build:
      context: ./services/nginx
      dockerfile: Dockerfile-dev
    restart: always
    ports:
      - 8081:80
    depends_on:
      - users

Cypress setup not working

I wired up Cypress to work with the initial test. However, I am trying to run it through the full suite within test.sh, and I keep getting the following error:

>   Running: index.test.js...                                                                (1 of 1)
> 
> 
>   Index
>     1) users should be able to view the index page
> 
> 
>   0 passing (312ms)
>   1 failing
> 
>   1) Index users should be able to view the index page:
>      CypressError: cy.visit() failed trying to load:
> 
> http://localhost/
> 
> We attempted to make an http request to this URL but the request failed without a response.
> 
> We received this error at the network level:
> 
>   > Error: connect ECONNREFUSED 127.0.0.1:80
> 
> Common situations why this would fail:
>   - you don't have internet access
>   - you forgot to run / boot your web server
>   - your web server isn't accessible
>   - you have weird network configuration settings on your computer
> 
> The stack trace for this error is:
> 
> Error: connect ECONNREFUSED 127.0.0.1:80
>     at Object.exports._errnoException (util.js:1024:11)
>     at exports._exceptionWithHostPort (util.js:1047:20)
>     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1150:14)
> 
>       at Object.cypressErr (http://localhost:62040/__cypress/runner/cypress_runner.js:67483:11)
>       at Object.throwErr (http://localhost:62040/__cypress/runner/cypress_runner.js:67448:18)
>       at Object.throwErrByPath (http://localhost:62040/__cypress/runner/cypress_runner.js:67475:17)
>       at http://localhost:62040/__cypress/runner/cypress_runner.js:58333:31
>       at visitFailedByErr (http://localhost:62040/__cypress/runner/cypress_runner.js:57944:12)
>       at http://localhost:62040/__cypress/runner/cypress_runner.js:58332:22
>       at tryCatcher (http://localhost:62040/__cypress/runner/cypress_runner.js:6846:23)
>       at Promise._settlePromiseFromHandler (http://localhost:62040/__cypress/runner/cypress_runner.js:4868:31)
>       at Promise._settlePromise (http://localhost:62040/__cypress/runner/cypress_runner.js:4925:18)
>       at Promise._settlePromise0 (http://localhost:62040/__cypress/runner/cypress_runner.js:4970:10)
>       at Promise._settlePromises (http://localhost:62040/__cypress/runner/cypress_runner.js:5045:18)
>       at Async._drainQueue (http://localhost:62040/__cypress/runner/cypress_runner.js:1778:16)
>       at Async._drainQueues (http://localhost:62040/__cypress/runner/cypress_runner.js:1788:10)
>       at Async.drainQueues (http://localhost:62040/__cypress/runner/cypress_runner.js:1662:14)
>       at <anonymous>

I've rolled things back to the basic dev environment, using the commands that you outline at the beginning of Part 4. Now, all of my tests are passing and the page is mostly rendering at http://localhost. However, the API call to get users is returning the following error: GET http://localhost/users 500 (INTERNAL SERVER ERROR) in Chrome DevTools. I have no idea what I've done wrong, and I have even resorted to essentially copy-pasting the code from your repo. I guess there is a problem with some part of my setup but I can;t figure it out.

Can anyone help?
Thanks in advance

cypress failed to load /

In the beginning of CH 4, the first test has you run cy.visit('/') which returns a 404 for me. If I change that to cy.visit('http://localhost/') the test passes. From my understanding this will fail travis or any other env. I was curious as to how yours worked without the local host part?

here is the error I receive

CypressError: cy.visit() failed trying to load:

/

We failed looking for this file at the path:

/redacted/testdriven-app/

The internal Cypress web server responded with:

404: Not Found

Thank you

Creating testdriven-app_users_1 ... error

Hi Michael,

I have a problem with your tutorial in part 1.

In fact, this error occurs when I run the command docker-compose -f docker-compose-dev.yml up -d --build of page 28 :

testdriven-app_users-db_1 is up-to-date
Starting testdriven-app_users_1 ... error

ERROR: for testdriven-app_users_1  Cannot start service users: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/usr/src/app/entrypoint.sh\": permission denied": unknown

ERROR: for users  Cannot start service users: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/usr/src/app/entrypoint.sh\": permission denied": unknown
ERROR: Encountered errors while bringing up the project.

Can you help me on this point please ?

Thank you very much and have a nice day.

Valentin

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.