Back to home page

Enduro/X

 
 

    


0001 #!/bin/bash
0002 ##
0003 ## @brief Network activity testing - test launcher
0004 ##  Check that inactive connections are reset
0005 ##  Check that zero length messages keeps the traffic going / thus no restart.
0006 ##
0007 ## @file run.sh
0008 ##
0009 ## -----------------------------------------------------------------------------
0010 ## Enduro/X Middleware Platform for Distributed Transaction Processing
0011 ## Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0012 ## Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0013 ## This software is released under one of the following licenses:
0014 ## AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0015 ## See LICENSE file for full text.
0016 ## -----------------------------------------------------------------------------
0017 ## AGPL license:
0018 ## 
0019 ## This program is free software; you can redistribute it and/or modify it under
0020 ## the terms of the GNU Affero General Public License, version 3 as published
0021 ## by the Free Software Foundation;
0022 ##
0023 ## This program is distributed in the hope that it will be useful, but WITHOUT ANY
0024 ## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0025 ## PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0026 ## for more details.
0027 ##
0028 ## You should have received a copy of the GNU Affero General Public License along 
0029 ## with this program; if not, write to the Free Software Foundation, Inc., 
0030 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0031 ##
0032 ## -----------------------------------------------------------------------------
0033 ## A commercial use license is available from Mavimax, Ltd
0034 ## contact@mavimax.com
0035 ## -----------------------------------------------------------------------------
0036 ##
0037 
0038 export TESTNAME="test073_netact"
0039 
0040 PWD=`pwd`
0041 if [ `echo $PWD | grep $TESTNAME ` ]; then
0042     # Do nothing 
0043     echo > /dev/null
0044 else
0045     # started from parent folder
0046     pushd .
0047     echo "Doing cd"
0048     cd $TESTNAME
0049 fi;
0050 
0051 . ../testenv.sh
0052 
0053 export TESTDIR="$NDRX_APPHOME/atmitest/$TESTNAME"
0054 export PATH=$PATH:$TESTDIR
0055 export NDRX_ULOG=$TESTDIR
0056 export NDRX_TOUT=10
0057 export NDRX_SILENT=Y
0058 
0059 #
0060 # Domain 1 - here client will live
0061 #
0062 set_dom1() {
0063     echo "Setting domain 1"
0064     . ../dom1.sh
0065     export NDRX_CONFIG=$TESTDIR/ndrxconfig-dom1.xml
0066     export NDRX_DMNLOG=$TESTDIR/ndrxd-dom1.log
0067     export NDRX_LOG=$TESTDIR/ndrx-dom1.log
0068     export NDRX_DEBUG_CONF=$TESTDIR/debug-dom1.conf
0069 }
0070 
0071 
0072 #
0073 # Domain 2 - here server will live
0074 #
0075 set_dom2() {
0076     echo "Setting domain 2"
0077     . ../dom2.sh    
0078     export NDRX_CONFIG=$TESTDIR/ndrxconfig-dom2.xml
0079     export NDRX_DMNLOG=$TESTDIR/ndrxd-dom2.log
0080     export NDRX_LOG=$TESTDIR/ndrx-dom2.log
0081     export NDRX_DEBUG_CONF=$TESTDIR/debug-dom2.conf
0082 }
0083 
0084 #
0085 # Generic exit function
0086 #
0087 function go_out {
0088     echo "Test exiting with: $1"
0089     
0090     set_dom1;
0091     xadmin stop -y
0092     xadmin down -y
0093 
0094 
0095     set_dom2;
0096     xadmin stop -y
0097     xadmin down -y
0098 
0099     # If some alive stuff left...
0100     xadmin killall atmiclt73
0101 
0102     popd 2>/dev/null
0103     exit $1
0104 }
0105 
0106 rm *.log
0107 rm ULOG*
0108 
0109 # Any bridges that are live must be killed!
0110 xadmin killall tpbridge
0111 
0112 set_dom2;
0113 xadmin down -y
0114 xadmin start -y || go_out 1
0115 
0116 #
0117 # OK, firstly boot non activity bridge...
0118 #
0119 set_dom1;
0120 xadmin down -y
0121 xadmin start -y || go_out 1
0122 xadmin start -i 100
0123 
0124 
0125 echo "Wait for connection reset... about 30 sec.. (connect + check)"
0126 sleep 30
0127 
0128 
0129 # now check ULOG...
0130 RESULT=`grep 'No data received in' ULOG*`
0131 
0132 echo "Result: [$RESULT]"
0133 
0134 if [ "X$RESULT" == "X" ]; then
0135     echo "Connection not restarted!"
0136     go_out -10
0137 fi
0138 
0139 xadmin stop -i 100
0140 #
0141 # Let processes to fully disconnect 
0142 # and clean-up old logs..
0143 #
0144 sleep 1
0145 rm ULOG*
0146 xadmin start -i 200
0147 
0148 echo "Let connection to establish... + non reset (zero msgs should work...)"
0149 sleep 30
0150 
0151 # now check ULOG...
0152 RESULT=`grep 'No data received in' ULOG*`
0153 
0154 echo "Result: [$RESULT]"
0155 
0156 if [ "X$RESULT" != "X" ]; then
0157     echo "Connection restarted when not expected (zero msgs should be feeding the activity)!"
0158     go_out -20
0159 fi
0160 
0161 #
0162 # Check that connection is OK
0163 #
0164 xadmin ppm
0165 
0166 RESULT=`xadmin ppm | grep 200 | grep BC`
0167 
0168 echo "Result: [$RESULT]"
0169 
0170 if [ "X$RESULT" == "X" ]; then
0171     echo "No open connection!"
0172     go_out -30
0173 fi
0174 
0175 
0176 echo "All OK"
0177 
0178 go_out 0
0179 
0180 # vim: set ts=4 sw=4 et smartindent: