Skip to content

Commit

Permalink
Add overlay tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Malax committed Jan 29, 2025
1 parent 16df56d commit 7b5f3e3
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extra.txt contents
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java.runtime.version=8
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extra.txt contents
Binary file not shown.
1 change: 1 addition & 0 deletions test/spec/fixtures/repos/jdk-overlay/system.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java.runtime.version=21
12 changes: 12 additions & 0 deletions test/spec/fixtures/repos/jvmoptions/jvmoptions.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_21" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
</content>
<orderEntry type="jdk" jdkName="21" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
33 changes: 33 additions & 0 deletions test/spec/overlay_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 'JDK overlay' do
it 'is applied correctly over OpenJDK 8' do
app = Hatchet::Runner.new('jdk-overlay-java-8')

app.deploy do
expect(app.output).to match(Regexp.new(<<~REGEX, Regexp::MULTILINE))
remote: -----> JVM Common app detected
remote: -----> Installing OpenJDK 8... done
REGEX

expect(app.run('cat .jdk/extra.txt')).to eq("extra.txt contents\n")
expect(app.run('md5sum .jdk/jre/lib/security/cacerts')).to start_with('86700d98c9b3aaf30b40fabcc12c75fe')
end
end

it 'is applied correctly over OpenJDK >8 (21)' do
app = Hatchet::Runner.new('jdk-overlay')

app.deploy do
expect(app.output).to match(Regexp.new(<<~REGEX, Regexp::MULTILINE))
remote: -----> JVM Common app detected
remote: -----> Installing OpenJDK 21... done
REGEX

expect(app.run('cat .jdk/extra.txt')).to eq("extra.txt contents\n")
expect(app.run('md5sum .jdk/lib/security/cacerts')).to start_with('86700d98c9b3aaf30b40fabcc12c75fe')
end
end
end

0 comments on commit 7b5f3e3

Please sign in to comment.