Django server inside docker is causing robot tests to give blank screens?

Viewed 105

I have built an environment inside docker compose in order to run robot tests. The environment consists of django web app, postgres and robot framework container. The Problem I have is that I get many blank screens in different tests, while using external Django web app instance which is installed on a virtual machine doesn't have this problem. The blank screen causes that elements are not found hence so many failures:

JavascriptException: Message: javascript error: Cannot read property 'get' of undefined
(Session info: headless chrome=84.0.4147.89)

I am sure that the problem is with the Django app container itself not robot container since as said above I have tested with the same environment but against different web app which is installed outside Docker, and it worked.

docker-compose.yml:

      version: "3.6"
      services:
        redis:
          image: redis:3.2
          ports:
            - 6379
          networks:
            local:
              ipv4_address: 10.0.0.20

       smtpd:
         image: mysmtpd:1.0.5
         ports:
           - 25
         networks:
           - local

      postgres:
        image: mypostgres
        build: 
          context: ../dias-postgres/
          args:
            VERSION: ${POSTGRES_TAG:-12}
      hostname: "postgres"
      environment:
        POSTGRES_DB: ${POSTGRES_USER}
        POSTGRES_USER: ${POSTGRES_USER}
        POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      networks:
        local:
          ipv4_address: 10.0.0.100
      ports:
        - 5432
      volumes:
        - my-postgres:/var/lib/postgresql/data

     app:
       image: mypyenv:${PYENV_TAG:-1.1}
       tty: true
       stdin_open: true
       user: ${MY_USER:-jenkins}
       networks:
         local:
           ipv4_address: 10.0.0.50
       hostname: "app"
       ports:
         - 8000
       volumes:
         - ${WORKSPACE}:/app
       environment:
         ALLOW_HOST: "*"
         PGHOST: postgres
         PGUSER: ${POSTGRES_USER}
         PGDATABASE: ${POSTGRES_USER}
         PGPASSWORD: ${POSTGRES_PASSWORD}
         ANONYMIZE: "false"
         REDIS_HOST: redis
         REDIS_DB: 2
         APP_PATH: ${APP_PATH}
         APP: ${MANDANT}
         TIMER: ${TIMER:-20}
         EMAIL_BACKEND: "dias.core.log.mail.SmtpEmailBackend"
         EMAIL_HOST: "smtpd"
         EMAIL_PORT: "25"
  
    robot:
      image: myrobot:${ROBOT_TAG:-1.0.9}
      user: ${ROBOT_USER:-jenkins}
      networks:
        local:
          ipv4_address: 10.0.0.70
      volumes:
        - ${WORKSPACE}:/app
        - ${ROBOT_REPORTS_PATH}:/APP_Robot_Reports
      environment:
        APP_ROBOT: ${APP_ROBOT}      
        TIMER: ${TIMER:-20}
        PGHOST: postgres
        PGUSER: ${POSTGRES_USER}
        PGDATABASE: ${POSTGRES_USER}
        PGPASSWORD: ${POSTGRES_PASSWORD}
        THREADS: ${THREADS:-4}
      tty: true
      stdin_open: true 
      entrypoint: start-robot

   networks:
     local:
       driver: bridge
       ipam:
         config:
           - subnet: 10.0.0.0/24
          
   volumes:
     my-postgres:
       external: true
       name: my-postgres

I have monitored the app stats and nothing is abnormal during testing. Also, manually tested the app in browser and it looks just good with nothing wrong about it. Note: There is no mismatch between chromedriver and google chrome version (anyway this doesn't matter since the same robot container has worked with other instance where no Docker is used for the Django app)

Anyone has an idea ?

1 Answers

I didn't focus before that I run pabot with 8 processes while django app was started with 2 celery workers. As soon as I increased celery workers to 4 it worked. Not sure though if this is the actually cause but it made sense to me as well as it worked.

celery -A server -c ${CELERY_CONCURRENCY:-2} worker

Related