faster tests

This commit is contained in:
Maxim Dolgushin 2023-11-01 17:29:26 +07:00 committed by skeris
parent 011256c7cb
commit 3a583317c3
4 changed files with 24 additions and 21 deletions

@ -13,8 +13,6 @@ RUN mkdir /bin/golang-migrate -p
ADD ./tools/migrate /bin/golang-migrate/
# Add main files to app
ADD . .
# Download go depences
# RUN go mod download
# Build app
RUN GOOS=linux go build -o bin ./...
@ -25,8 +23,6 @@ FROM alpine:3.18.3 AS test
# Install packages
RUN apk --no-cache add ca-certificates
# Set GO111MODULE env
# ENV GO111MODULE=off
# Create home directory
WORKDIR /app
# Copy build file

@ -37,8 +37,9 @@ test.integration.down: ## shutting down integration environment
docker-compose -f deployments/test/docker-compose.yaml down --volumes
test.integration.start: ## run integration test
docker-compose -p integration -f deployments/test/docker-compose.app.yaml down
docker-compose -p integration -f deployments/test/docker-compose.app.yaml up --exit-code-from app --remove-orphans
docker-compose -p integration -f deployments/test/docker-compose.integration.yaml down
docker-compose -p integration -f deployments/test/docker-compose.integration.yaml up --exit-code-from app --remove-orphans
docker-compose -p integration -f deployments/test/docker-compose.integration.yaml down
test.e2e.start: ## run integration test
go test ./tests/e2e/...

@ -1,8 +1,8 @@
version: "3"
services:
app:
container_name: app
integration:
container_name: customer-integration
image: golang:1
volumes:
- ../..:/app:ro,z

@ -7,7 +7,7 @@ services:
customer-service:
container_name: customer-service
build:
context: ../../.
context: ../..
dockerfile: Dockerfile
target: test
env_file:
@ -50,11 +50,12 @@ services:
customer-migration:
container_name: customer-migration
build:
context: ../../.
dockerfile: Dockerfile
target: test
image: alpine
command: migrate -source file://migrations -database "mongodb://test:test@customer-db:27017/admin" up
volumes:
- ../../migrations/test:/app/migrations:ro
- ../../tools/migrate:/usr/local/bin/migrate:ro
working_dir: /app
depends_on:
- customer-db
networks:
@ -111,9 +112,10 @@ services:
console:
tty: true
container_name: customer-console
image: docker.redpanda.com/redpandadata/console:v2.2.4
entrypoint: /bin/sh
command: -c "echo \"$$CONSOLE_CONFIG_FILE\" > /tmp/config.yml; /app/console"
entrypoint: ''
command: sh -c 'echo "$$CONSOLE_CONFIG_FILE" > /tmp/config.yml && exec /app/console'
environment:
CONFIG_FILEPATH: /tmp/config.yml
CONSOLE_CONFIG_FILE: |
@ -136,18 +138,20 @@ services:
networks:
- test
depends_on:
- redpanda
connect:
condition: service_started
redpanda:
condition: service_healthy
connect:
tty: true
image: docker.redpanda.com/redpandadata/connectors:latest
hostname: connect
container_name: connect
networks:
- test
# hostname: connect
container_name: customer-connect
# platform: 'linux/amd64'
depends_on:
- redpanda
redpanda:
condition: service_healthy
ports:
- "8083:8083"
environment:
@ -168,6 +172,8 @@ services:
CONNECT_GC_LOG_ENABLED: "false"
CONNECT_HEAP_OPTS: -Xms512M -Xmx512M
CONNECT_LOG_LEVEL: info
networks:
- test
networks:
test: