execute the Unit Tests defined for this project, you must run the following
command:
- $ ./tools/run.sh testing [test_suite] [function]
+ $ ./tools/run.sh -s [test_suite] -c [function] testing
or using PowerShell
Examples
--------
- $ ./tools/run.sh testing # Executes all the Unit Tests
- $ ./tools/run.sh testing functions # Executes all the Unit Tests of Functions Test Suite
- $ ./tools/run.sh testing functions install_maven # Executes the install_maven Unit Test of Functions Test Suite
+ $ ./tools/run.sh -y testing # Executes all the Unit Tests unattended mode
+ $ ./tools/run.sh -s functions testing # Executes all the Unit Tests of Functions Test Suite
+ $ ./tools/run.sh -s functions -c install_maven testing # Executes the install_maven Unit Test of Functions Test Suite
v.flavor = 'm1.xlarge'
end
all_in_one.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc']
s.env = conf
end
v.flavor = 'm1.small'
end
dns.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.env = conf
end
end
v.server_name = 'message-router'
end
mr.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['mr']
s.env = conf
end
v.server_name = 'sdc'
end
sdc.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['sdc']
s.env = conf
end
v.server_name = 'aai'
end
aai.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['aai']
s.env = conf
end
v.server_name = 'mso'
end
mso.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['mso']
s.env = conf
end
v.server_name = 'robot'
end
robot.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['robot']
s.env = conf
end
v.server_name = 'vid'
end
vid.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['vid']
s.env = conf
end
v.server_name = 'sdnc'
end
sdnc.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['sdnc']
s.env = conf
end
v.server_name = 'portal'
end
portal.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['portal']
s.env = conf
end
v.server_name = 'dcae'
end
dcae.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['dcae']
s.env = conf
end
v.server_name = 'policy'
end
policy.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['policy']
s.env = conf
end
v.server_name = 'appc'
end
appc.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['appc']
s.env = conf
end
v.server_name = 'vfc'
end
vfc.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['vfc']
s.env = conf
end
v.flavor = 'm1.small'
end
testing.vm.provision 'shell' do |s|
- s.path = 'unit_testing.sh'
+ s.path = 'vagrant_utils/unit_testing.sh'
s.args = [test_suite, test_case]
s.env = conf
end
#!/bin/bash
-case $1 in
+usage ()
+{
+cat <<EOF
+Usage: run.sh [-y] [-h] Command
+Optional arguments:
+ -y
+ Skips warning prompt.
+ -h
+ Shows help about this program.
+ -s <suite>
+ Test suite to use in testing mode.
+ -c <case>
+ Test case to use in testing mode.
+Commands:
+ all_in_one Deploy in all-in-one mode.
+ dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc Deploy chosen service.
+ testing Deploy in testing mode.
+EOF
+}
+
+run=false
+test_suite="*"
+test_case="*"
+
+COMMAND=${@: -1}
+
+while getopts "yhs:c:" OPTION; do
+ case "$OPTION" in
+ y)
+ run=true
+ ;;
+ s)
+ if [ "$COMMAND" != "testing" ] ; then
+ echo "Test suite should only be specified in testing mode."
+ echo "./run.sh -h for usage."
+ exit 0
+ fi
+ test_suite=$OPTARG
+ ;;
+ c)
+ if [ "$COMMAND" != "testing" ] ; then
+ echo "Test case should only be specified in testing mode."
+ echo "./run.sh -h for usage."
+ exit 0
+ fi
+ test_case=$OPTARG
+ ;;
+ h)
+ usage
+ exit 0
+ ;;
+ esac
+done
+
+case $COMMAND in
"all_in_one" )
- export DEPLOY_MODE='all-in-one' ;;
+ export DEPLOY_MODE='all-in-one'
+ ;;
"dns" | "mr" | "sdc" | "aai" | "mso" | "robot" | "vid" | "sdnc" | "portal" | "dcae" | "policy" | "appc" )
- export DEPLOY_MODE='individual' ;;
+ export DEPLOY_MODE='individual'
+ ;;
"testing" )
export DEPLOY_MODE='testing'
- export TEST_SUITE=${2:-*}
- export TEST_CASE=${3:-*}
+ if [ "$run" == false ] ; then
+ while true ; do
+ echo "Warning: This test script will delete the contents of ../opt/ and ~/.m2."
+ read -p "Would you like to continue? [y]es/[n]o: " yn
+ case $yn in
+ [Yy]*)
+ break
+ ;;
+ [Nn]*)
+ echo "Exiting."
+ exit 0
+ ;;
+ esac
+ done
+ fi
+ export TEST_SUITE=$test_suite
+ export TEST_CASE=$test_case
rm -rf ../opt/
- rm -rf ~/.m2/;;
+ rm -rf ~/.m2/
+ ;;
* )
- echo $"Usage: $0 {all_in_one|dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc|testing}"
+ usage
exit 1
esac
-vagrant destroy -f $1
-vagrant up $1
+
+vagrant destroy -f $COMMAND
+vagrant up $COMMAND