-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[integration] Add query fanout docker integration test (#1652)
- Loading branch information
1 parent
5cbbf13
commit 3613876
Showing
21 changed files
with
990 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
scripts/docker-integration-tests/query_fanout/docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
version: "3.5" | ||
services: | ||
dbnode-cluster-a: | ||
expose: | ||
- "9000-9004" | ||
- "2379-2380" | ||
ports: | ||
- "0.0.0.0:9000-9004:9000-9004" | ||
- "0.0.0.0:2379-2380:2379-2380" | ||
networks: | ||
- backend | ||
image: "m3dbnode_integration:${REVISION}" | ||
coordinator-cluster-a: | ||
expose: | ||
- "7201" | ||
- "7203" | ||
ports: | ||
- "0.0.0.0:7201:7201" | ||
- "0.0.0.0:7203:7203" | ||
networks: | ||
- backend | ||
image: "m3coordinator_integration:${REVISION}" | ||
volumes: | ||
- "./m3coordinator-cluster-a.yml:/etc/m3coordinator/m3coordinator.yml" | ||
dbnode-cluster-b: | ||
expose: | ||
- "9000-9004" | ||
- "2379-2380" | ||
ports: | ||
- "0.0.0.0:19000-19004:9000-9004" | ||
- "0.0.0.0:12379-12380:2379-2380" | ||
networks: | ||
- backend | ||
image: "m3dbnode_integration:${REVISION}" | ||
coordinator-cluster-b: | ||
expose: | ||
- "7201" | ||
- "7203" | ||
ports: | ||
- "0.0.0.0:17201:7201" | ||
- "0.0.0.0:17203:7203" | ||
networks: | ||
- backend | ||
image: "m3coordinator_integration:${REVISION}" | ||
volumes: | ||
- "./m3coordinator-cluster-b.yml:/etc/m3coordinator/m3coordinator.yml" | ||
networks: | ||
backend: |
45 changes: 45 additions & 0 deletions
45
scripts/docker-integration-tests/query_fanout/m3coordinator-cluster-a.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
listenAddress: | ||
type: "config" | ||
value: "0.0.0.0:7201" | ||
|
||
metrics: | ||
scope: | ||
prefix: "coordinator" | ||
prometheus: | ||
handlerPath: /metrics | ||
listenAddress: 0.0.0.0:7203 # until https://github.com/m3db/m3/issues/682 is resolved | ||
sanitization: prometheus | ||
samplingRate: 1.0 | ||
extended: none | ||
|
||
# Fanout queries to remote clusters | ||
rpc: | ||
enabled: true | ||
listenAddress: "0.0.0.0:7202" | ||
remoteListenAddresses: ["coordinator-cluster-b:7202"] | ||
|
||
clusters: | ||
- namespaces: | ||
- namespace: agg | ||
type: aggregated | ||
retention: 10h | ||
resolution: 15s | ||
- namespace: unagg | ||
type: unaggregated | ||
retention: 10m | ||
client: | ||
config: | ||
service: | ||
env: default_env | ||
zone: embedded | ||
service: m3db | ||
cacheDir: /var/lib/m3kv | ||
etcdClusters: | ||
- zone: embedded | ||
endpoints: | ||
- dbnode-cluster-a:2379 | ||
writeConsistencyLevel: majority | ||
readConsistencyLevel: unstrict_majority | ||
|
||
tagOptions: | ||
idScheme: quoted |
45 changes: 45 additions & 0 deletions
45
scripts/docker-integration-tests/query_fanout/m3coordinator-cluster-b.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
listenAddress: | ||
type: "config" | ||
value: "0.0.0.0:7201" | ||
|
||
metrics: | ||
scope: | ||
prefix: "coordinator" | ||
prometheus: | ||
handlerPath: /metrics | ||
listenAddress: 0.0.0.0:7203 # until https://github.com/m3db/m3/issues/682 is resolved | ||
sanitization: prometheus | ||
samplingRate: 1.0 | ||
extended: none | ||
|
||
# Fanout queries to remote clusters | ||
rpc: | ||
enabled: true | ||
listenAddress: "0.0.0.0:7202" | ||
remoteListenAddresses: ["coordinator-cluster-a:7202"] | ||
|
||
clusters: | ||
- namespaces: | ||
- namespace: agg | ||
type: aggregated | ||
retention: 10h | ||
resolution: 15s | ||
- namespace: unagg | ||
type: unaggregated | ||
retention: 10m | ||
client: | ||
config: | ||
service: | ||
env: default_env | ||
zone: embedded | ||
service: m3db | ||
cacheDir: /var/lib/m3kv | ||
etcdClusters: | ||
- zone: embedded | ||
endpoints: | ||
- dbnode-cluster-b:2379 | ||
writeConsistencyLevel: majority | ||
readConsistencyLevel: unstrict_majority | ||
|
||
tagOptions: | ||
idScheme: quoted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -xe | ||
|
||
source $GOPATH/src/github.com/m3db/m3/scripts/docker-integration-tests/common.sh | ||
REVISION=$(git rev-parse HEAD) | ||
COMPOSE_FILE=$GOPATH/src/github.com/m3db/m3/scripts/docker-integration-tests/query_fanout/docker-compose.yml | ||
export REVISION | ||
|
||
echo "Run m3dbnode and m3coordinator containers" | ||
docker-compose -f ${COMPOSE_FILE} up -d dbnode-cluster-a | ||
docker-compose -f ${COMPOSE_FILE} up -d coordinator-cluster-a | ||
|
||
docker-compose -f ${COMPOSE_FILE} up -d dbnode-cluster-b | ||
docker-compose -f ${COMPOSE_FILE} up -d coordinator-cluster-b | ||
|
||
# think of this as a defer func() in golang | ||
function defer { | ||
docker-compose -f ${COMPOSE_FILE} down || echo "unable to shutdown containers" # CI fails to stop all containers sometimes | ||
} | ||
trap defer EXIT | ||
|
||
DBNODE_HOST=dbnode-cluster-a DBDNODE_PORT=9000 DBNODE_HEALTH_PORT=9002 COORDINATOR_PORT=7201 \ | ||
setup_single_m3db_node | ||
|
||
DBNODE_HOST=dbnode-cluster-b DBDNODE_PORT=19000 DBNODE_HEALTH_PORT=19002 COORDINATOR_PORT=17201 \ | ||
setup_single_m3db_node | ||
|
||
echo "Write data to cluster a" | ||
curl -vvvsS -X POST 0.0.0.0:9003/writetagged -d '{ | ||
"namespace": "unagg", | ||
"id": "{__name__=\"test_metric\",cluster=\"cluster-a\",endpoint=\"/request\"}", | ||
"tags": [ | ||
{ | ||
"name": "__name__", | ||
"value": "test_metric" | ||
}, | ||
{ | ||
"name": "cluster", | ||
"value": "cluster-a" | ||
}, | ||
{ | ||
"name": "endpoint", | ||
"value": "/request" | ||
} | ||
], | ||
"datapoint": { | ||
"timestamp":'"$(date +"%s")"', | ||
"value": 42.123456789 | ||
} | ||
}' | ||
|
||
echo "Write data to cluster b" | ||
curl -vvvsS -X POST 0.0.0.0:19003/writetagged -d '{ | ||
"namespace": "unagg", | ||
"id": "{__name__=\"test_metric\",cluster=\"cluster-b\",endpoint=\"/request\"}", | ||
"tags": [ | ||
{ | ||
"name": "__name__", | ||
"value": "test_metric" | ||
}, | ||
{ | ||
"name": "cluster", | ||
"value": "cluster-b" | ||
}, | ||
{ | ||
"name": "endpoint", | ||
"value": "/request" | ||
} | ||
], | ||
"datapoint": { | ||
"timestamp":'"$(date +"%s")"', | ||
"value": 42.123456789 | ||
} | ||
}' | ||
|
||
|
||
function read { | ||
RESPONSE=$(curl "http://0.0.0.0:7201/api/v1/query?query=test_metric") | ||
ACTUAL=$(echo $RESPONSE | jq .data.result[].metric.cluster) | ||
test "$(echo $ACTUAL)" = '"cluster-a" "cluster-b"' | ||
} | ||
|
||
ATTEMPTS=5 TIMEOUT=1 retry_with_backoff read | ||
|
||
function read_sum { | ||
RESPONSE=$(curl "http://0.0.0.0:7201/api/v1/query?query=sum(test_metric)") | ||
ACTUAL=$(echo $RESPONSE | jq .data.result[].value[1]) | ||
test $ACTUAL = '"84.246913578"' | ||
} | ||
|
||
ATTEMPTS=5 TIMEOUT=1 retry_with_backoff read_sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.