2 # $Id: test2.sh,v 1.6 2003-05-21 14:39:22 adam Exp $
3 echo "Testing with storekeys (zebra2.cfg)"
6 rm -f records/esdd000[12].grs # these should not be here, will be created later
7 ../../index/zebraidx -l idx.log -c zebra2.cfg init || exit 1
10 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
13 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
15 echo "killing old server (if any)..."
16 test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
20 echo "starting server..."
21 ../../index/zebrasrv -S -c zebra2.cfg -l srv.log tcp:@:9901 &
23 test -f zebrasrv.pid || exit 1
26 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
27 grep "^Result count: 9$" log || exit 1
30 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
33 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
34 grep "^Result count: 9$" log || exit 1
36 echo "making test records..."
37 cp records/esdd0006.grs records/esdd0001.grs
39 echo "indexing them..."
40 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
43 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
44 grep "^Result count: 10$" log || exit 1
45 touch records/esdd0001.grs
47 echo "indexing again..."
48 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
51 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
52 grep "^Result count: 10$" log || exit 1
54 echo "making another test record..."
55 mv records/esdd0001.grs records/esdd0002.grs
57 echo "indexing it too..."
58 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
61 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
62 grep "^Result count: 10$" log || exit 1
65 echo "modifying a test record..."
66 sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
67 mv records/esdd0002x.grs records/esdd0002.grs
70 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
74 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
75 grep "^Result count: 9$" log || exit 1
78 ../api/testclient localhost:9901 "@attr 1=4 xyz" > log || exit 1
79 grep "^Result count: 1$" log || exit 1
81 echo "stopping server..."
82 test -f zebrasrv.pid || exit 1
83 kill `cat zebrasrv.pid` || exit 1
85 rm -f records/esdd000[12].grs