Docker-compose throwing seg fault in machine executor


#1

I have a test which tests an application that is deployed/used as a docker-compose file, but to test it I spin up the relevant elements and test directly against the other containers.

It seems that with my config below I hit a docker-compose seqfault when using the machine image.

Status: Downloaded newer image for redis:latest

Creating repo_kamaji-localstack_1 …

Creating repo_kamaji-redis_1 …

/bin/bash: line 1: 26306 Segmentation fault (core dumped) docker-compose up -d kamaji-localstack kamaji-redis
Exited with code 139

This seems like a docker-compose error/bug, but I can’t reproduce it locally with ubuntu 18.06, any ideas on how to work through/around this so that I can get my tests to run?

version: 2
jobs:
  build:
    machine:
      image: circleci/classic:201808-01
    working_directory: ~/repo

    steps:
      - checkout
      - run:
          name: Set Python Version
          command: pyenv global 3.7.0
      - run:
          name: install/update pip pipenv
          command: |
            sudo python -m pip install --upgrade pip setuptools wheel
            sudo python -m pip install pipenv

      - run:
          name: install docker-compose
          command: |
            sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
            # remove .env file in order to use set ENVIRONMENT VARIABLES
            rm .env

      - run:
          name: install application python dependencies
          command: |
            pipenv sync --dev

      - run:
          name: run test-server
          command: |
            docker-compose up -d kamaji-localstack kamaji-redis
            sleep 5
            KAMAJI_TESTING=True REDIS_WORKER_TIMEOUT_SECONDS=5 pipenv run pytest --cov=kamaji tests/test_kamaji_server.py -v --junitxml=./tests/reports/test_kamaji_server.xml
            docker-compose down

#2

Do you need the machine executor? If you can use a Docker executor, you will have a much wider choice of base images. Plus, Docker Compose in the Docker executor works very reliably for me.


#3

I have a feeling I should restructure the project to have better separation of concerns, but I’m basically developing a server/client application together as the interface between them isn’t stable. So the test configuration consists of a server-test and client-test. Where the client is tested against the server code which is built during testing into a docker-compose unit.

So the client is then tested against the custom unit through the localhost interface. Using this layout I need a way to communicate with my custom docker container in the unit through localhost. (or through an interface I can obtain and point to somehow)

As this test layout runs locally on ubuntu 18.04, it would be less work for me at the moment, if there was an easy work-around for the docker-compose seg-fault.

However, I am interested in better test layouts. Just not sure if I can find the time to refactor the project now.

What would be a better testing layout when you need to test against a custom docker image?
Do I need to build and serve this image in a private docker repository? Is there something available in circleci?