Back to home page

Enduro/X

 
 

    


0001 #!/bin/bash
0002 ##
0003 ## @brief @(#) Test011, 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 is is not 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="011"
0043 export TESTNAME_SHORT="tout"
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 # Override timeout!
0067 export NDRX_TOUT=5
0068 
0069 #
0070 # Generic exit function
0071 #
0072 function go_out {
0073     echo "Test exiting with: $1"
0074     xadmin stop -y
0075     xadmin down -y
0076 
0077     # If some alive stuff left...
0078     xadmin killall -9 atmiclt_$TESTNO
0079 
0080     popd 2>/dev/null
0081     exit $1
0082 }
0083 
0084 rm *.log
0085 
0086 xadmin down -y
0087 xadmin start -y || go_out 1
0088 
0089 # Have some wait for ndrxd goes in service
0090 sleep 1
0091 
0092 atmiclt_$TESTNO &
0093 atmiclt_$TESTNO &
0094 sleep 7
0095 
0096 # Now test log files, we should contain
0097 # [TESTSVFN TIMEOUT @1@]
0098 if [ "X`grep 'TESTSVFN TIMEOUT @1@' *.log`" == "X" ]; then
0099         echo "Test error detected - no entry of [TESTSVFN TIMEOUT @1@]!"
0100         go_out 2
0101 fi
0102 
0103 # [TESTSVFN TIMEOUT @2@] - should not contain, as message should be discarded!
0104 if [ "X`grep 'TESTSVFN TIMEOUT @2@' *.log`" != "X" ]; then
0105         echo "Test error detected - logs contain [TESTSVFN TIMEOUT @2@]!"
0106         go_out 3
0107 fi
0108 
0109 # Now run stuff with NOTIME flag..! 
0110 atmiclt_$TESTNO N&
0111 atmiclt_$TESTNO N&
0112 sleep 13
0113 
0114 # Now test log files, we should contain
0115 # [TESTSVFN TIMEOUT @1@]
0116 if [ "X`grep 'TESTSVFN NOTOUT @1@' *.log`" == "X" ]; then
0117         echo "Test error detected - no entry of [TESTSVFN NOTOUT @1@]!"
0118         go_out 4
0119 fi
0120 
0121 # [TESTSVFN TIMEOUT @2@] - should not contain, as message should be discarded!
0122 if [ "X`grep 'TESTSVFN NOTOUT @2@' *.log`" == "X" ]; then
0123         echo "Test error detected - no entry of [TESTSVFN NOTOUT @2@]!"
0124         go_out 5
0125 fi
0126 
0127 
0128 # Catch is there is test error!!!
0129 if [ "X`grep TESTERROR *.log`" != "X" ]; then
0130         echo "Test error detected!"
0131         go_out 127
0132 fi
0133 
0134 go_out 0
0135 
0136 # vim: set ts=4 sw=4 et smartindent: