cyberark/secretless-broker

View on GitHub
test/connector/tcp/mysql/docker-compose.yml

Summary

Maintainability
Test Coverage
version: '3.0'

services:
  mysql_no_tls: &mysql_no_tls
    image: mysql:8.1
    healthcheck:
      test: ["CMD-SHELL", "mysqladmin -psecurerootpass status"]
      interval: 1s
      timeout: 30s
    environment:
      MYSQL_ROOT_PASSWORD: securerootpass
    volumes:
      - ./etc/test.sql:/docker-entrypoint-initdb.d/test.sql
      - ./etc/no-ssl.cnf:/etc/mysql/conf.d/no-ssl.cnf

  mysql:
    <<: *mysql_no_tls
    ports:
      - 3306:3306
    volumes:
      - ./etc/test.sql:/docker-entrypoint-initdb.d/test.sql
      - ./etc/ssl.cnf:/etc/mysql/conf.d/ssl.cnf
      - ./ssl:/etc/mysql-ssl

  secretless-dev:
    image: secretless-dev
    command: ./bin/reflex
    environment:
      DB_HOST_NO_TLS: mysql_no_tls
      DB_HOST_TLS: mysql
      DB_PORT: 3306
      DB_USER: testuser
      DB_PASSWORD: testpass
    volumes:
      - ../../../../:/secretless
      - ./fixtures/secretless.dev.yml:/secretless.yml
      - mysql-socket:/sock
    ports:
      - 5555
      - 6666

  secretless:
    image: secretless-broker-coverage
    entrypoint: "/usr/local/bin/secretless-broker -test.v -test.run ^TestCoverage$$ -test.coverprofile=/test-coverage/cover.out"
    environment:
      SB_RUN_COVERAGE: "true"
    volumes:
      - ../../../../test/util/ssl:/secretless/test/util/ssl
      - ./fixtures/secretless.yml:/secretless.yml
      - mysql-socket:/sock
      - ./test-coverage:/test-coverage

  test:
    build:
      context: .
      dockerfile: Dockerfile.dev
    command: sleep 999d
    environment:
      TEST_ROOT: /secretless/test/connector/tcp/mysql
      DB_PROTOCOL: mysql
      DB_HOST_TLS: mysql
      DB_HOST_NO_TLS: mysql_no_tls
      DB_PORT: 3306
      DB_USER: testuser
      DB_PASSWORD: testpass
      SECRETLESS_HOST:
      VERBOSE:
    volumes:
      - mysql-socket:/sock
      # NOTE: fixtures are dynamically generated and don't exist in the secretless-dev snapshot
      # NOTE: volume mount to get latest secretless source instead of relying on snapshot
      - ../../../..:/secretless

volumes:
  mysql-socket: