version: '3'
services:
  test-postgres:
    image: postgres
    environment:
      POSTGRES_PASSWORD: Redalert2
      POSTGRES_USER: squiz
      POSTGRES_DB: squiz
    volumes:
      - test-postgres:/var/lib/postgresql/data
    ports:
      - 35432:5432
    networks:
      - penatest
    healthcheck:
      test: pg_isready -U squiz
      interval: 2s
      timeout: 2s
      retries: 10

  # need update!
  #  test-pena-auth-service:
  #    image: penahub.gitlab.yandexcloud.net:5050/pena-services/pena-auth-service:staging.872
  #    container_name: test-pena-auth-service
  #    init: true
  #    env_file: auth.env.test
  #    healthcheck:
  #      test: wget -T1 --spider http://localhost:8000/user
  #      interval: 2s
  #      timeout: 2s
  #      retries: 5
  #    environment:
  #      - DB_HOST=test-pena-auth-db
  #      - DB_PORT=27017
  #      - ENVIRONMENT=staging
  #      - HTTP_HOST=0.0.0.0
  #      - HTTP_PORT=8000
  #      - DB_USERNAME=test
  #      - DB_PASSWORD=test
  #      - DB_NAME=admin
  #      - DB_AUTH=admin
  #    # ports:
  #    #   - 8000:8000
  #    depends_on:
  #      - test-pena-auth-db
  #      # - pena-auth-migration
  #    networks:
  #      - penatest
  #
  #  test-pena-auth-db:
  #    container_name: test-pena-auth-db
  #    init: true
  #    image: "mongo:6.0.3"
  #    command: mongod --quiet --logpath /dev/null
  #    volumes:
  #      - test-mongodb:/data/db
  #      - test-mongoconfdb:/data/configdb
  #    environment:
  #      MONGO_INITDB_ROOT_USERNAME: test
  #      MONGO_INITDB_ROOT_PASSWORD: test
  #    # ports:
  #    #   - 27017:27017
  #    networks:
  #      - penatest

  test-minio:
    container_name: test-minio
    init: true
    image: quay.io/minio/minio
    volumes:
      - test-minio:/data
    command: [ "minio", "--quiet", "server", "/data" ]
    networks:
      - penatest

  test-squiz:
    container_name: test-squiz
    init: true
    build:
      context: ../..
      dockerfile: TestsDockerfile
    depends_on:
      test-postgres:
        condition: service_healthy
    #      test-pena-auth-service:
    #        condition: service_healthy
    # volumes:
    #   - ./../..:/app:ro
    # command: [ "go", "test", "./tests", "-run", "TestFoo" ]
    command: [ "go", "test", "-parallel", "1", "./tests" ]
    networks:
      - penatest

networks:
  penatest:


volumes:
  test-minio:
  test-postgres:
  test-mongodb:
  test-mongoconfdb:
