Skip to content

Commit

Permalink
#157: added integration testing (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
hohwille authored Jul 30, 2019
1 parent e7c9871 commit e7e9d6f
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 5 deletions.
31 changes: 31 additions & 0 deletions scripts/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,35 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>integration-test</id>
<activation>
<os>
<family>!Windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>integration-testing</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>${project.basedir}/src/test/bash/all-tests</executable>
<workingDirectory>${project.build.directory}</workingDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
11 changes: 7 additions & 4 deletions scripts/src/main/resources/scripts/command/ide
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ function doUpdateSettings() {
read -p "Settings URL: " answer
if [ -z "${answer}" ]
then
SETTINGS_URL="${DEVON_IDE_REPO_URL}/devon-ide-settings"
doUpgradeMavenArtifact "${SETTINGS_PATH}" "${DEVON_IDE_REPO_URL}" "devon-ide-settings" "${target_version}" ".zip"
SETTINGS_URL="-"
else
SETTINGS_URL="${answer}"
doInstall "${SETTINGS_PATH}" "${SETTINGS_URL}" "devon-ide-settings"
fi
fi
if [ "${SETTINGS_URL}" == "-" ]
then
SETTINGS_URL="${DEVON_IDE_REPO_URL}/devon-ide-settings"
doUpgradeMavenArtifact "${SETTINGS_PATH}" "${DEVON_IDE_REPO_URL}" "devon-ide-settings" "${target_version}" ".zip"
else
doInstall "${SETTINGS_PATH}" "${SETTINGS_URL}" "devon-ide-settings"
fi
Expand Down Expand Up @@ -91,7 +94,7 @@ function doSetup() {
doSetupConf "${SETTINGS_PATH}/devon" "${DEVON_IDE_HOME}"
else
doEcho "Your settings are missing the 'devon' folder. Please ask your technical lead to update your settings."
fi
fi
if [ -z "${DEVON_IDE_TOOLS}" ]
then
doFail "Variable DEVON_IDE_TOOLS is undefined. Please check your configuration (devon.properties)."
Expand Down
4 changes: 4 additions & 0 deletions scripts/src/main/resources/scripts/functions
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,10 @@ function doInstall() {
fi
fi
local dir=${target_path/*\//}
if [ "${target_path}" = "${DEVON_IDE_HOME}/software/${dir}" ]
then
mkdir -p "${DEVON_IDE_HOME}/software"
fi
local filename
if [ -z "${version}" ]
then
Expand Down
2 changes: 1 addition & 1 deletion scripts/src/main/resources/setup
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

cd `dirname ${BASH_SOURCE:-$0}`
echo "Setting up your devon-ide in ${PWD}"
source scripts/devon ide setup
source scripts/devon ide setup ${@}
38 changes: 38 additions & 0 deletions scripts/src/test/bash/all-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
success=0
failure=0
total=0
mkdir -p ~/.devon
touch ~/.devon/.license.agreement
rm -rf integration-test
mkdir -p integration-test
cd integration-test
for testpath in "$(dirname $0)"/test-*
do
testcase="${testpath/*\//}"
echo "Running test #${total}: ${testcase}"
mkdir "${testcase}"
cd "${testcase}"
"${testpath}"
result=${?}
if [ "${result}" == 0 ]
then
echo "[SUCCESS] Succeeded running test #${total}: ${testcase}"
let "success++"
else
echo "[ERROR] Failed running test #${total}: ${testcase} - exit code ${result}"
let "failure++"
fi
let "total++"
cd ..
done
echo
echo "*****************************************************"
echo "Executed #${total} test(s), #${success} succeeded and #${failure} failed"
if [ "${failure}" == 0 ]
then
echo "All test succeeded. Fine!"
else
echo "There are test failures! Please check the logs and fix errors."
exit 1
fi
15 changes: 15 additions & 0 deletions scripts/src/test/bash/test-setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

function doExtract() {
if [ -f "${1}" ]
then
tar xfz "${1}" || exit 1
else
echo "Could not find and extract release ${1}"
exit 1
fi
}

doExtract ../../devon-ide-scripts-*.tar.gz
./setup "-"
exit ${?}

0 comments on commit e7e9d6f

Please sign in to comment.