Skip to content

Commit

Permalink
(release/v1.2) chore: Add remove-orphans flag to docker compose and u…
Browse files Browse the repository at this point in the history
…pdate tests to use python3 (#6361)

(cherry picked from commit fc5927b)

Co-authored-by: Anurag <[email protected]>
  • Loading branch information
martinmr and all-seeing-code authored Sep 1, 2020
1 parent 2f7eeee commit ddcdb43
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
4 changes: 2 additions & 2 deletions contrib/scripts/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ function stopCluster {

function loginWithGroot() {
curl -s -XPOST localhost:8180/login -d '{"userid": "groot","password": "password"}' \
| python -c \
"import json; resp = raw_input(); data = json.loads(resp); print data['data']['accessJWT']"
| python3 -c \
"import json; resp = input(); data = json.loads(resp); print(data['data']['accessJWT'])"
}
2 changes: 1 addition & 1 deletion contrib/scripts/goldendata-queries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function run_index_test {
timeout=$(( timeout * 2 ))
done

NUM=$(echo $N | python -m json.tool | grep $GREPFOR | wc -l)
NUM=$(echo $N | python3 -m json.tool | grep $GREPFOR | wc -l)
if [[ ! "$NUM" -eq "$ANS" ]]; then
echo "Index test failed: ${X} Expected: $ANS Got: $NUM"
exit 1
Expand Down
19 changes: 11 additions & 8 deletions dgraph/cmd/bulk/systest/test-bulk-schema.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ INFO() { echo "$ME: $@"; }
ERROR() { echo >&2 "$ME: $@"; }
FATAL() { ERROR "$@"; exit 1; }

function DockerCompose {
docker-compose -p dgraph "$@"
}

set -e

INFO "rebuilding dgraph"
Expand Down Expand Up @@ -45,7 +49,7 @@ function ErrorExit
function StartZero
{
INFO "starting zero container"
docker-compose -f $DOCKER_CONF up --force-recreate --detach zero1
DockerCompose -f $DOCKER_CONF up --force-recreate --detach zero1
TIMEOUT=10
while [[ $TIMEOUT > 0 ]]; do
if docker logs zero1 2>&1 | grep -q 'CID set'; then
Expand All @@ -63,11 +67,11 @@ function StartAlpha
local p_dir=$1

INFO "starting alpha container"
docker-compose -f $DOCKER_CONF up --force-recreate --no-start alpha1
DockerCompose -f $DOCKER_CONF up --force-recreate --no-start alpha1
if [[ $p_dir ]]; then
docker cp $p_dir alpha1:/data/alpha1/
fi
docker-compose -f $DOCKER_CONF up --detach alpha1
DockerCompose -f $DOCKER_CONF up -d --remove-orphans alpha1

TIMEOUT=10
while [[ $TIMEOUT > 0 ]]; do
Expand All @@ -84,7 +88,7 @@ function StartAlpha
function ResetCluster
{
INFO "restarting cluster with only one zero and alpha"
docker-compose -f $DOCKER_CONF down
DockerCompose -f $DOCKER_CONF down --remove-orphans
StartZero
StartAlpha
}
Expand All @@ -111,7 +115,7 @@ function QuerySchema
{
INFO "running schema query"
local out_file="schema.out"
curl -sS -H "Content-Type: application/graphql+-" localhost:$HTTP_PORT/query -XPOST -d'schema(pred:[genre,language,name,revenue,predicate_with_default_type,predicate_with_index_no_uid_count,predicate_with_no_uid_count]) {}' | python -c "import json,sys; d=json.load(sys.stdin); json.dump(d['data'],sys.stdout,sort_keys=True,indent=2)" > $out_file
curl -sS -H "Content-Type: application/graphql+-" localhost:$HTTP_PORT/query -XPOST -d'schema(pred:[genre,language,name,revenue,predicate_with_default_type,predicate_with_index_no_uid_count,predicate_with_no_uid_count]) {}' | python3 -c "import json,sys; d=json.load(sys.stdin); json.dump(d['data'],sys.stdout,sort_keys=True,indent=2)" > $out_file
echo >> $out_file
}

Expand Down Expand Up @@ -205,8 +209,8 @@ EOF

function StopServers
{
INFO "stoping containers"
docker-compose -f $DOCKER_CONF down
INFO "stopping containers"
DockerCompose -f $DOCKER_CONF down --remove-orphans
}

function Cleanup
Expand All @@ -223,7 +227,6 @@ UpdateDatabase
QuerySchema
DoExport
StopServers

popd >/dev/null
mkdir dir2
pushd dir2 >/dev/null
Expand Down
6 changes: 3 additions & 3 deletions systest/1million/test-reindex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Info "entering directory $SRCDIR"
cd $SRCDIR

Info "bringing down zero and alpha and data volumes"
DockerCompose down -v
DockerCompose down -v --remove-orphans

Info "bringing up zero container"
DockerCompose up -d --remove-orphans --force-recreate zero1
Expand All @@ -51,7 +51,7 @@ DockerCompose run -v $BENCHMARKS_REPO:$BENCHMARKS_REPO --name bulk_load zero1 \
EOF

Info "bringing up alpha container"
DockerCompose up -d --force-recreate alpha1 alpha2 alpha3
DockerCompose up -d --force-recreate --remove-orphans alpha1 alpha2 alpha3

Info "waiting for alpha to be ready"
DockerCompose logs -f alpha1 | grep -q -m1 "Server is ready"
Expand All @@ -71,7 +71,7 @@ Info "running regression queries"
go test -v -tags systest || FOUND_DIFFS=1

Info "bringing down zero and alpha and data volumes"
DockerCompose down -v
DockerCompose down -v --remove-orphans

if [[ $FOUND_DIFFS -eq 0 ]]; then
Info "no diffs found in query results"
Expand Down
4 changes: 2 additions & 2 deletions systest/21million/test-21million.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ fi

if [[ $CLEANUP == all ]]; then
Info "bringing down zero and alpha and data volumes"
DockerCompose down -v
DockerCompose down -v --remove-orphans
elif [[ $CLEANUP == none ]]; then
Info "leaving up zero and alpha"
else
Info "bringing down zero and alpha only"
DockerCompose down
DockerCompose down --remove-orphans
fi

exit $FOUND_DIFFS

0 comments on commit ddcdb43

Please sign in to comment.