Skip to content

Commit

Permalink
Update travis tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawan Rawal committed Dec 23, 2016
1 parent 8970d0c commit 5a4a048
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 63 deletions.
29 changes: 0 additions & 29 deletions contrib/freebase/leonardo_test.go

This file was deleted.

4 changes: 1 addition & 3 deletions contrib/freebase/spielberg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ func TestSpielberg(t *testing.T) {
me(_xid_: m.06pj8) {
type.object.name.en
film.director.film (first: 4) {
film.film.genre {
type.object.name.en
}
}
}
}`

expectedRes := `{"me":[{"film.director.film":[{"film.film.genre":[{"type.object.name.en":"Costume Adventure"},{"type.object.name.en":"Adventure Film"},{"type.object.name.en":"Action/Adventure"},{"type.object.name.en":"Action Film"}]},{"film.film.genre":[{"type.object.name.en":"Suspense"},{"type.object.name.en":"Drama"},{"type.object.name.en":"Adventure"},{"type.object.name.en":"Comedy"},{"type.object.name.en":"Adventure Film"},{"type.object.name.en":"Mystery film"},{"type.object.name.en":"Horror"},{"type.object.name.en":"Thriller"}]},{"film.film.genre":[{"type.object.name.en":"War film"},{"type.object.name.en":"Drama"},{"type.object.name.en":"Action Film"}]},{"film.film.genre":[{"type.object.name.en":"Drama"},{"type.object.name.en":"Adventure Film"},{"type.object.name.en":"Science Fiction"}]}],"type.object.name.en":"Steven Spielberg"}]}`
res := decodeResponse(q)
expectedRes := `{"me":[{"film.director.film":[{"type.object.name.en":"Indiana Jones and the Temple of Doom"},{"type.object.name.en":"Jaws"},{"type.object.name.en":"Saving Private Ryan"},{"type.object.name.en":"Close Encounters of the Third Kind"}],"type.object.name.en":"Steven Spielberg"}]}`
if res != expectedRes {
log.Fatal("Query response is not as expected")
}
Expand Down
21 changes: 7 additions & 14 deletions contrib/loader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,10 @@ set -e

pushd $BUILD &> /dev/null

gitlfsfile="git-lfs-1.3.1"
if [ ! -d $gitlfsfile ]; then
# Get git-lfs and benchmark data.
wget https://github.com/github/git-lfs/releases/download/v1.3.1/git-lfs-linux-amd64-1.3.1.tar.gz
tar -xzf git-lfs-linux-amd64-1.3.1.tar.gz
pushd git-lfs-1.3.1 &> /dev/null
sudo /bin/bash ./install.sh
popd &> /dev/null
if [ ! -f "goldendata.rdf.gz" ]; then
wget https://github.com/dgraph-io/benchmarks/raw/master/data/goldendata.rdf.gz
fi

if [ ! -f "benchmarks/data/rdf-films.gz" ]; then
git clone https://github.com/dgraph-io/benchmarks.git
fi
benchmark=$(pwd)/benchmarks/data
benchmark=$(pwd)
popd &> /dev/null

# build flags needed for rocksdb
Expand All @@ -38,7 +28,7 @@ export LD_LIBRARY_PATH="${ICUDIR}/lib:${ROCKSDBDIR}:${LD_LIBRARY_PATH}"

pushd cmd/dgraph &> /dev/null
go build .
./dgraph -gentlemerge 0.5 &
./dgraph -gentlecommit 1.0 &
popd &> /dev/null

sleep 5
Expand All @@ -48,4 +38,7 @@ go build .
./dgraphloader -r $benchmark/goldendata.rdf.gz
popd &> /dev/null

# Lets wait for stuff to be committed to RocksDB.
sleep 20

killall dgraph
20 changes: 3 additions & 17 deletions contrib/queries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export LD_LIBRARY_PATH="${ICUDIR}/lib:${ROCKSDBDIR}:${LD_LIBRARY_PATH}"
pushd cmd/dgraph &> /dev/null
go build .
# Start dgraph in the background.
./dgraph --p ~/dgraph/p --w ~/dgraph/w2 --mem dmem-"$TRAVIS_COMMIT".prof --cpu dcpu-"$TRAVIS_COMMIT".prof &
./dgraph --w ~/dgraph/w2 --mem dmem-"$TRAVIS_COMMIT".prof --cpu dcpu-"$TRAVIS_COMMIT".prof &

# Wait for server to start in the background.
until nc -z 127.0.0.1 8080;
Expand All @@ -31,20 +31,6 @@ done

go test -v ../../contrib/freebase

pushd $BUILD/benchmarks/throughputtest &> /dev/null
go build . && ./throughputtest --numsec 30 --ip "http://127.0.0.1:8080/query" --numuser 100
# shutdown Dgraph server.
curl 127.0.0.1:8080/admin/shutdown
echo "done running throughput test"
popd &> /dev/null

# Write top x from memory and cpu profile to a file.
go tool pprof -text dgraph dmem-"$TRAVIS_COMMIT".prof | head -25 > topmem.txt
go tool pprof -svg dgraph dmem-"$TRAVIS_COMMIT".prof > topmem.svg

go tool pprof -text --alloc_space dgraph dmem-"$TRAVIS_COMMIT".prof | head -25 > topmem-alloc.txt
go tool pprof -svg --alloc_space dgraph dmem-"$TRAVIS_COMMIT".prof > topmem-alloc.svg

go tool pprof -text dgraph dcpu-"$TRAVIS_COMMIT".prof | head -25 > topcpu.txt
go tool pprof -svg dgraph dcpu-"$TRAVIS_COMMIT".prof > topcpu.svg
killall dgraph

popd &> /dev/null

0 comments on commit 5a4a048

Please sign in to comment.