mirror of
https://github.com/stefanocasazza/ULib.git
synced 2025-09-28 19:05:55 +08:00
72 lines
2.4 KiB
Bash
Executable File
72 lines
2.4 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
. ../.function
|
|
|
|
## businesses.test -- Test prototype for Victor Stewart
|
|
|
|
#cat <<EOF >tmp/create.js
|
|
#use database
|
|
#db.businesses.drop()
|
|
#db.businesses.save( {_id: 1, name: "Business 1", rating: 'Red', address : "123 park lane, New York, NY, USA 10028", phone : "12126465788", url : "www.business1.com" } );
|
|
#db.businesses.save( {_id: 2, name: "Business 2", rating: "Yellow", address : "837 mott street, New York, NY, USA 10019", phone : "12124829384", url : "www.business2.com" } );
|
|
#db.businesses.save( {_id: 3, name: "Business 3", rating: 'Green', address : "838 mott street, New York, NY, USA 10019", phone : "12124829385", url : "www.business3.com" } );
|
|
#db.businesses.ensureIndex({_id: 1})
|
|
#EOF
|
|
#mongo < tmp/create.js
|
|
#rm -f tmp/create.js
|
|
|
|
start_msg businesses
|
|
|
|
UTRACE="0 15M 0"
|
|
#UOBJDUMP="0 10M 10"
|
|
#USIMERR="error.sim"
|
|
export UTRACE UOBJDUMP USIMERR
|
|
|
|
DOC_ROOT=benchmark/docroot
|
|
|
|
rm -rf $DOC_ROOT/*log /tmp/request.* /tmp/response.* \
|
|
out/userver_tcp.out err/userver_tcp.err \
|
|
trace.*userver_*.[0-9]* object.*userver_*.[0-9]* stack.*userver_*.[0-9]* mempool.*userver_*.[0-9]* \
|
|
$DOC_ROOT/trace.*userver_*.[0-9]* $DOC_ROOT/object.*userver_*.[0-9]* $DOC_ROOT/stack.*userver_*.[0-9]* $DOC_ROOT/mempool.*userver_*.[0-9]*
|
|
|
|
cat <<EOF >inp/webserver.cfg
|
|
userver {
|
|
PORT 8080
|
|
LOG_FILE businesses.log
|
|
LOG_FILE_SZ 1M
|
|
DOCUMENT_ROOT $DOC_ROOT
|
|
PREFORK_CHILD 0
|
|
}
|
|
http {
|
|
CACHE_FILE_MASK _off_
|
|
}
|
|
EOF
|
|
|
|
check_for_netcat
|
|
|
|
export MONGODB_HOST=localhost
|
|
|
|
DIR_CMD="../../examples/userver"
|
|
|
|
start_prg_background userver_tcp -c inp/webserver.cfg
|
|
|
|
wait_server_ready localhost 8080
|
|
|
|
send_req $NCAT localhost 8080 inp/http/businesses1.req businesses 2 kill
|
|
send_req $NCAT localhost 8080 inp/http/businesses2.req businesses 2 kill
|
|
send_req $NCAT localhost 8080 inp/http/businesses3.req businesses 2 kill
|
|
send_req $NCAT localhost 8080 inp/http/businesses4.req businesses 2 kill
|
|
|
|
#JSON_REQ=`tail -1 inp/http/businesses1.req`
|
|
#/opt/go/bin/h2a -p 80 -H localhost -P 8080 -d -D
|
|
#ncat -4 localhost 80 < load_balance_response.31878
|
|
#curl -v --http2-prior-knowledge http://localhost/servlet/businesses -d "$JSON_REQ" http://localhost/businesses >out/businesses.out
|
|
#curl -v --http2-prior-knowledge http://localhost:8080/servlet/businesses -d "$JSON_REQ" http://localhost/businesses >out/businesses.out
|
|
|
|
kill_server userver_tcp
|
|
|
|
mv err/userver_tcp.err err/businesses.err
|
|
|
|
# Test against expected output
|
|
test_output_wc l businesses
|