Back to home page

Enduro/X

 
 

    


0001 #!/bin/bash
0002 ##
0003 ## @brief @(#) See README. Limited cache, records with more hits live longer, zapped by expiry
0004 ##
0005 ## @file 12_run_hitsexpiry.sh
0006 ##
0007 ## -----------------------------------------------------------------------------
0008 ## Enduro/X Middleware Platform for Distributed Transaction Processing
0009 ## Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0010 ## Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0011 ## This software is released under one of the following licenses:
0012 ## AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0013 ## See LICENSE file for full text.
0014 ## -----------------------------------------------------------------------------
0015 ## AGPL license:
0016 ##
0017 ## This program is free software; you can redistribute it and/or modify it under
0018 ## the terms of the GNU Affero General Public License, version 3 as published
0019 ## by the Free Software Foundation;
0020 ##
0021 ## This program is distributed in the hope that it will be useful, but WITHOUT ANY
0022 ## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0023 ## PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0024 ## for more details.
0025 ##
0026 ## You should have received a copy of the GNU Affero General Public License along 
0027 ## with this program; if not, write to the Free Software Foundation, Inc.,
0028 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0029 ##
0030 ## -----------------------------------------------------------------------------
0031 ## A commercial use license is available from Mavimax, Ltd
0032 ## contact@mavimax.com
0033 ## -----------------------------------------------------------------------------
0034 ##
0035 
0036 export TESTNAME="test048_cache"
0037 
0038 PWD=`pwd`
0039 if [ `echo $PWD | grep $TESTNAME ` ]; then
0040     # Do nothing 
0041     echo > /dev/null
0042 else
0043     # started from parent folder
0044     pushd .
0045     echo "Doing cd"
0046     cd $TESTNAME
0047 fi;
0048 
0049 export NDRX_CCONFIG=`pwd`
0050 . ../testenv.sh
0051 
0052 export TESTDIR="$NDRX_APPHOME/atmitest/$TESTNAME"
0053 export PATH=$PATH:$TESTDIR
0054 export NDRX_TOUT=10
0055 export NDRX_ULOG=$TESTDIR
0056 
0057 source ./test-func-include.sh
0058 
0059 export TESTDIR_DB=$TESTDIR
0060 export TESTDIR_SHM=$TESTDIR
0061 #
0062 # Domain 1 - here client will live
0063 #
0064 set_dom1() {
0065     echo "Setting domain 1"
0066     . ../dom1.sh
0067     export NDRX_CONFIG=$TESTDIR/ndrxconfig-dom1.xml
0068     export NDRX_DMNLOG=$TESTDIR/ndrxd-dom1.log
0069     export NDRX_LOG=$TESTDIR/ndrx-dom1.log
0070     export NDRX_CCTAG=dom1
0071 }
0072 
0073 #
0074 # Generic exit function
0075 #
0076 function go_out {
0077     echo "Test exiting with: $1"
0078     
0079     set_dom1;
0080     xadmin stop -y
0081     xadmin down -y
0082 
0083 
0084 
0085     # If some alive stuff left...
0086     xadmin killall atmiclt48
0087 
0088     popd 2>/dev/null
0089     exit $1
0090 }
0091 
0092 rm *.log
0093 # Any bridges that are live must be killed!
0094 xadmin killall tpbridge
0095 
0096 set_dom1;
0097 xadmin down -y
0098 xadmin start -y || go_out 1
0099 
0100 #
0101 # Let clients to boot
0102 #
0103 sleep 5
0104 
0105 RET=0
0106 
0107 set_dom1;
0108 xadmin psc
0109 xadmin ppm
0110 xadmin pc
0111 
0112 
0113 #
0114 # Stop th daemon so that it does not interfere with in-progress calls
0115 #
0116 set_dom1;
0117 xadmin sc -t CACHED
0118 
0119 echo "Running off client"
0120 
0121 (time ./testtool48 -sTESTSV12 -b '{"T_STRING_FLD":"KEY1"}' \
0122     -m '{"T_STRING_FLD":"KEY1"}' \
0123     -cY -n100 -fY 2>&1) > ./12_testtool48.log
0124 
0125 if [ $? -ne 0 ]; then
0126     echo "testtool48 failed (1)"
0127     go_out 1
0128 fi
0129 
0130 (time ./testtool48 -sTESTSV12 -b '{"T_STRING_FLD":"KEY2"}' \
0131     -m '{"T_STRING_FLD":"KEY2"}' \
0132     -cY -n91 -fY 2>&1) >> ./12_testtool48.log
0133 
0134 if [ $? -ne 0 ]; then
0135     echo "testtool48 failed (2)"
0136     go_out 1
0137 fi
0138 
0139 
0140 (time ./testtool48 -sTESTSV12 -b '{"T_STRING_FLD":"KEY3"}' \
0141     -m '{"T_STRING_FLD":"KEY3"}' \
0142     -cY -n92 -fY 2>&1) >> ./12_testtool48.log
0143 
0144 if [ $? -ne 0 ]; then
0145     echo "testtool48 failed (3)"
0146     go_out 1
0147 fi
0148 
0149 
0150 (time ./testtool48 -sTESTSV12 -b '{"T_STRING_FLD":"KEY4"}' \
0151     -m '{"T_STRING_FLD":"KEY4"}' \
0152     -cY -n93 -fY 2>&1) >> ./12_testtool48.log
0153 
0154 if [ $? -ne 0 ]; then
0155     echo "testtool48 failed (4)"
0156     go_out 1
0157 fi
0158 
0159 (time ./testtool48 -sTESTSV12 -b '{"T_STRING_FLD":"KEY5"}' \
0160     -m '{"T_STRING_FLD":"KEY5"}' \
0161     -cY -n94 -fY 2>&1) >> ./12_testtool48.log
0162 
0163 if [ $? -ne 0 ]; then
0164     echo "testtool48 failed (5)"
0165     go_out 1
0166 fi
0167 
0168 
0169 (time ./testtool48 -sTESTSV12 -b '{"T_STRING_FLD":"KEY6"}' \
0170     -m '{"T_STRING_FLD":"KEY6"}' \
0171     -cY -n95 -fY 2>&1) >> ./12_testtool48.log
0172 
0173 if [ $? -ne 0 ]; then
0174     echo "testtool48 failed (6)"
0175     go_out 1
0176 fi
0177 
0178 
0179 (time ./testtool48 -sTESTSV12 -b '{"T_STRING_FLD":"KEY7"}' \
0180     -m '{"T_STRING_FLD":"KEY7"}' \
0181     -cY -n96 -fY 2>&1) >> ./12_testtool48.log
0182 
0183 if [ $? -ne 0 ]; then
0184     echo "testtool48 failed (7)"
0185     go_out 1
0186 fi
0187 
0188 (time ./testtool48 -sTESTSV12 -b '{"T_STRING_FLD":"KEY8"}' \
0189     -m '{"T_STRING_FLD":"KEY8"}' \
0190     -cY -n97 -fY 2>&1) >> ./12_testtool48.log
0191 
0192 if [ $? -ne 0 ]; then
0193     echo "testtool48 failed (8)"
0194     go_out 1
0195 fi
0196 
0197 
0198 (time ./testtool48 -sTESTSV12 -b '{"T_STRING_FLD":"KEY9"}' \
0199     -m '{"T_STRING_FLD":"KEY9"}' \
0200     -cY -n98 -fY 2>&1) >> ./12_testtool48.log
0201 
0202 if [ $? -ne 0 ]; then
0203     echo "testtool48 failed (9)"
0204     go_out 1
0205 fi
0206 
0207 
0208 (time ./testtool48 -sTESTSV12 -b '{"T_STRING_FLD":"KEY10"}' \
0209     -m '{"T_STRING_FLD":"KEY10"}' \
0210     -cY -n99 -fY 2>&1) >> ./12_testtool48.log
0211 
0212 if [ $? -ne 0 ]; then
0213     echo "testtool48 failed (10)"
0214     go_out 1
0215 fi
0216 
0217 
0218 (time ./testtool48 -sTESTSV12 -b '{"T_STRING_FLD":"KEY11"}' \
0219     -m '{"T_STRING_FLD":"KEY11"}' \
0220     -cY -n100 -fY 2>&1) >> ./12_testtool48.log
0221 
0222 if [ $? -ne 0 ]; then
0223     echo "testtool48 failed (11)"
0224     go_out 1
0225 fi
0226 
0227 xadmin bc -t CACHED
0228 
0229 echo "let client to boot..."
0230 sleep 5
0231 
0232 echo "wait for tpcached to complete scanning... (every 20 sec)"
0233 
0234 sleep 20
0235 
0236 echo "There must be 5 keys"
0237 ensure_keys db12 5
0238 
0239 xadmin cs db12
0240 
0241 ensure_field db12 SV12KEY11 T_STRING_FLD KEY11 1
0242 ensure_field db12 SV12KEY10 T_STRING_FLD KEY10 1
0243 ensure_field db12 SV12KEY9 T_STRING_FLD KEY9 1
0244 ensure_field db12 SV12KEY8 T_STRING_FLD KEY8 1
0245 ensure_field db12 SV12KEY7 T_STRING_FLD KEY7 0
0246 ensure_field db12 SV12KEY6 T_STRING_FLD KEY6 0
0247 ensure_field db12 SV12KEY5 T_STRING_FLD KEY5 0
0248 ensure_field db12 SV12KEY4 T_STRING_FLD KEY4 0
0249 ensure_field db12 SV12KEY3 T_STRING_FLD KEY3 0
0250 ensure_field db12 SV12KEY2 T_STRING_FLD KEY2 0
0251 ensure_field db12 SV12KEY1 T_STRING_FLD KEY1 1
0252 
0253 
0254 echo "Waiting for expiry to zap records... (100s)"
0255 sleep 100
0256 
0257 
0258 ensure_keys db12 0
0259 
0260 go_out $RET
0261 
0262 # vim: set ts=4 sw=4 et smartindent: