mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
[CLOUDSTACK-6115] Investigate the use of TravisCI for CloudStack integration testing
This commit is contained in:
parent
615c070c0a
commit
26069aa377
23
.travis.yml
Normal file
23
.travis.yml
Normal file
@ -0,0 +1,23 @@
|
||||
language: java
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.cache
|
||||
jdk:
|
||||
- oraclejdk7
|
||||
notifications:
|
||||
email: false
|
||||
env:
|
||||
- TESTS="test_affinity_groups test_deploy_vms_with_varied_deploymentplanners test_disk_offerings test_global_settings test_guest_vlan_range test_iso test_multipleips_per_nic test_network test_non_contigiousvlan test_over_provisioning"
|
||||
- TESTS="test_portable_publicip test_primary_storage test_privategw_acl test_public_ip_range test_pvlan test_regions test_reset_vm_on_reboot test_resource_detail test_routers"
|
||||
- TESTS="test_secondary_storage test_service_offerings test_ssvm test_templates misc/test_deploy_vm test_vm_life_cycle test_volumes test_vpc_vpn"
|
||||
before_install: travis_wait 30 ./tools/travis/before_install.sh
|
||||
install: ./tools/travis/install.sh
|
||||
before_script: travis_wait 30 ./tools/travis/before_script.sh
|
||||
script:
|
||||
- mkdir -p integration-test-results/misc
|
||||
- travis_wait 30 sleep 30
|
||||
- for suite in $TESTS; do travis_wait 30 nosetests --with-xunit --xunit-file=integration-test-results/$suite.xml --with-marvin --marvin-config=setup/dev/advanced.cfg test/integration/smoke/$suite.py -s -a tags=advanced,required_hardware=false --zone=Sandbox-simulator --hypervisor=simulator ; done
|
||||
- python ./tools/travis/xunit-reader.py integration-test-results/
|
||||
after_success: ./tools/travis/after_success.sh
|
||||
after_failure: ./tools/travis/after_failure.sh
|
||||
after_script: ./tools/travis/after_script.sh
|
||||
6
tools/travis/after_failure.sh
Executable file
6
tools/travis/after_failure.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# As the filename suggests, this is executed on build failure
|
||||
# failure.
|
||||
#
|
||||
|
||||
6
tools/travis/after_script.sh
Executable file
6
tools/travis/after_script.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script should run any tear down commands required.
|
||||
#
|
||||
|
||||
mvn -Dsimulator -pl client jetty:stop 2>&1
|
||||
4
tools/travis/after_success.sh
Executable file
4
tools/travis/after_success.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# As the filename suggests this is executed on build success.
|
||||
#
|
||||
50
tools/travis/before_install.sh
Executable file
50
tools/travis/before_install.sh
Executable file
@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script should be used to install additional dependencies
|
||||
# This includes: installing ubuntu packages, custom services
|
||||
# or internet downloads.
|
||||
#
|
||||
|
||||
echo -e "#### System Information ####"
|
||||
|
||||
echo -e "\nJava Version: "
|
||||
javac -version
|
||||
|
||||
echo -e "\nMaven Version: "
|
||||
mvn -v
|
||||
|
||||
echo -e "\nUpdating the system: "
|
||||
sudo apt-get -q -y update > /dev/null
|
||||
|
||||
echo -e "\nInstalling MySQL: "
|
||||
|
||||
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password your_password'
|
||||
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password your_password'
|
||||
sudo apt-get -q -y install mysql-server > /dev/null
|
||||
|
||||
sudo /etc/init.d/mysql start
|
||||
|
||||
echo -e "\nInstalling Tomcat: "
|
||||
wget -q -O tomcat.tar.gz http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.33/bin/apache-tomcat-6.0.33.tar.gz
|
||||
sudo mkdir -p /opt/tomcat
|
||||
sudo tar xfv tomcat.tar.gz -C /opt/tomcat --strip 1 > /dev/null
|
||||
|
||||
echo -e "\nInstalling Development tools: "
|
||||
|
||||
sudo apt-get -q -y install uuid-runtime genisoimage python-setuptools python-pip netcat > /dev/null
|
||||
|
||||
echo "<settings>
|
||||
<mirrors>
|
||||
<mirror>
|
||||
<id>Central</id>
|
||||
<url>http://repo1.maven.org/maven2</url>
|
||||
<mirrorOf>central</mirrorOf>
|
||||
<!-- United States, St. Louis-->
|
||||
</mirror>
|
||||
</mirrors>
|
||||
</settings>" > ~/.m2/settings.xml
|
||||
|
||||
echo -e "\nInstalling some python packages: "
|
||||
|
||||
sudo pip install lxml > /dev/null
|
||||
sudo pip install texttable > /dev/null
|
||||
14
tools/travis/before_script.sh
Executable file
14
tools/travis/before_script.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script should be used to bring up the environment.
|
||||
#
|
||||
|
||||
export CATALINA_BASE=/opt/tomcat
|
||||
export CATALINA_HOME=/opt/tomcat
|
||||
export M2_HOME="/usr/local/maven-3.2.1/"
|
||||
export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=500m"
|
||||
|
||||
mvn -Dsimulator -pl :cloud-client-ui jetty:run 2>&1 > /dev/null &
|
||||
|
||||
while ! nc -vz localhost 8096 2>&1 > /dev/null; do sleep 10; done
|
||||
python -m marvin.deployDataCenter -i setup/dev/advanced.cfg 2>&1 || true
|
||||
27
tools/travis/install.sh
Executable file
27
tools/travis/install.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This should be used to create the build.
|
||||
#
|
||||
|
||||
export CATALINA_BASE=/opt/tomcat
|
||||
export CATALINA_HOME=/opt/tomcat
|
||||
export M2_HOME="/usr/local/maven-3.2.1/"
|
||||
export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=500m"
|
||||
|
||||
# Compile Cloudstack
|
||||
mvn -q -Pimpatient -Dsimulator clean install
|
||||
|
||||
# Compile API Docs
|
||||
cd tools/apidoc
|
||||
mvn -q clean install
|
||||
cd ../../
|
||||
|
||||
# Compile marvin
|
||||
cd tools/marvin
|
||||
mvn -q clean install
|
||||
sudo python setup.py install 2>&1 > /dev/null
|
||||
cd ../../
|
||||
|
||||
# Deploy the database
|
||||
mvn -q -Pdeveloper -pl developer -Ddeploydb
|
||||
mvn -q -Pdeveloper -pl developer -Ddeploydb-simulator
|
||||
5
tools/travis/script.sh
Executable file
5
tools/travis/script.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script should be responsible for bring up the
|
||||
# test environment and executing the tests.
|
||||
#
|
||||
85
tools/travis/xunit-reader.py
Executable file
85
tools/travis/xunit-reader.py
Executable file
@ -0,0 +1,85 @@
|
||||
# !/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
"""
|
||||
This script provides parsing of xunit xml files.
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
import argparse
|
||||
|
||||
import texttable
|
||||
|
||||
import lxml.etree
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Entry point for the parser
|
||||
|
||||
"""
|
||||
|
||||
args = _generate_args()
|
||||
file_path_list = _generate_file_list(args)
|
||||
|
||||
exit(parse_reports(file_path_list))
|
||||
|
||||
|
||||
def _generate_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Command line utility for reading xunit xml files'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'path',
|
||||
metavar='/path/to/folder/containing/xunit-reports',
|
||||
type=str,
|
||||
help='A path to a folder containing xunit reports'
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
return vars(args)
|
||||
|
||||
|
||||
def _generate_file_list(args):
|
||||
path = args.pop('path')
|
||||
file_path_list = []
|
||||
for (root, dirnames, filenames) in os.walk(path):
|
||||
for filename in filenames:
|
||||
if filename.endswith('.xml'):
|
||||
file_path_list.append(os.path.join(root, filename))
|
||||
|
||||
return file_path_list
|
||||
|
||||
|
||||
def parse_reports(file_path_list):
|
||||
table = texttable.Texttable()
|
||||
table.header(['Test', 'Result'])
|
||||
|
||||
exit_code = 0
|
||||
|
||||
for file_path in file_path_list:
|
||||
data = lxml.etree.iterparse(file_path, tag='testcase')
|
||||
for event, elem in data:
|
||||
name = ''
|
||||
status = 'Success'
|
||||
if 'name' in elem.attrib:
|
||||
name = elem.attrib['name']
|
||||
for children in elem.getchildren():
|
||||
if 'skipped' == children.tag:
|
||||
status = 'Skipped'
|
||||
elif 'failure' == children.tag:
|
||||
exit_code = 1
|
||||
status = 'Failure'
|
||||
|
||||
table.add_row([name, status])
|
||||
|
||||
print table.draw()
|
||||
|
||||
return exit_code
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
x
Reference in New Issue
Block a user