Skip to content

Commit

Permalink
chore: Add remove-orphans flag to docker compose and update tests to …
Browse files Browse the repository at this point in the history
…use python3 (#6059)
  • Loading branch information
all-seeing-code authored Jul 29, 2020
1 parent 80e6c19 commit 0af21ac
Show file tree
Hide file tree
Showing 6 changed files with 15 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
9 changes: 4 additions & 5 deletions dgraph/cmd/bulk/systest/test-bulk-schema.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function StartAlpha
if [[ $p_dir ]]; then
docker cp $p_dir alpha1:/data/alpha1/
fi
DockerCompose -f $DOCKER_CONF up --detach alpha1
DockerCompose -f $DOCKER_CONF up -d --remove-orphans alpha1

TIMEOUT=10
while [[ $TIMEOUT > 0 ]]; do
Expand All @@ -88,7 +88,7 @@ function StartAlpha
function ResetCluster
{
INFO "restarting cluster with only one zero and alpha"
DockerCompose -f $DOCKER_CONF down
DockerCompose -f $DOCKER_CONF down --remove-orphans
StartZero
StartAlpha
}
Expand Down Expand Up @@ -119,7 +119,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 @@ -218,7 +218,7 @@ EOF
function StopServers
{
INFO "stopping containers"
DockerCompose -f $DOCKER_CONF down
DockerCompose -f $DOCKER_CONF down --remove-orphans
}

function Cleanup
Expand All @@ -235,7 +235,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 @@ -168,12 +168,12 @@ go test -v -tags standalone $SAVEDIR $QUIET || FOUND_DIFFS=1

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

if [[ $FOUND_DIFFS -eq 0 ]]; then
Expand Down
6 changes: 3 additions & 3 deletions systest/bgindex/test-bgindex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ Info "entering directory $SRCDIR"
cd $SRCDIR

Info "bringing down dgraph cluster and data volumes"
DockerCompose down -v
DockerCompose down -v --remove-orphans

Info "bringing up dgraph cluster"
DockerCompose up -d
DockerCompose up -d --remove-orphans

Info "waiting for zero to become leader"
DockerCompose logs -f alpha1 | grep -q -m1 "Successfully upserted groot account"
Expand All @@ -32,7 +32,7 @@ Info "running background indexing test"
go test -v -tags systest || FOUND_DIFFS=1

Info "bringing down dgraph cluster and data volumes"
DockerCompose down -v
DockerCompose down -v --remove-orphans

if [[ $FOUND_DIFFS -eq 0 ]]; then
Info "test passed"
Expand Down

0 comments on commit 0af21ac

Please sign in to comment.