Back to home page

Enduro/X

 
 

    


0001 #!/bin/bash
0002 ##
0003 ## @brief Execute networked UBB test
0004 ##
0005 ## @file ubb_network-run.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 #
0037 # Generic exit function
0038 #
0039 function go_out {
0040     echo "Test exiting with: $1"
0041 
0042     . usr3_3/conf/setsite3
0043     xadmin stop -y
0044     xadmin down -y
0045 
0046     . usr4_3/conf/setsite4
0047     xadmin stop -y
0048     xadmin down -y
0049 
0050     . usr1_3/conf/setsite1
0051     xadmin stop -y
0052     xadmin down -y
0053 
0054     . usr2_3/conf/setsite2
0055     xadmin stop -y
0056     xadmin down -y
0057 
0058     . usr5_3/conf/setsite5
0059     xadmin stop -y
0060     xadmin down -y
0061 
0062     popd 2>/dev/null
0063     exit $1
0064 }
0065 
0066 #
0067 # Enduro/X not yet booted
0068 #
0069 function go_out_silent {
0070     echo "Test exiting with: $1"
0071 
0072     popd 2>/dev/null
0073     exit $1
0074 }
0075 
0076 #
0077 # Benchmark all node services 
0078 #
0079 function validate_links {
0080 
0081     exbenchcl -n5 -P -t5 -b '{}' -f EX_DATA -S1024 -s$1
0082     RET=$?
0083     if [ "X$RET" != "X0" ]; then
0084         echo "Failed to test service $1"
0085         go_out $RET
0086     fi
0087 }
0088 
0089 ################################################################################
0090 echo ">>> Testing ubb_network -> E/X convert"
0091 ################################################################################
0092 
0093 #
0094 # Cleanup by rndkey, maybe random...
0095 #
0096 
0097 (xadmin ps -r "-k [a-zA-Z0-9]{8,8} -i" -p | xargs kill -9) 2>/dev/null
0098 (xadmin ps -r "-k [a-zA-Z0-9]{8,8} -i" -p | xargs kill -9) 2>/dev/null
0099 (xadmin ps -r "-k [a-zA-Z0-9]{8,8} -i" -p | xargs kill -9) 2>/dev/null
0100 
0101 export NDRX_SILENT=Y
0102 rm -rf ./runtime 2>/dev/null
0103 ubb2ex -P ./runtime ubb_network
0104 
0105 RET=$?
0106 
0107 if [ "X$RET" != "X0" ]; then
0108     go_out_silent $RET
0109 fi
0110 
0111 cd runtime
0112 pushd .
0113 
0114 echo ">>> Booting instances..."
0115 . usr3_3/conf/setsite3
0116 # cleanup shms...
0117 xadmin down -y
0118 xadmin start -y
0119 
0120 RET=$?
0121 if [ "X$RET" != "X0" ]; then
0122     echo "Failed to boot site3"
0123     go_out $RET
0124 fi
0125 
0126 . usr4_3/conf/setsite4
0127 # cleanup shms...
0128 xadmin down -y
0129 xadmin start -y
0130 RET=$?
0131 if [ "X$RET" != "X0" ]; then
0132     echo "Failed to boot site4"
0133     go_out $RET
0134 fi
0135 
0136 . usr1_3/conf/setsite1
0137 # cleanup shms...
0138 xadmin down -y
0139 xadmin start -y
0140 RET=$?
0141 if [ "X$RET" != "X0" ]; then
0142     echo "Failed to boot site1"
0143     go_out $RET
0144 fi
0145 
0146 . usr2_3/conf/setsite2
0147 # cleanup shms...
0148 xadmin down -y
0149 xadmin start -y
0150 RET=$?
0151 if [ "X$RET" != "X0" ]; then
0152     echo "Failed to boot site2"
0153     go_out $RET
0154 fi
0155 
0156 . usr5_3/conf/setsite5
0157 # cleanup shms...
0158 xadmin down -y
0159 xadmin start -y
0160 RET=$?
0161 if [ "X$RET" != "X0" ]; then
0162     echo "Failed to boot site5"
0163     go_out $RET
0164 fi
0165 
0166 echo ">>> Wait for connection"
0167 sleep 60
0168 
0169 echo ">>> Testing links from site1..."
0170 . usr1_3/conf/setsite1
0171 xadmin psc
0172 validate_links "SERVER1"
0173 validate_links "SERVER2"
0174 validate_links "SERVER3"
0175 validate_links "SERVER4"
0176 validate_links "SERVER5"
0177 
0178 echo ">>> Testing links from site2..."
0179 . usr2_3/conf/setsite2
0180 xadmin psc
0181 validate_links "SERVER1"
0182 validate_links "SERVER2"
0183 validate_links "SERVER3"
0184 validate_links "SERVER4"
0185 validate_links "SERVER5"
0186 
0187 echo ">>> Testing links from site3..."
0188 . usr3_3/conf/setsite3
0189 xadmin psc
0190 validate_links "SERVER1"
0191 validate_links "SERVER2"
0192 validate_links "SERVER3"
0193 validate_links "SERVER4"
0194 validate_links "SERVER5"
0195 
0196 echo ">>> Testing links from site4..."
0197 . usr4_3/conf/setsite4
0198 xadmin psc
0199 validate_links "SERVER1"
0200 validate_links "SERVER2"
0201 validate_links "SERVER3"
0202 validate_links "SERVER4"
0203 validate_links "SERVER5"
0204 
0205 echo ">>> Testing links from site5..."
0206 . usr4_3/conf/setsite4
0207 xadmin psc
0208 validate_links "SERVER1"
0209 validate_links "SERVER2"
0210 validate_links "SERVER3"
0211 validate_links "SERVER4"
0212 validate_links "SERVER5"
0213 
0214 echo ">>> Testing directories & files..."
0215 
0216 if [ ! -f "usr1_4/log/ndrxd.log" ]; then
0217     echo "usr1_4/log/ndrxd.log does not exist."
0218     go_out -1
0219 fi
0220 
0221 if [ ! -f "usr2_4/log/ndrxd.log" ]; then
0222     echo "usr2_4/log/ndrxd.log does not exist."
0223     go_out -1
0224 fi
0225 
0226 if [ ! -f "usr3_4/log/ndrxd.log" ]; then
0227     echo "usr3_4/log/ndrxd.log does not exist."
0228     go_out -1
0229 fi
0230 
0231 if [ ! -f "usr4_4/log/ndrxd.log" ]; then
0232     echo "usr4_4/log/ndrxd.log does not exist."
0233     go_out -1
0234 fi
0235 
0236 if [ ! -d "usr4_1/app/tmlogs/rm4" ]; then
0237     echo "usr4_1/app/tmlogs/rm4 does not exist."
0238     go_out -1
0239 fi
0240 
0241 ################################################################################
0242 echo ">>> Compare outputs of the XML"
0243 ################################################################################
0244 
0245 OUT=`diff $TESTDIR/ubb_network.xml $TESTDIR/runtime/usr4_3/conf/ndrxconfig.site4.xml`
0246 
0247 echo $OUT
0248 
0249 RET=$?
0250 if [ "X$RET" != "X0" ]; then
0251     go_out $RET
0252 fi
0253 
0254 if [ "X$OUT" != "X" ]; then
0255     echo "ubb_network.xml!=runtime/usr4_3/conf/ndrxconfig.site4.xml"
0256     go_out -1
0257 fi
0258 
0259 
0260 go_out $RET
0261 
0262 # vim: set ts=4 sw=4 et smartindent:
0263