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 d808864
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/maven.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ _mvn_settings_opt() {
elif [ -n "$MAVEN_SETTINGS_URL" ]; then
local settingsXml="${mavenInstallDir}/.m2/settings.xml"
mkdir -p $(dirname ${settingsXml})
curl --retry 3 --retry-connrefused --connect-timeout 5 --silent --max-time 10 --location $MAVEN_SETTINGS_URL --output ${settingsXml}
curl -f --retry 3 --retry-connrefused --connect-timeout 5 --silent --max-time 10 --location $MAVEN_SETTINGS_URL --output ${settingsXml}
mcount "mvn.settings.url"
if [ -f ${settingsXml} ]; then
echo -n "-s ${settingsXml}"
Expand Down
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"
}
1 change: 1 addition & 0 deletions test/spec/java_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
app.before_deploy do
set_java_version(openjdk_version)
app.add_database("heroku-postgresql:essential-0")
`heroku addons:wait`
end

app.deploy do
Expand Down

0 comments on commit d808864

Please sign in to comment.