Back to home page

Enduro/X

 
 

    


0001 #!/bin/bash
0002 ##
0003 ## @brief @(#) Test001 - clusterised version
0004 ##
0005 ## @file run-dom.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 TESTNO="001"
0037 export TESTNAME_SHORT="basiccall"
0038 export TESTNAME="test${TESTNO}_${TESTNAME_SHORT}"
0039 export NDRX_SILENT=Y
0040 
0041 PWD=`pwd`
0042 if [ `echo $PWD | grep $TESTNAME ` ]; then
0043         # Do nothing 
0044         echo > /dev/null
0045 else
0046         # started from parent folder
0047         pushd .
0048         echo "Doing cd"
0049         cd $TESTNAME
0050 fi;
0051 
0052 . ../testenv.sh
0053 
0054 export TESTDIR="$NDRX_APPHOME/atmitest/$TESTNAME"
0055 export PATH=$PATH:$TESTDIR
0056 # Override timeout!
0057 export NDRX_TOUT=3
0058 
0059 #
0060 # Domain 1 - here client will live
0061 #
0062 function 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 # Domain 2 - here server will live
0073 #
0074 function set_dom2 {
0075     echo "Setting domain 2"
0076     . ../dom2.sh    
0077     export NDRX_CONFIG=$TESTDIR/ndrxconfig-dom2.xml
0078     export NDRX_DMNLOG=$TESTDIR/ndrxd-dom2.log
0079     export NDRX_LOG=$TESTDIR/ndrx-dom2.log
0080     export NDRX_DEBUG_CONF=$TESTDIR/debug-dom2.conf
0081 }
0082 
0083 #
0084 # Generic exit function
0085 #
0086 function go_out {
0087     echo "Test exiting with: $1"
0088     
0089     set_dom1;
0090     xadmin stop -y
0091     xadmin down -y
0092 
0093     set_dom2;
0094     xadmin stop -y
0095     xadmin down -y
0096 
0097     # If some alive stuff left...
0098     xadmin killall atmiclt1
0099 
0100     popd 2>/dev/null
0101     exit $1
0102 }
0103 
0104 #
0105 # Print domain statuses...
0106 #
0107 function print_domains {
0108 
0109     set_dom1;
0110     xadmin ppm
0111     xadmin psvc
0112     xadmin psc
0113 
0114     set_dom2;
0115     xadmin ppm
0116     xadmin psvc
0117     xadmin psc
0118 
0119 }
0120 
0121 
0122 rm *dom*.log
0123 
0124 set_dom1;
0125 xadmin down -y
0126 xadmin start -y || go_out 1
0127 
0128 set_dom2;
0129 xadmin down -y
0130 xadmin start -y || go_out 2
0131 
0132 #exit 0
0133 ###############################################################################
0134 echo "Test restart command (shall not stall...)"
0135 ###############################################################################
0136 
0137 xadmin r -y
0138 RET=$?
0139 
0140 if [ "X$RET" != "X0" ]; then
0141     echo "Restart fails!"
0142     go_out -100
0143 fi
0144 
0145 ###############################################################################
0146 echo "Have some wait for ndrxd goes in service - wait for connection establishment."
0147 echo "Test Connection recovery... (bug #250)"
0148 ###############################################################################
0149 sleep 20
0150 print_domains;
0151 
0152 # Go to domain 1
0153 set_dom1;
0154 
0155 # test Bug #250 - test conn recovery
0156 
0157 echo ">>> DOM1 network shutdown..."
0158 xadmin stop -s tpbridge
0159 # links must be lost
0160 print_domains;
0161 set_dom1;
0162 xadmin start -s tpbridge
0163 
0164 
0165 sleep 20
0166 echo ">>> After DOM1 network shutdown..."
0167 print_domains;
0168 
0169 
0170 # Go to domain 2
0171 set_dom2;
0172 
0173 echo ">>> DOM2 network shutdown..."
0174 xadmin stop -s tpbridge
0175 print_domains;
0176 set_dom2;
0177 xadmin start -s tpbridge
0178 
0179 ###############################################################################
0180 echo "Now continue with standard tests.."
0181 ###############################################################################
0182 sleep 20
0183 echo "PRINT DOMAINS"
0184 print_domains;
0185 set_dom1;
0186 xadmin ppm
0187 
0188 # check that services are blacklisted (others will be tested by tpcalls)
0189 
0190 # UNIXINFO and UNIX2 must be missing
0191 
0192 echo "DOM1 PSC"
0193 xadmin psc 
0194 
0195 if [ "X`xadmin psc | grep UNIXINFO`" != "X" ]; then
0196         echo "UNIXINFO is present in domain1!";
0197 fi
0198 
0199 if [ "X`xadmin psc | grep UNIX2`" != "X" ]; then
0200         echo "UNIX2 is present in domain1!";
0201 fi
0202 
0203 # Run the client test...
0204 echo "Will issue calls to clients:"
0205 (./atmiclt1 2>&1) > ./atmiclt-dom1.log
0206 RET=$?
0207 
0208 grep "Performance" atmiclt-dom1.log
0209 
0210 # Catch is there is test error!!!
0211 if [ "X`grep TESTERROR *.log`" != "X" ]; then
0212         echo "Test error detected!"
0213         RET=-2
0214 fi
0215 
0216 go_out $RET
0217 
0218 # vim: set ts=4 sw=4 et smartindent: