Skip to content

Commit 9b18e44

Browse files
committed
Run curl via a docker container
So that it has connectivity to the network the other containers are on. Signed-off-by: Bryan Boreham <[email protected]>
1 parent df6c29a commit 9b18e44

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

integration-tests/common.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ STORAGE_ARGS="-config-yaml=/tests/schema1.yaml -dynamodb.url=dynamodb://u:p@dyna
99
INGESTER_ARGS="$COMMON_ARGS $STORAGE_ARGS -ingester.num-tokens=4 -ingester.min-ready-duration=1s --ingester.final-sleep=0s -ingester.concurrent-flushes=5"
1010
RUN_ARGS="--net=cortex -v $TEST_DIR:/tests"
1111

12+
# Run curl on the same network as the test containers (on CircleCI this is not connected to the host)
13+
run_curl() {
14+
docker run $RUN_ARGS --rm byrnedo/alpine-curl "$@"
15+
}
16+
1217
# Execute command $1 repeatedly until it returns true; description in $2, optional repeat limit in $3
1318
wait_for() {
1419
reps=${3:-10}

integration-tests/test-flush.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ docker run $RUN_ARGS -d --name=i1 --hostname=i1 quay.io/cortexproject/ingester:$
1616

1717
sleep 5
1818
I1_ADDR=$(container_ip i1)
19-
wait_for "curl -s -f -m 3 $I1_ADDR/ready" "ingester ready"
19+
wait_for "run_curl -s -f -m 3 $I1_ADDR/ready" "ingester ready"
2020

2121
has_tokens_owned() {
22-
curl -s -f -m 3 $1/metrics | grep 'cortex_ring_tokens_owned' >/dev/null
22+
run_curl -s -f -m 3 $1/metrics | grep 'cortex_ring_tokens_owned' >/dev/null
2323
}
2424
DIST_ADDR=$(container_ip distributor)
2525
wait_for "has_tokens_owned $DIST_ADDR" "distributor to see ingester in ring"

integration-tests/test-handover.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ echo Start first ingester
1212
docker run $RUN_ARGS -d --name=i1 --hostname=i1 quay.io/cortexproject/ingester:$IMAGE_TAG $INGESTER_ARGS -ingester.claim-on-rollout=true
1313

1414
I1_ADDR=$(container_ip i1)
15-
wait_for "curl -s -f -m 3 $I1_ADDR:/ready" "ingester ready"
15+
wait_for "run_curl -s -f -m 3 $I1_ADDR:/ready" "ingester ready"
1616

1717
has_tokens_owned() {
18-
curl -s -f -m 3 $1:/metrics | grep -q 'cortex_ring_tokens_owned'
18+
run_curl -s -f -m 3 $1:/metrics | grep -q 'cortex_ring_tokens_owned'
1919
}
2020
DIST_ADDR=$(container_ip distributor)
2121
wait_for "has_tokens_owned $DIST_ADDR" "distributor to see ingester in ring"

0 commit comments

Comments
 (0)