--- version: "3.4" x-test-common: &test-common depends_on: redis-cluster: condition: service_healthy kafka: condition: service_started clickhouse: condition: service_started zookeeper: condition: service_started image: "$SNUBA_IMAGE" profiles: ["run_test"] volumes: - ".artifacts:/.artifacts" environment: SNUBA_SETTINGS: "$SNUBA_SETTINGS" CLICKHOUSE_HOST: clickhouse.local USE_REDIS_CLUSTER: "1" REDIS_HOST: "redis-cluster" REDIS_PORT: 7000 REDIS_DB: 0 DEFAULT_BROKERS: "kafka:9092" SNUBA_TEST_SHARD: "${SNUBA_TEST_SHARD:-0}" SNUBA_TEST_SHARD_TOTAL: "${SNUBA_TEST_SHARD_TOTAL:-1}" # override the `snuba` user to write to the /.artifacts mount user: root services: snuba-test-rust: <<: *test-common entrypoint: /bin/sh command: - "-c" - >- snuba migrations migrate --force && make test-rust snuba-test: <<: *test-common entrypoint: python command: - "-m" - "pytest" - "--maxfail=50" - "--ignore" - "tests/migrations" - "-vv" - "${TEST_LOCATION:-tests}" - "--cov" - "." - "--cov-report" - "xml:/.artifacts/${TEST_LOCATION:-tests}/${SNUBA_SETTINGS}/coverage.xml" - "--junit-xml" - "/.artifacts/${TEST_LOCATION:-tests}/${SNUBA_SETTINGS}/pytest.junit.xml" snuba-test-migrations: <<: *test-common entrypoint: python command: - "-m" - "pytest" - "--maxfail=50" - "-vv" - "tests/migrations" - "--junit-xml" - "/.artifacts/${TEST_LOCATION:-tests}/${SNUBA_SETTINGS}/pytest.junit.xml" # ClickHouse Keeper speaks the ZooKeeper protocol on zookeeper:2181. It runs # from the ClickHouse image, which is multi-arch, so CI can run on arm64. zookeeper: image: "${CLICKHOUSE_IMAGE:-ghcr.io/getsentry/image-mirror-altinity-clickhouse-server:25.8.33.10002.altinitystable}" entrypoint: ["clickhouse-keeper", "--config-file=/etc/clickhouse-keeper/keeper_config.xml"] volumes: - ./config/clickhouse/keeper.xml:/etc/clickhouse-keeper/keeper_config.xml # KRaft mode, like sentry-shared-kafka in devservices. 6.2.0 is amd64-only. kafka: image: "ghcr.io/getsentry/image-mirror-confluentinc-cp-kafka:7.5.0" environment: KAFKA_PROCESS_ROLES: "broker,controller" KAFKA_NODE_ID: "1" CLUSTER_ID: "MkU3OEVBNTcwNTJENDM2Qk" KAFKA_CONTROLLER_QUORUM_VOTERS: "1@127.0.0.1:29093" KAFKA_CONTROLLER_LISTENER_NAMES: "CONTROLLER" KAFKA_LISTENERS: "PLAINTEXT://0.0.0.0:9092,CONTROLLER://0.0.0.0:29093" KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://kafka:9092" KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT" KAFKA_INTER_BROKER_LISTENER_NAME: "PLAINTEXT" KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: "1" CONFLUENT_SUPPORT_METRICS_ENABLE: "false" KAFKA_LOG4J_LOGGERS: "kafka.cluster=WARN,kafka.controller=WARN,kafka.coordinator=WARN,kafka.log=WARN,kafka.server=WARN,state.change.logger=WARN" KAFKA_LOG4J_ROOT_LOGLEVEL: "WARN" KAFKA_TOOLS_LOG4J_LOGLEVEL: "WARN" clickhouse: image: "${CLICKHOUSE_IMAGE:-ghcr.io/getsentry/image-mirror-altinity-clickhouse-server:25.8.33.10002.altinitystable}" hostname: clickhouse.local extra_hosts: - "clickhouse.local:127.0.0.1" # Add entry to /etc/hosts file ports: - "8123:8123" - "9000:9000" - "9009:9009" volumes: - ./config/clickhouse/macros.xml:/etc/clickhouse-server/config.d/macros.xml - ./config/clickhouse/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml - ./config/clickhouse/remote_servers.xml:/etc/clickhouse-server/config.d/remote_servers.xml - ./config/clickhouse/default-password.xml:/etc/clickhouse-server/users.d/default-password.xml ulimits: nofile: soft: 262144 hard: 262144 # nodes for multi-node clickhouse cluster clickhouse-query: depends_on: - zookeeper image: "${CLICKHOUSE_IMAGE:-ghcr.io/getsentry/image-mirror-altinity-clickhouse-server:25.8.33.10002.altinitystable}" hostname: clickhouse-query.local extra_hosts: - "clickhouse-query.local:127.0.0.1" # Add entry to /etc/hosts file profiles: ["multi_node"] volumes: - ./test_distributed_migrations/config/clickhouse/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml - ./test_distributed_migrations/config/clickhouse/remote_servers.xml:/etc/clickhouse-server/config.d/remote_servers.xml - ./config/clickhouse/default-password.xml:/etc/clickhouse-server/users.d/default-password.xml ulimits: nofile: soft: 262144 hard: 262144 clickhouse-01: depends_on: - zookeeper image: "${CLICKHOUSE_IMAGE:-ghcr.io/getsentry/image-mirror-altinity-clickhouse-server:25.8.33.10002.altinitystable}" hostname: clickhouse-01.local extra_hosts: - "clickhouse-01.local:127.0.0.1" # Add entry to /etc/hosts file profiles: ["multi_node"] volumes: - ./test_distributed_migrations/config/clickhouse/macros-01.xml:/etc/clickhouse-server/config.d/macros.xml - ./test_distributed_migrations/config/clickhouse/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml - ./test_distributed_migrations/config/clickhouse/remote_servers.xml:/etc/clickhouse-server/config.d/remote_servers.xml - ./config/clickhouse/default-password.xml:/etc/clickhouse-server/users.d/default-password.xml ulimits: nofile: soft: 262144 hard: 262144 clickhouse-02: depends_on: - zookeeper image: "${CLICKHOUSE_IMAGE:-ghcr.io/getsentry/image-mirror-altinity-clickhouse-server:25.8.33.10002.altinitystable}" hostname: clickhouse-02.local extra_hosts: - "clickhouse-02.local:127.0.0.1" # Add entry to /etc/hosts file profiles: ["multi_node"] volumes: - ./test_distributed_migrations/config/clickhouse/macros-02.xml:/etc/clickhouse-server/config.d/macros.xml - ./test_distributed_migrations/config/clickhouse/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml - ./test_distributed_migrations/config/clickhouse/remote_servers.xml:/etc/clickhouse-server/config.d/remote_servers.xml - ./config/clickhouse/default-password.xml:/etc/clickhouse-server/users.d/default-password.xml ulimits: nofile: soft: 262144 hard: 262144 clickhouse-03: depends_on: - zookeeper image: "${CLICKHOUSE_IMAGE:-ghcr.io/getsentry/image-mirror-altinity-clickhouse-server:25.8.33.10002.altinitystable}" hostname: clickhouse-03.local extra_hosts: - "clickhouse-03.local:127.0.0.1" # Add entry to /etc/hosts file profiles: ["multi_node"] volumes: - ./test_distributed_migrations/config/clickhouse/macros-03.xml:/etc/clickhouse-server/config.d/macros.xml - ./test_distributed_migrations/config/clickhouse/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml - ./test_distributed_migrations/config/clickhouse/remote_servers.xml:/etc/clickhouse-server/config.d/remote_servers.xml - ./config/clickhouse/default-password.xml:/etc/clickhouse-server/users.d/default-password.xml ulimits: nofile: soft: 262144 hard: 262144 clickhouse-04: depends_on: - zookeeper image: "${CLICKHOUSE_IMAGE:-ghcr.io/getsentry/image-mirror-altinity-clickhouse-server:25.8.33.10002.altinitystable}" hostname: clickhouse-04.local extra_hosts: - "clickhouse-04.local:127.0.0.1" # Add entry to /etc/hosts file profiles: ["multi_node"] volumes: - ./test_distributed_migrations/config/clickhouse/macros-04.xml:/etc/clickhouse-server/config.d/macros.xml - ./test_distributed_migrations/config/clickhouse/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml - ./test_distributed_migrations/config/clickhouse/remote_servers.xml:/etc/clickhouse-server/config.d/remote_servers.xml - ./config/clickhouse/default-password.xml:/etc/clickhouse-server/users.d/default-password.xml ulimits: nofile: soft: 262144 hard: 262144 redis-cluster: image: ghcr.io/getsentry/image-mirror-valkey-valkey:8.0.12 command: - sh - -c - | rm -f nodes-*.conf for p in 7000 7001 7002; do valkey-server --port $$p --protected-mode no --cluster-enabled yes \ --cluster-config-file nodes-$$p.conf --save '' & done for p in 7000 7001 7002; do until valkey-cli -p $$p ping >/dev/null 2>&1; do sleep 0.1; done; done IP=$$(hostname -i | awk '{print $$1}') valkey-cli --cluster create $$IP:7000 $$IP:7001 $$IP:7002 --cluster-yes wait healthcheck: test: ["CMD-SHELL", "valkey-cli -p 7000 cluster info | grep -q cluster_state:ok"] interval: 1s timeout: 3s retries: 30 networks: default: external: name: cloudbuild