-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters