Back to home page

Enduro/X

 
 

    


0001 #!/bin/bash
0002 ##
0003 ## @brief @(#) Test009, Testing the case when server dies & queue is being removed.
0004 ##   The svcerr reply is passed back to client!#
0005 ##   THIS CURRENLTY COVERS THE CASE WHEN SHUTDOWN IS REQUESTED, SERVER EXISTS, BUT
0006 ##   MESSAGES ARE LEFT IN QUEUE, THEY WILL GOT SVCERR. BUT IN VERY CLEAN IMPLEMENTATION
0007 ##   WE MIGHT SET THE FLAG IN SHARED MEMORY THAT SERVICE IS NOT AVAILABLE, AND LEAVE ENQUEUED
0008 ##   ONES FOR PROCESSING.
0009 ##   But for current implementation SVCERR will be OK too, at last it is not a timeout!
0010 ##
0011 ## @file run.sh
0012 ##
0013 ## -----------------------------------------------------------------------------
0014 ## Enduro/X Middleware Platform for Distributed Transaction Processing
0015 ## Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0016 ## Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0017 ## This software is released under one of the following licenses:
0018 ## AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0019 ## See LICENSE file for full text.
0020 ## -----------------------------------------------------------------------------
0021 ## AGPL license:
0022 ##
0023 ## This program is free software; you can redistribute it and/or modify it under
0024 ## the terms of the GNU Affero General Public License, version 3 as published
0025 ## by the Free Software Foundation;
0026 ##
0027 ## This program is distributed in the hope that it will be useful, but WITHOUT ANY
0028 ## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0029 ## PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0030 ## for more details.
0031 ##
0032 ## You should have received a copy of the GNU Affero General Public License along 
0033 ## with this program; if not, write to the Free Software Foundation, Inc.,
0034 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0035 ##
0036 ## -----------------------------------------------------------------------------
0037 ## A commercial use license is available from Mavimax, Ltd
0038 ## contact@mavimax.com
0039 ## -----------------------------------------------------------------------------
0040 ##
0041 
0042 export TESTNO="009"
0043 export TESTNAME_SHORT="srvdie"
0044 export TESTNAME="test${TESTNO}_${TESTNAME_SHORT}"
0045 
0046 PWD=`pwd`
0047 if [ `echo $PWD | grep $TESTNAME ` ]; then
0048         # Do nothing 
0049         echo > /dev/null
0050 else
0051         # started from parent folder
0052         pushd .
0053         echo "Doing cd"
0054         cd $TESTNAME
0055 fi;
0056 
0057 . ../testenv.sh
0058 
0059 export TESTDIR="$NDRX_APPHOME/atmitest/$TESTNAME"
0060 export PATH=$PATH:$TESTDIR
0061 # Configure the runtime - override stuff here!
0062 export NDRX_CONFIG=$TESTDIR/ndrxconfig.xml
0063 export NDRX_DMNLOG=$TESTDIR/ndrxd.log
0064 export NDRX_LOG=$TESTDIR/ndrx.log
0065 export NDRX_DEBUG_CONF=$TESTDIR/debug.conf
0066 # for ndrxd systemv, for other ignored:
0067 export NDRX_SCANUNIT=3000
0068 
0069 # Override timeout, have a tice as much of scanunit
0070 # should have even more. in worst case for system-v it could be:
0071 # checkpm*NDRX_SCANUNIT, thus 15, lets use then 20
0072 # this is due to sanity will be picked up only at scanunit intervals..
0073 export NDRX_TOUT=20
0074 
0075 #
0076 # Generic exit function
0077 #
0078 function go_out {
0079     echo "Test exiting with: $1"
0080     xadmin stop -y
0081     xadmin down -y
0082 
0083     # If some alive stuff left...
0084     xadmin killall atmiclt_$TESTNO
0085 
0086     popd 2>/dev/null
0087     exit $1
0088 }
0089 
0090 rm *.log
0091 
0092 xadmin down -y
0093 xadmin start -y || go_out 1
0094 
0095 # Have some wait for ndrxd goes in service
0096 sleep 1
0097 
0098 # for systemv, run clients fast
0099 export NDRX_SCANUNIT=250
0100 atmiclt_$TESTNO &
0101 atmiclt_$TESTNO &
0102 atmiclt_$TESTNO &
0103 atmiclt_$TESTNO &
0104 
0105 sleep 40
0106 
0107 # We should have in log files OK-TPETIME & OK-TPESVCERR
0108 
0109 if [ "X`grep OK-TPESVCERR *.log`" == "X" ]; then
0110         echo "Test error detected - no entry of OK-TPESVCERR!"
0111         go_out 2
0112 fi
0113 
0114 if [ "X`grep OK-TPETIME *.log`" == "X" ]; then
0115         echo "Test error detected - no entry of OK-TPETIME!"
0116         go_out 3
0117 fi
0118 
0119 # Catch is there is test error!!!
0120 if [ "X`grep TESTERROR *.log`" != "X" ]; then
0121         echo "Test error detected!"
0122         go_out 4
0123 fi
0124 
0125 echo "Test of Bug #425 - tpacall + TPNOREPLY, second call no reply generate"
0126 
0127 xadmin stop -y
0128 xadmin start -y
0129 
0130 (./atmiclt_$TESTNO tpacall_norply 2>&1) >> ./atmiclt.log
0131 
0132 
0133 RET=$?
0134 
0135 if [[ "X$RET" != "X0" ]]; then
0136     go_out $RET
0137 fi
0138 
0139 if [ "X`grep 'Dropping' *.log`" != "X" ]; then
0140         echo "There must be no [Dropping unsolicited reply]!"
0141         go_out 5
0142 fi
0143 
0144 
0145 go_out 0
0146 
0147 # vim: set ts=4 sw=4 et smartindent: