Updated tests
[idzebra-moved-to-github.git] / test / gils / test1.sh
1 #!/bin/sh
2 # $Id: test1.sh,v 1.4 2003-05-06 17:39:01 adam Exp $
3 echo "testing without stored keys (zebra1.cfg)"
4
5 echo "See if servers are running...."
6 ps ax|grep zebrasrv
7 sleep 1
8
9 echo  "initializing..."
10 mkdir -p reg
11 rm -f records/esdd000[12].grs # these should not be here, will be created later
12 rm -f idx.log srv.log
13 ../../index/zebraidx -l idx.log -c zebra1.cfg init || exit 1
14
15 echo "updating..."
16 ../../index/zebraidx -l idx.log -c zebra1.cfg update records  || exit 1
17
18 echo "killing old server (if any)..."
19 test -f zebrasrv.pid && kill `cat zebrasrv.pid`
20 rm -f zebrasrv.pid
21 rm -f srv.log
22
23 echo "starting server..."
24 ../../index/zebrasrv -S -c zebra1.cfg -l srv.log tcp:@:9901 &
25 sleep 1
26
27 echo "checking it runs..."
28 test -f zebrasrv.pid || exit 1
29
30 echo "search 1..."
31 ../testclient localhost:9901 utah > log || exit 1
32 grep "^Result count: 17$" log || exit 1
33
34 echo "search 2..."
35 ../testclient localhost:9901 "@or utah the" > log || exit 1
36 grep "^Result count: 40$" log || exit 1
37
38 echo "search 3..."
39 ../testclient localhost:9901 "@attr 1=4 the" > log || exit 1
40 grep "^Result count: 1$" log || exit 1
41
42 echo "search 4..."
43 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
44 grep "^Result count: 9$" log || exit 1
45
46 echo "reindexing..."
47 ../../index/zebraidx -l idx.log -c  zebra1.cfg update records || exit 1
48
49 echo "search 5..."
50 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
51 grep "^Result count: 18$" log || exit 1
52
53 echo "stopping server..."
54 test -f zebrasrv.pid || exit 1
55 kill `cat zebrasrv.pid` || exit 1
56 rm -f zebrasrv.pid
57
58 echo "ok"