Start jenkins job:
java -jar jenkins.war &
---------------------------------
jenkin main job:
sbjperf1.websense.com:1667
xwang
${JOB_NAME}_workspace
//code/dev/Barcelona/MDMi/automation_test/... //${JOB_NAME}_workspace/...
0 11 * * *
export CLUSTER=cluster-cn-mobile-17.odd.blackspider.com
eval $(keychain --eval)
ssh-add -l
tar jcvf /var/www/html/all.tar.bz2 *
whoami
sh ../scripts/run_autotest
reports/TEST-test_*.xml
/root/.jenkins/jobs/MDMi-Automation-Test/workspace/reports
-----------------------------------------------------------------------------------------------------------------
run_autotest
#!/bin/sh
#export HOST=cluster-cn-mobile-17.odd.blackspider.com
export HOST=10.231.48.141
#export HOST=10.231.48.101
scp /var/www/html/all.tar.bz2 [email protected]${HOST}:~
scp ../scripts/run_test [email protected]${HOST}:~
scp ../scripts/run_setup [email protected]${HOST}:~
scp ../scripts/run_setup_www [email protected]${HOST}:~
scp ../scripts/run_setup_cfg [email protected]${HOST}:~
scp ../scripts/run_setup_cog [email protected]${HOST}:~
scp ../scripts/run_setup_hss [email protected]${HOST}:~
ssh [email protected]${HOST} "scp all.tar.bz2 [email protected]:~"
ssh [email protected]${HOST} "scp all.tar.bz2 [email protected]:~"
ssh [email protected]${HOST} "scp all.tar.bz2 [email protected]:~"
ssh [email protected]${HOST} "scp run_test [email protected]:~"
ssh [email protected]${HOST} "scp run_setup [email protected]:~"
ssh [email protected]${HOST} "scp run_setup_www [email protected]:~"
ssh [email protected]${HOST} "scp run_setup_cog [email protected]:~"
ssh [email protected]${HOST} "scp run_setup_cfg [email protected]:~"
ssh [email protected]${HOST} "scp run_setup_hss [email protected]:~"
ssh [email protected]${HOST} "ssh [email protected]" "sh run_setup_cfg"
ssh [email protected]${HOST} "ssh [email protected]" "sh run_setup_cog"
ssh [email protected]${HOST} "ssh [email protected]" "sh run_setup_www"
ssh [email protected]${HOST} "ssh [email protected]" "sh run_setup_hss"
ssh [email protected]${HOST} "ssh [email protected]" "sh run_setup"
echo "sleeping 180 seconds for mes server rebooting..."
sleep 180
ssh [email protected]${HOST} "ssh [email protected]" "sh run_test"
#Got test reports from mes server
ssh [email protected]${HOST} "scp [email protected]:~/testreports.tar.bz2 ."
scp [email protected]${HOST}:~/testreports.tar.bz2 ../workspace/reports/.
cd ../workspace/reports
tar xvf testreports.tar.bz2 > /dev/null 2>&1
-------------------------------------------------------------------------------------------------------------------------
run_setup_hss
#!/bin/sh
#cd /opt/mailcontrol
path='/opt/mailcontrol/tests/integration/'
accountfile1='addhybridadmin.pl'
#install ods-mdmi-task-redeploy package
rpm -q ods-hsync-test > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "install ods-hsync-test..."
sudo yum -y install ods-hsync-test
fi
if [ ! -d "mdmi" ]; then
mkdir mdmi
fi
#test prepare in www server
echo "yum update on hss01o server..."
sudo yum -y update > /dev/null 2>&1
cd mdmi
mv ../all.tar.bz2 .
tar xvf all.tar.bz2 > /dev/null 2>&1
if [ ! -f $accountfile1 ]; then
sudo cp ./utils/addhybridadmin.pl $path$accountfile1
fi
cd $path
sudo -i perl $path$accountfile1
-------------------------------------------------------------------------------------------------------------------------
run_setup_www
#!/bin/sh
#cd /opt/mailcontrol
accountfile1='account_creationdxb.pl'
accountfile2='/opt/ods/testing/provisioning/accountsdxb.sh'
accountfile3='/opt/ods/testing/provisioning/dxb.xml'
path='/opt/ods/testing/provisioning/'
if [ -d "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg" ]; then
echo "setuptools for python 2.4 exists"
else
wget http://10.226.200.96/python/setuptools-0.6c11-py2.4.egg
fi
if [ -f "/usr/lib/python2.4/site-packages/simplejson-2.1.0-py2.4.egg" ]; then
echo "simplejson for python 2.4 exists"
else
wget http://10.226.200.96/python/simplejson-2.1.0.tar.gz
tar xfz ./simplejson-2.1.0.tar.gz > /dev/null 2>&1
sudo cp setuptools-0.6c11-py2.4.egg ./simplejson-2.1.0/.
cd simplejson-2.1.0
sudo python setup.py install
fi
echo "disable puppetd on www01o server..."
sudo /usr/sbin/puppetd --disable
cd /home/autotest
if [ ! -d "mdmi" ]; then
sudo mkdir mdmi
fi
cd mdmi
sudo mv ../all.tar.bz2 .
sudo tar xvf all.tar.bz2 > /dev/null 2>&1
echo "disable email tqp on www01o server..."
sudo python ./utils/config_tqp_email.py
if [ ! -f $path$accountfile1 ]; then
sudo cp ./tms_2363_send_email_to_admin_cannot_connect_to_aw_dxb/account_creationdxb.pl $path$accountfile1
fi
if [ ! -f $accountfile2 ]; then
sudo cp ./tms_2363_send_email_to_admin_cannot_connect_to_aw_dxb/accountsdxb.sh $accountfile2
fi
if [ ! -f $accountfile3 ]; then
sudo cp ./tms_2363_send_email_to_admin_cannot_connect_to_aw_dxb/dxb.xml $accountfile3
fi
cd $path
#udo -i perl $accountfile1
sudo PERL5LIB=/opt/mailcontrol/modules /usr/bin/perl $accountfile1
#test prepare in www server
echo "yum update on www01o server..."
sudo yum -y update > /dev/null 2>&1
-------------------------------------------------------------------------------------------------------------------------
run_setup
#!/bin/bash
#install python-setuptools
rpm -q python-setuptools > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "install python-setuptools..."
sudo yum -y install python-setuptools
fi
#install xmlrunner
if [ -d "/usr/lib/python2.6/site-packages/unittest_xml_reporting-1.0.3-py2.6.egg" ]; then
echo "xmlrunner exists"
else
wget http://10.226.200.96/unittest-xml-reporting-1.0.3.tar.gz
tar xfz ./unittest-xml-reporting-1.0.3.tar.gz > /dev/null 2>&1
cd unittest-xml-reporting-1.0.3
sudo python setup.py install
fi
#install MySQL DB Interface
rpm -q MySQL-python > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "install MySQL-python..."
sudo yum -y install MySQL-python
fi
#install paramiko package
rpm -q python-paramiko > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "install paramiko..."
sudo yum -y install python-paramiko
fi
#install ods-mdmi-task-redeploy package
rpm -q ods-mdmi-task-redeploy > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "install ods-mdmi-task-redeploy..."
sudo yum -y install ods-mdmi-task-redeploy
fi
#Update packages in mes server
echo "yum update on mes01o server..."
sudo yum -y update > /dev/null 2>&1
#Check mes server master flag
if [ -f "/etc/sysconfig/mes.primary" ]; then
echo "mes server master flag exists."
else
sudo touch /etc/sysconfig/mes.primary
echo "mes server master flag created!"
fi
echo "reboot mes01o server..."
sudo /sbin/reboot
-------------------------------------------------------------------------------------------------------------------------
run_test
#!/bin/sh
#cd /opt/mailcontrol
installprofilesimu='/opt/emserver/portal/www/cgi-py/installvpn.py'
#----------------------
xwang_testdir='/home/autotest/mdmi/tms_enroll /home/autotest/mdmi/tms_rest /home/autotest/mdmi/tms_rest_hybrid /home/autotest/mdmi/tms_460 /home/autotest/mdmi/tms_deltabus'
#xwang_testdir='/home/autotest/mdmi/tms_rest_hybrid /home/autotest/mdmi/tms_rest'
#----------------------
#----------------------
yjia_testdir='/home/autotest/mdmi/tms_436_pull_usergroup_task /home/autotest/mdmi/tms_452_get_usergroup_api /home/autotest/mdmi/tms_782_raise_error_task /home/autotest/mdmi/tms_933_raise_pending_task /home/autotest/mdmi/tms_927_match_user_GUID /home/autotest/mdmi/tms_1314_get_user_by_GUID /home/autotest/mdmi/tms_3073_hybrid_user_ldif_API /home/autotest/mdmi/tms_1485_update_LDAP_group'
#----------------------
jliang_testdir='/home/autotest/mdmi/tms_1263_delete_group_in_periodical_sync /home/autotest/mdmi/tms_1036_move_user_to_other_group /home/autotest/mdmi/tms_456_user_and_group_schema_sync /home/autotest/mdmi/tms_758_add_user /home/autotest/mdmi/tms_1489_addRemove_membership /home/autotest/mdmi/tms_test_periodic_sameuser /home/autotest/mdmi/tms_test_case_sensitive /home/autotest/mdmi/tms_test_sync_delay_time'
#----------------------
kryu_testdir='/home/autotest/mdmi/tms_838_retry_queue /home/autotest/mdmi/tms_1860_add_user_batch /home/autotest/mdmi/tms_1237_cannot_update_ldap_user /home/autotest/mdmi/tms_748_get_user_from_AW /home/autotest/mdmi/tms_438_existence_user_enroll /home/autotest/mdmi/tms_1241_periodic_remove_user /home/autotest/mdmi/tms_1241_moniter /home/autotest/mdmi/tms_1262_periodic_update_membership /home/autotest/mdmi/tms_3158_non_existing_hybriduser_provisioning /home/autotest/mdmi/tms_1859_metanate_service'
#kryu_testdir='/home/autotest/mdmi/tms_1860_add_user_batch'
#----------------------
wing_testdir='/home/autotest/mdmi/tms_2080_auto_create_enrollmentError_tq /home/autotest/mdmi/tms_3682_nofication_judge_mobile_version /home/autotest/mdmi/tms_1826_enrollment_detect'
#wing_testdir='/home/autotest/mdmi/tms_2080_auto_create_enrollmentError_tq'
#wing_testdir='/home/autotest/mdmi/tms_3682_nofication_judge_mobile_version'
#wing_testdir='/home/autotest/mdmi/tms_1826_enrollment_detect'
#----------------------
xdong_testdir='/home/autotest/mdmi/tms_3602_local_network_bypass_dxb /home/autotest/mdmi/tms_1058_private_key_pool_switch_dxb /home/autotest/mdmi/tms_1331_store_mdmprofileid_vpnexpirydate_account_in_rs_dxb /home/autotest/mdmi/tms_1346_android_deploy_monitor_dxb /home/autotest/mdmi/tms_1794_IOS_and_Android_Deploy_dxb /home/autotest/mdmi/tms_1823_deploy_update_device_info_dxb /home/autotest/mdmi/tms_2085_deploy_support_bulk_dxb /home/autotest/mdmi/tms_451_private_key_pool_server_dxb /home/autotest/mdmi/tms_693_add_device_class_to_vpn_cert_dxb /home/autotest/mdmi/tms_696_ios_deploy_monitor_dxb /home/autotest/mdmi/tms_2363_send_email_to_admin_cannot_connect_to_aw_dxb /home/autotest/mdmi/tms_2482_distinguish_hosted_and_hybrid_account_dxb /home/autotest/mdmi/tms_446_rest_service_authorize_incoming_event_dxb /home/autotest/mdmi/tms_715_notification_rest_monitor_dxb /home/autotest/mdmi/tms_1376_update_device_info_dxb /home/autotest/mdmi/tms_704_enrollment_monitor_dxb /home/autotest/mdmi/tms_1049_private_key_pool_client_dxb'
#----------------------
#testpriority='HIGH'
#testpriority='MEDIUM'
testpriority='HIGH MEDIUM LOW'
testdirs[0]=$xwang_testdir
testdirs[1]=$yjia_testdir
testdirs[2]=$jliang_testdir
testdirs[3]=$kryu_testdir
testdirs[4]=$wing_testdir
testdirs[5]=$xdong_testdir
#Sync system date
sudo /etc/init.d/ntpd stop
sudo /usr/sbin/ntpdate fwl01o-eth2.blade.mailcontrol.com
sudo /etc/init.d/ntpd start
echo "do puppet sync on mes01o server..."
sudo /usr/sbin/puppetd --enable
sudo /usr/sbin/puppetd --environment=`/opt/mailcontrol/bin/myenv` --test > /dev/null 2>&1
echo "disable puppetd on mes01o server..."
sudo /usr/sbin/puppetd --disable
if [ ! -d "mdmi" ]; then
mkdir mdmi
fi
cd mdmi
sudo rm -r -f *
sudo mv ../all.tar.bz2 .
sudo tar xvf all.tar.bz2 > /dev/null 2>&1
if [ ! -f $installprofilesimu ]; then
sudo cp ./tms_enroll/installvpn.py $installprofilesimu
fi
cd ./utils
for x in $(seq 0 5)
do
#Enable default settings for Accounts
sudo python set_db_cfgs.py
#Enable all tqps
sudo python config_tqp.py
if [ $x -eq 0 ]; then
echo "Running tests from xwang..."
elif [ $x -eq 1 ]; then
echo "Running tests from yjia..."
elif [ $x -eq 2 ]; then
echo "Running tests from jliang..."
elif [ $x -eq 3 ]; then
echo "Running tests from kryu..."
elif [ $x -eq 4 ]; then
echo "Running tests from wing..."
elif [ $x -eq 5 ]; then
echo "Running tests from xdong..."
fi
sudo python runtest -d "${testdirs[$x]}" -p "$testpriority"
if [ $x -eq 3 ]; then
echo 'show the plugins.json file after test done...'
sudo cat '/etc/sysconfig/tqp/plugins.json'
fi
done
cd /tmp/output/test-reports
sudo tar jcvf ~/testreports.tar.bz2 * > /dev/null 2>&1