Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Malax committed Jul 3, 2024
1 parent 1298f19 commit e859a7d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
15 changes: 7 additions & 8 deletions test/compile_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@

assertCapturedSuccess() {
assertEquals 0 "${RETURN}"
if [ "$TRAVIS" = "true" ]; then
# Travis keeps injecting -Xmn option on JDK8 that causes a warning in STR_ERR
assertTrue true
else
assertEquals "" "$(cat ${STD_ERR})"
fi
}

setupJavaEnv() {
Expand All @@ -33,7 +27,7 @@ testCompileWithoutSystemProperties() {
assertCapturedSuccess

_assertMavenLatest
assertCaptured "Installing OpenJDK 1.8"
assertCaptured "Installing OpenJDK 21"
assertTrue "Java should be present in runtime." "[ -d ${BUILD_DIR}/.jdk ]"
assertTrue "Java version file should be present." "[ -f ${BUILD_DIR}/.jdk/version ]"
assertTrue "system.properties was not cached" "[ -f $CACHE_DIR/system.properties ]"
Expand All @@ -49,7 +43,7 @@ testCompile()

_assertMavenLatest
assertTrue "system.properties was not cached" "[ -f $CACHE_DIR/system.properties ]"
assertContains "system.properties contains the wrong version" "java.runtime.version=1.8" "$(cat $CACHE_DIR/system.properties)"
assertContains "system.properties contains the wrong version" "java.runtime.version=21" "$(cat $CACHE_DIR/system.properties)"
}

testCompilationFailure()
Expand Down Expand Up @@ -122,6 +116,11 @@ testCustomSettingsXmlWithUrl()
testCustomSettingsXmlWithInvalidUrl()
{
createPom
# Set OpenJDK version explicitly to avoid getting a warning on stderr which would
# trip assertCapturedError
cat > ${BUILD_DIR}/system.properties <<EOF
java.runtime.version=21
EOF

export MAVEN_SETTINGS_URL="https://example.com/ha7s8duysadfuhasjd/settings.xml"

Expand Down
8 changes: 3 additions & 5 deletions test/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ EOF

createSettingsXml()
{
[ "$TRAVIS" = "true" ] && rm -rf /home/travis/.m2/repository

if [ ! -z "${1:-}" ]; then
settings_file="$1"
else
Expand Down Expand Up @@ -115,10 +113,10 @@ _assertMaven354() {

_assertMavenLatest() {
local installDir="$(_mavenDir)"
assertCaptured "Wrong Maven Installed" "Installing Maven 3.9.4"
assertCaptured "Installing Maven 3.9.4"
assertFileMD5 "45ca660e83af83fa8213b55fb693326c" ${installDir}/.maven/bin/mvn
assertTrue "mvn should be executable" "[ -x ${installDir}/.maven/bin/mvn ]"

assertCaptured "Unexpected mvn command" "mvn -DskipTests clean dependency:list install"
assertCaptured "Build was not successful" "BUILD SUCCESS"
assertCaptured "mvn -DskipTests clean dependency:list install"
assertCaptured "BUILD SUCCESS"
}

0 comments on commit e859a7d

Please sign in to comment.