Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Malax committed Jan 29, 2025
1 parent 1352adc commit 16df56d
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 4 deletions.
5 changes: 4 additions & 1 deletion test/spec/clojure_smoke_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
require_relative 'spec_helper'

# Test both the released version of the Clojure buildpack as well as the code on main
clojure_buildpacks = %w[https://github.com/heroku/heroku-buildpack-clojure#main https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/clojure.tgz]
clojure_buildpacks = %w[
https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/clojure.tgz
https://github.com/heroku/heroku-buildpack-clojure#main
]

RSpec.describe 'Usage from Heroku\'s Clojure buildpack' do
clojure_buildpacks.each do |clojure_buildpack|
Expand Down
5 changes: 4 additions & 1 deletion test/spec/java_gradle_smoke_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
require_relative 'spec_helper'

# Test both the released version of the Gradle buildpack as well as the code on main
gradle_buildpacks = %w[https://github.com/heroku/heroku-buildpack-gradle#main https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/gradle.tgz]
gradle_buildpacks = %w[
https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/gradle.tgz
https://github.com/heroku/heroku-buildpack-gradle#main
]

RSpec.describe 'Usage from Heroku\'s Gradle buildpack' do
gradle_buildpacks.each do |gradle_buildpack|
Expand Down
5 changes: 4 additions & 1 deletion test/spec/java_maven_smoke_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
require_relative 'spec_helper'

# Test both the released version of the Maven buildpack as well as the code on main
maven_buildpacks = %w[https://github.com/heroku/heroku-buildpack-java#main https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/java.tgz]
maven_buildpacks = %w[
https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/java.tgz
https://github.com/heroku/heroku-buildpack-java#main
]

RSpec.describe 'Usage from Heroku\'s Maven buildpack' do
maven_buildpacks.each do |maven_buildpack|
Expand Down
2 changes: 2 additions & 0 deletions test/spec/java_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
'23' => 'OpenJDK Runtime Environment Zulu23.30+13-CA (build 23.0.1+11)',
'heroku-21' => 'OpenJDK Runtime Environment (build 21.0.5+11)',
'zulu-21' => 'OpenJDK Runtime Environment Zulu21.38+21-CA (build 21.0.5+11-LTS)',
# Ensure that slightly incorrect version strings work
' 21 ' => 'OpenJDK Runtime Environment Zulu21.38+21-CA (build 21.0.5+11-LTS)',
},
}.freeze

Expand Down
33 changes: 33 additions & 0 deletions test/spec/provided_jdk_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# frozen_string_literal: true

require_relative 'spec_helper'

RSpec.describe 'using an application provided JDK' do
it 'skips installing OpenJDK and outputs the correct message' do
app = Hatchet::Runner.new('empty')

app.before_deploy do
# Create a system.properties file to ensure the contents
# are ignored when a custom JDK is present.
set_java_version(Dir.pwd, '21')

# Install Amazon Corretto to the .jdk directory of the application
url = 'https://corretto.aws/downloads/resources/21.0.6.7.1/amazon-corretto-21.0.6.7.1-linux-x64.tar.gz'
tarball_name = 'corretto.tar.gz'
jdk_dir = '.jdk'

system("curl --silent -o #{tarball_name} --fail '#{url}'")
system("mkdir #{jdk_dir}")
system("tar --strip-components=1 -C #{jdk_dir} -xzf #{tarball_name}")
end

app.deploy do
expect(app.run('.jdk/bin/java -version')).to include('OpenJDK Runtime Environment Corretto-21.0.6.7.1')

expect(app.output).to match(Regexp.new(<<~REGEX, Regexp::MULTILINE))
remote: -----> JVM Common app detected
remote: -----> Using provided JDK
REGEX
end
end
end
5 changes: 4 additions & 1 deletion test/spec/scala_smoke_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
require_relative 'spec_helper'

# Test both the released version of the Scala buildpack as well as the code on main
scala_buildpacks = %w[https://github.com/heroku/heroku-buildpack-scala#main https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/scala.tgz]
scala_buildpacks = %w[
https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/scala.tgz
https://github.com/heroku/heroku-buildpack-scala#main
]

RSpec.describe 'Usage from Heroku\'s Scala buildpack' do
scala_buildpacks.each do |scala_buildpack|
Expand Down

0 comments on commit 16df56d

Please sign in to comment.