github.com/unigraph-dev/dgraph@v1.1.1-0.20200923154953-8b52b426f765/dgraph/cmd/bulk/systest/run.sh (about) 1 #!/bin/bash 2 3 set -euo pipefail 4 5 script_dir=$(dirname $(readlink -f "$0")) 6 7 echo "Installing binaries..." 8 go install github.com/dgraph-io/dgraph/cmd/dgraph-bulk-loader 9 go install github.com/dgraph-io/dgraph/cmd/dgraph 10 go install github.com/dgraph-io/dgraph/cmd/dgraphzero 11 echo "Done." 12 13 fail=false 14 for suite in $script_dir/suite*; do 15 echo Running test suite: $(basename $suite) 16 17 rm -rf tmp 18 mkdir tmp 19 pushd tmp >/dev/null 20 mkdir dg 21 pushd dg >/dev/null 22 $GOPATH/bin/dgraph-bulk-loader -r $suite/rdfs.rdf -s $suite/schema.txt >/dev/null 2>&1 23 mv out/0 p 24 popd >/dev/null 25 26 mkdir dgz 27 pushd dgz >/dev/null 28 $GOPATH/bin/dgraphzero -id 1 >/dev/null 2>&1 & 29 dgzPid=$! 30 popd >/dev/null 31 sleep 2 32 33 pushd dg >/dev/null 34 $GOPATH/bin/dgraph -peer localhost:8888 -lru_mb=1024 >/dev/null 2>&1 & 35 dgPid=$! 36 popd >/dev/null 37 sleep 2 38 39 popd >/dev/null # out of tmp 40 result=$(curl --silent -H "Content-Type: application/graphql+-" localhost:8080/query -XPOST -d @$suite/query.json) 41 if ! $(jq --argfile a <(echo $result) --argfile b $suite/result.json -n 'def post_recurse(f): def r: (f | select(. != null) | r), .; r; def post_recurse: post_recurse(.[]?); ($a | (post_recurse | arrays) |= sort) as $a | ($b | (post_recurse | arrays) |= sort) as $b | $a == $b') 42 then 43 echo "Actual result doesn't match expected result:" 44 echo "Actual: $result" 45 echo "Expected: $(cat $suite/result.json)" 46 fail=true 47 fi 48 49 kill $dgPid 50 kill $dgzPid 51 sleep 2 52 done 53 54 if $fail; then 55 exit 1 56 fi