diff options
author | Leif Åstrand <leif@vaadin.com> | 2011-10-17 13:04:06 +0000 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2011-10-17 13:04:06 +0000 |
commit | 1c38a69e4f1a1c47b3aff334458a9bea3b704305 (patch) | |
tree | 91996d19e6cf932367544d45d16dfd8a10ba54dd /tests/integration_base_files | |
parent | 7c06bfa1605de089f30b7d622bf8c9ed2e0d34ae (diff) | |
download | vaadin-framework-1c38a69e4f1a1c47b3aff334458a9bea3b704305.tar.gz vaadin-framework-1c38a69e4f1a1c47b3aff334458a9bea3b704305.zip |
Added random delay before starting the quicker servers to avoid contention in the beginning
Automatically update more base files before starting the actual tests
svn changeset:21719/svn branch:6.7
Diffstat (limited to 'tests/integration_base_files')
-rw-r--r-- | tests/integration_base_files/base.xml | 113 | ||||
-rw-r--r-- | tests/integration_base_files/cleanup.sh | 21 | ||||
-rw-r--r-- | tests/integration_base_files/lock_age.sh | 16 |
3 files changed, 150 insertions, 0 deletions
diff --git a/tests/integration_base_files/base.xml b/tests/integration_base_files/base.xml new file mode 100644 index 0000000000..20fe8b2d8d --- /dev/null +++ b/tests/integration_base_files/base.xml @@ -0,0 +1,113 @@ +<?xml version="1.0"?> +<project name="test" basedir="."> + <property file="deploy.properties" /> + <property name="lock" value="deploy/lock.file" /> + <property name="deployDir" value="deploy/${server}" /> + <property name="serverPort" value="8080" /> + <property name="war" value="demo.war" /> + <property name="startupSpawn" value="false" /> + <property name="JAVA_HOME" value="/usr/lib/jvm/default-java" /> + <property name="waitMinutes" value="3" /> + <property name="waitUrl" value="http://localhost:${serverPort}/demo/VAADIN/themes/reindeer/styles.css" /> + + + <target name="afterDeploy"> + <!-- Empty default --> + </target> + + <target name="beforeDeploy"> + <!-- Empty default --> + </target> + + <target name="deploy"> + <antcall target="beforeDeploy" /> + <echo message="${server}: Deploying ${war} to ${deployDir}/${autodeployDir}" /> + <copy file="${war}" todir="${deployDir}/${autodeployDir}"/> + <antcall target="afterDeploy" /> + </target> + + <target name="deployStatic"> + <unzip src="${war}" dest="${staticDeployDir}"> + <patternset> + <include name="VAADIN/**" /> + </patternset> + </unzip> + </target> + + <target name="unpack-server"> + <echo message="${server}: Unpacking ${server}.tar.gz" /> + <delete dir="${server}" /> + <exec executable="tar"> + <arg value="-xf"/> + <arg value="${server}.tar.gz"/> + </exec> + <move file="${server}" tofile="${deployDir}" /> + <echo message="Done." /> + </target> + + <target name="doStartup"> + <exec executable="./run.sh" spawn="${startupSpawn}"> + <env key="JAVA_HOME" value="${JAVA_HOME}" /> + </exec> + </target> + + <target name="startup"> + <antcall target="doStartup" /> + <echo message="${server}: Waiting for ${waitUrl} to become available." /> + <waitfor maxwait="${waitMinutes}" maxwaitunit="minute" checkevery="10000" timeoutproperty="timeout"> + <http url="${waitUrl}" /> + </waitfor> + <fail if="timeout" message="${server} failed to deploy" /> + + <echo message="${server}: Demo deployed successfully." /> + </target> + + <target name="shutdown"> + <exec executable="./stop.sh" > + <env key="JAVA_HOME" value="${JAVA_HOME}" /> + </exec> + <sleep seconds="15" /> + </target> + + <target name="check-port"> + <fail message="${server}: Something is still listening on port ${serverPort}"> + <condition> + <socket server="localhost" port="${serverPort}" /> + </condition> + </fail> + </target> + + <target name="check-lock"> + <available file="${lock}" property="lockAvailable" /> + <fail unless="lockAvailable" message="Instance is not locked!" /> + </target> + + <target name="get-lock"> + <mkdir dir="deploy" /> + <exec executable="lockfile"> + <arg value="${lock}" /> + </exec> + <echo>${server}: Got the lock</echo> + </target> + + <target name="clean"> + <delete dir="${deployDir}" /> + </target> + + <target name="release-lock"> +<!-- <exec executable="rm"> + <arg value="-f" /> + <arg value="${lock}" /> + </exec> --> + <delete> + <fileset dir="." includes="${lock}" /> + </delete> + <echo>${server}: Released the lock</echo> + </target> + + <target name="startup-and-deploy" depends="check-lock,check-port,unpack-server,deploy,startup" /> + + <target name="shutdown-and-cleanup" depends="shutdown,clean,release-lock" /> + + +</project> diff --git a/tests/integration_base_files/cleanup.sh b/tests/integration_base_files/cleanup.sh new file mode 100644 index 0000000000..d2d5445070 --- /dev/null +++ b/tests/integration_base_files/cleanup.sh @@ -0,0 +1,21 @@ +echo checking and killing open servers + +ps x | grep -E bin/java | grep -v grep | grep -v get-lock | awk '{print $1}' > temp + +#Read and kill processes marked to temp +while read line +do + kill -9 $line +done < temp + +#Remove temp +rm temp + +if [ -a /home/integration/demo.war ] + then + echo removing old demo.war + rm /home/integration/demo.war +fi + +echo Cleaning deploy dir +rm -rf /home/integration/deploy/* diff --git a/tests/integration_base_files/lock_age.sh b/tests/integration_base_files/lock_age.sh new file mode 100644 index 0000000000..1808ec05df --- /dev/null +++ b/tests/integration_base_files/lock_age.sh @@ -0,0 +1,16 @@ +#! /bin/bash +if [ -a /home/integration/deploy/lock.file ] + then + DATE=$(date +%s) + LOCK_AGE=$(stat -c %Z /home/integration/deploy/lock.file) + + AGE=$[($DATE - $LOCK_AGE)/60] + + if [ "$AGE" -gt "15" ] + then + echo lock.file is $AGE min old. + ./cleanup.sh +# else +# echo lock.file is $AGE min old. + fi +fi |