From 6212541feb98536020fcfb794d0cb1774bc20d78 Mon Sep 17 00:00:00 2001 From: Manuel Fuchs Date: Wed, 3 Jul 2024 14:46:56 +0200 Subject: [PATCH] Add heroku-24 to CI (#218) --- .github/workflows/ci.yml | 7 +++--- test/compile_test.sh | 23 ++----------------- test/helpers.sh | 8 +++---- test/spec/db_spec.rb | 2 ++ .../repos/java-apache-dbcp-sample/pom.xml | 4 ++-- test/spec/java_spec.rb | 2 ++ test/spec/maven_spec.rb | 2 ++ test/spec/spec_helper.rb | 11 +++++---- 8 files changed, 24 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb7ae742..0fc08143 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - stack: ["heroku-20", "heroku-22"] + stack: ["heroku-20", "heroku-22", "heroku-24"] env: HATCHET_APP_LIMIT: 100 HATCHET_EXPENSIVE_MODE: 1 @@ -85,12 +85,13 @@ jobs: name: "Unit Tests (${{ matrix.stack }})" runs-on: ubuntu-22.04 container: - image: "${{ fromJson('{ \"heroku-20\": \"heroku/heroku:20\", \"heroku-22\": \"heroku/heroku:22\" }')[matrix.stack] }}" + image: "${{ fromJson('{ \"heroku-20\": \"heroku/heroku:20\", \"heroku-22\": \"heroku/heroku:22\", \"heroku-24\": \"heroku/heroku:24\" }')[matrix.stack] }}" + options: --user root env: STACK: ${{ matrix.stack }} strategy: matrix: - stack: ["heroku-20", "heroku-22"] + stack: ["heroku-20", "heroku-22", "heroku-24"] steps: - uses: actions/checkout@v4 - run: test/unit diff --git a/test/compile_test.sh b/test/compile_test.sh index 2d610ff8..c4f5822d 100644 --- a/test/compile_test.sh +++ b/test/compile_test.sh @@ -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() { @@ -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 ]" @@ -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() @@ -119,19 +113,6 @@ testCustomSettingsXmlWithUrl() unset MAVEN_SETTINGS_URL } -testCustomSettingsXmlWithInvalidUrl() -{ - createPom - - export MAVEN_SETTINGS_URL="https://example.com/ha7s8duysadfuhasjd/settings.xml" - - compile - - assertCapturedError - - unset MAVEN_SETTINGS_URL -} - testIgnoreSettingsOptConfig() { createPom "$(withDependency)" diff --git a/test/helpers.sh b/test/helpers.sh index a1d7fef4..9e17dfba 100644 --- a/test/helpers.sh +++ b/test/helpers.sh @@ -42,8 +42,6 @@ EOF createSettingsXml() { - [ "$TRAVIS" = "true" ] && rm -rf /home/travis/.m2/repository - if [ ! -z "${1:-}" ]; then settings_file="$1" else @@ -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" } diff --git a/test/spec/db_spec.rb b/test/spec/db_spec.rb index 3b652acb..cf011194 100644 --- a/test/spec/db_spec.rb +++ b/test/spec/db_spec.rb @@ -6,6 +6,8 @@ Hatchet::Runner.new("java-apache-dbcp-sample", stack: ENV["HEROKU_TEST_STACK"]).tap do |app| app.before_deploy do set_java_version(DEFAULT_OPENJDK_VERSION) + app.add_database("heroku-postgresql") + `heroku addons:wait` end app.deploy do diff --git a/test/spec/fixtures/repos/java-apache-dbcp-sample/pom.xml b/test/spec/fixtures/repos/java-apache-dbcp-sample/pom.xml index 5808e3d6..cbcf2254 100644 --- a/test/spec/fixtures/repos/java-apache-dbcp-sample/pom.xml +++ b/test/spec/fixtures/repos/java-apache-dbcp-sample/pom.xml @@ -20,12 +20,12 @@ org.postgresql postgresql - 9.3-1102-jdbc41 + 42.7.3 org.apache.commons commons-dbcp2 - 2.0.1 + 2.12.0 diff --git a/test/spec/java_spec.rb b/test/spec/java_spec.rb index b2dd0d05..a9690ae4 100644 --- a/test/spec/java_spec.rb +++ b/test/spec/java_spec.rb @@ -7,6 +7,8 @@ Hatchet::Runner.new("java-servlets-sample", stack: ENV["HEROKU_TEST_STACK"]).tap do |app| app.before_deploy do set_java_version(openjdk_version) + app.add_database("heroku-postgresql") + `heroku addons:wait` end app.deploy do diff --git a/test/spec/maven_spec.rb b/test/spec/maven_spec.rb index 5976d097..0b7de403 100644 --- a/test/spec/maven_spec.rb +++ b/test/spec/maven_spec.rb @@ -23,6 +23,8 @@ app.before_deploy do set_java_version(DEFAULT_OPENJDK_VERSION) set_maven_version("3.2.5") + app.add_database("heroku-postgresql") + `heroku addons:wait` end app.deploy do diff --git a/test/spec/spec_helper.rb b/test/spec/spec_helper.rb index 3e9ddc52..70210385 100644 --- a/test/spec/spec_helper.rb +++ b/test/spec/spec_helper.rb @@ -3,9 +3,7 @@ require "hatchet" require "java-properties" -# Omitting 1.7 here since most example projects used in testing are not -# compatible with 1.7. -OPENJDK_VERSIONS=%w(1.8 11 13 15) +OPENJDK_VERSIONS=%w(1.8 11) DEFAULT_OPENJDK_VERSION="1.8" RSpec.configure do |config| @@ -50,5 +48,10 @@ def run(cmd) def http_get(app, options = {}) retry_limit = options[:retry_limit] || 50 path = options[:path] ? "/#{options[:path]}" : "" - Excon.get("#{app.platform_api.app.info(app.name).fetch("web_url")}#{path}", :idempotent => true, :expects => 200, :retry_limit => retry_limit).body + + begin + Excon.get("#{app.platform_api.app.info(app.name).fetch("web_url")}#{path}", :idempotent => true, :expects => 200, :retry_limit => retry_limit).body + rescue Excon::Error => e + puts e.response.body + end end