Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fvt): add healthcheck, depends_on and --wait #2601

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/fvt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,9 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
- name: Test (Functional)
run: make test_functional
run: |
curl -sSL "https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-$(uname -s)-$(uname -m)" -o /tmp/docker-compose
sudo install -m755 /tmp/docker-compose "$(dirname $(which docker-compose))"
docker version --format 'Docker Engine version v{{.Server.Version}}'
docker-compose version
make test_functional
122 changes: 114 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ services:
args:
KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1}
SCALA_VERSION: ${SCALA_VERSION:-2.13}
healthcheck:
test:
[
'CMD',
'/opt/kafka-${KAFKA_VERSION:-3.5.1}/bin/kafka-configs.sh',
'--bootstrap-server',
'kafka-1:9091',
'--broker',
'1',
'--describe',
]
interval: 15s
timeout: 15s
retries: 10
start_period: 360s
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
- toxiproxy
restart: always
environment:
KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1}
Expand All @@ -66,6 +86,26 @@ services:
args:
KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1}
SCALA_VERSION: ${SCALA_VERSION:-2.13}
healthcheck:
test:
[
'CMD',
'/opt/kafka-${KAFKA_VERSION:-3.5.1}/bin/kafka-configs.sh',
'--bootstrap-server',
'kafka-2:9091',
'--broker',
'2',
'--describe',
]
interval: 15s
timeout: 15s
retries: 10
start_period: 360s
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
- toxiproxy
restart: always
environment:
KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1}
Expand All @@ -91,6 +131,26 @@ services:
args:
KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1}
SCALA_VERSION: ${SCALA_VERSION:-2.13}
healthcheck:
test:
[
'CMD',
'/opt/kafka-${KAFKA_VERSION:-3.5.1}/bin/kafka-configs.sh',
'--bootstrap-server',
'kafka-3:9091',
'--broker',
'3',
'--describe',
]
interval: 15s
timeout: 15s
retries: 10
start_period: 360s
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
- toxiproxy
restart: always
environment:
KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1}
Expand All @@ -116,6 +176,26 @@ services:
args:
KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1}
SCALA_VERSION: ${SCALA_VERSION:-2.13}
healthcheck:
test:
[
'CMD',
'/opt/kafka-${KAFKA_VERSION:-3.5.1}/bin/kafka-configs.sh',
'--bootstrap-server',
'kafka-4:9091',
'--broker',
'4',
'--describe',
]
interval: 15s
timeout: 15s
retries: 10
start_period: 360s
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
- toxiproxy
restart: always
environment:
KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1}
Expand All @@ -141,6 +221,26 @@ services:
args:
KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1}
SCALA_VERSION: ${SCALA_VERSION:-2.13}
healthcheck:
test:
[
'CMD',
'/opt/kafka-${KAFKA_VERSION:-3.5.1}/bin/kafka-configs.sh',
'--bootstrap-server',
'kafka-5:9091',
'--broker',
'5',
'--describe',
]
interval: 15s
timeout: 15s
retries: 10
start_period: 360s
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
- toxiproxy
restart: always
environment:
KAFKA_VERSION: ${KAFKA_VERSION:-3.5.1}
Expand All @@ -160,13 +260,19 @@ services:
KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: 'false'
toxiproxy:
image: 'ghcr.io/shopify/toxiproxy:2.4.0'
healthcheck:
test: ['CMD', '/toxiproxy-cli', 'l']
interval: 15s
timeout: 15s
retries: 3
start_period: 30s
ports:
# The tests themselves actually start the proxies on these ports
- '29091:29091'
- '29092:29092'
- '29093:29093'
- '29094:29094'
- '29095:29095'
# The tests themselves actually start the proxies on these ports
- '29091:29091'
- '29092:29092'
- '29093:29093'
- '29094:29094'
- '29095:29095'

# This is the toxiproxy API port
- '8474:8474'
# This is the toxiproxy API port
- '8474:8474'
5 changes: 4 additions & 1 deletion functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ func prepareDockerTestEnvironment(ctx context.Context, env *testEnvironment) err
env.KafkaVersion = "3.5.1"
}

c := exec.Command("docker-compose", "up", "-d")
// docker-compose v2.17.0 or newer required for `--wait-timeout` support
c := exec.Command(
"docker-compose", "up", "-d", "--quiet-pull", "--timestamps", "--wait", "--wait-timeout", "600",
)
c.Stdout = os.Stdout
c.Stderr = os.Stderr
c.Env = append(os.Environ(), fmt.Sprintf("KAFKA_VERSION=%s", env.KafkaVersion))
Expand Down