Repository navigation
IBM Semeru (OpenJ9) Support #289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8ea4ffb
Semeru Support
jord1e 1f05006
e2e test update
jord1e 0024d59
Reset dist/ folder
jord1e 085f4d9
Oops, release again
jord1e b42647c
fix leading space
jord1e d342f10
Rename Semeru distribution full name in README
jord1e f854a50
Merge branch 'main' into ibm-semeru
jord1e ff60477
Fix Semeru distribution details
jord1e 9034471
Proper dist?
jord1e 5523696
Fix package-lock edit
jord1e a04857f
Merge branch 'main' into ibm-semeru
jord1e dff91e4
Merge branch 'main' into ibm-semeru
jord1e 204a883
Updates
jord1e 6457aa3
Update dist files with GitHub Actions artifacts
jord1e a73fb66
Suggest minor changes to the code of Semeru related PR (#2)
IvanZosimov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -94,3 +94,6 @@ typings/ | |
| # DynamoDB Local files | ||
| .dynamodb/ | ||
| .vscode/ | ||
|
|
||
| # IntelliJ / WebStorm | ||
| /.idea/ | ||
This file contains hidden or 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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,254 @@ | ||
| import { HttpClient } from '@actions/http-client'; | ||
|
|
||
| import { JavaInstallerOptions } from '../../src/distributions/base-models'; | ||
| import { SemeruDistribution } from '../../src/distributions/semeru/installer'; | ||
|
|
||
| let manifestData = require('../data/semeru.json') as []; | ||
|
|
||
| describe('getAvailableVersions', () => { | ||
| let spyHttpClient: jest.SpyInstance; | ||
|
|
||
| beforeEach(() => { | ||
| spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson'); | ||
| spyHttpClient.mockReturnValue({ | ||
| statusCode: 200, | ||
| headers: {}, | ||
| result: [] | ||
| }); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| jest.resetAllMocks(); | ||
| jest.clearAllMocks(); | ||
| jest.restoreAllMocks(); | ||
| }); | ||
|
|
||
| it.each([ | ||
| [ | ||
| { version: '16', architecture: 'x64', packageType: 'jdk', checkLatest: false }, | ||
| 'os=mac&architecture=x64&image_type=jdk&release_type=ga&jvm_impl=openj9&page_size=20&page=0' | ||
| ], | ||
| [ | ||
| { version: '16', architecture: 'x86', packageType: 'jdk', checkLatest: false }, | ||
| 'os=mac&architecture=x86&image_type=jdk&release_type=ga&jvm_impl=openj9&page_size=20&page=0' | ||
| ], | ||
| [ | ||
| { version: '16', architecture: 'x64', packageType: 'jre', checkLatest: false }, | ||
| 'os=mac&architecture=x64&image_type=jre&release_type=ga&jvm_impl=openj9&page_size=20&page=0' | ||
| ], | ||
| [ | ||
| { version: '16', architecture: 'x64', packageType: 'jdk', checkLatest: false }, | ||
| 'os=mac&architecture=x64&image_type=jdk&release_type=ga&jvm_impl=openj9&page_size=20&page=0' | ||
| ] | ||
| ])( | ||
| 'build correct url for %s', | ||
| async (installerOptions: JavaInstallerOptions, expectedParameters) => { | ||
| const distribution = new SemeruDistribution(installerOptions); | ||
| const baseUrl = 'https://api.adoptopenjdk.net/v3/assets/version/%5B1.0,100.0%5D'; | ||
| const expectedUrl = `${baseUrl}?project=jdk&vendor=ibm&heap_size=normal&sort_method=DEFAULT&sort_order=DESC&${expectedParameters}`; | ||
| distribution['getPlatformOption'] = () => 'mac'; | ||
|
|
||
| await distribution['getAvailableVersions'](); | ||
|
|
||
| expect(spyHttpClient.mock.calls).toHaveLength(1); | ||
| expect(spyHttpClient.mock.calls[0][0]).toBe(expectedUrl); | ||
| } | ||
| ); | ||
|
|
||
| it('load available versions', async () => { | ||
| spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson'); | ||
| spyHttpClient | ||
| .mockReturnValueOnce({ | ||
| statusCode: 200, | ||
| headers: {}, | ||
| result: manifestData | ||
| }) | ||
| .mockReturnValueOnce({ | ||
| statusCode: 200, | ||
| headers: {}, | ||
| result: manifestData | ||
| }) | ||
| .mockReturnValueOnce({ | ||
| statusCode: 200, | ||
| headers: {}, | ||
| result: [] | ||
| }); | ||
|
|
||
| const distribution = new SemeruDistribution({ | ||
| version: '8', | ||
| architecture: 'x64', | ||
| packageType: 'jdk', | ||
| checkLatest: false | ||
| }); | ||
| const availableVersions = await distribution['getAvailableVersions'](); | ||
| expect(availableVersions).not.toBeNull(); | ||
| expect(availableVersions.length).toBe(manifestData.length * 2); | ||
| }); | ||
|
|
||
| it.each([ | ||
| ['jdk', 'Java_IBM_Semeru_jdk'], | ||
| ['jre', 'Java_IBM_Semeru_jre'] | ||
| ])('find right toolchain folder', (packageType: string, expected: string) => { | ||
| const distribution = new SemeruDistribution({ | ||
| version: '8', | ||
| architecture: 'x64', | ||
| packageType: packageType, | ||
| checkLatest: false | ||
| }); | ||
|
|
||
| // @ts-ignore - because it is protected | ||
| expect(distribution.toolcacheFolderName).toBe(expected); | ||
| }); | ||
| }); | ||
|
|
||
| describe('findPackageForDownload', () => { | ||
| it.each([ | ||
| ['8', '8.0.322+6'], | ||
| ['16', '16.0.2+7'], | ||
| ['16.0', '16.0.2+7'], | ||
| ['16.0.2', '16.0.2+7'], | ||
| ['8.x', '8.0.322+6'], | ||
| ['x', '17.0.2+8'] | ||
| ])('version is resolved correctly %s -> %s', async (input, expected) => { | ||
| const distribution = new SemeruDistribution({ | ||
| version: '8', | ||
| architecture: 'x64', | ||
| packageType: 'jdk', | ||
| checkLatest: false | ||
| }); | ||
| distribution['getAvailableVersions'] = async () => manifestData; | ||
| const resolvedVersion = await distribution['findPackageForDownload'](input); | ||
| expect(resolvedVersion.version).toBe(expected); | ||
| }); | ||
|
|
||
| it('version is found but binaries list is empty', async () => { | ||
| const distribution = new SemeruDistribution({ | ||
| version: '9.0.8', | ||
| architecture: 'x64', | ||
| packageType: 'jdk', | ||
| checkLatest: false | ||
| }); | ||
| distribution['getAvailableVersions'] = async () => manifestData; | ||
| await expect(distribution['findPackageForDownload']('9.0.8')).rejects.toThrowError( | ||
| /Could not find satisfied version for SemVer */ | ||
| ); | ||
| }); | ||
|
|
||
| it('version is not found', async () => { | ||
| const distribution = new SemeruDistribution({ | ||
| version: '7.x', | ||
| architecture: 'x64', | ||
| packageType: 'jdk', | ||
| checkLatest: false | ||
| }); | ||
| distribution['getAvailableVersions'] = async () => manifestData; | ||
| await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrowError( | ||
| /Could not find satisfied version for SemVer */ | ||
| ); | ||
| }); | ||
|
|
||
| it('version list is empty', async () => { | ||
| const distribution = new SemeruDistribution({ | ||
| version: '8', | ||
| architecture: 'x64', | ||
| packageType: 'jdk', | ||
| checkLatest: false | ||
| }); | ||
| distribution['getAvailableVersions'] = async () => []; | ||
| await expect(distribution['findPackageForDownload']('8')).rejects.toThrowError( | ||
| /Could not find satisfied version for SemVer */ | ||
| ); | ||
| }); | ||
|
|
||
| it.each(['x64', 'x86', 'ppc64le', 'ppc64', 's390x', 'aarch64'])( | ||
| 'correct Semeru `%s` architecture resolves', | ||
| async (arch: string) => { | ||
| const distribution = new SemeruDistribution({ | ||
| version: '8', | ||
| architecture: arch, | ||
| packageType: 'jdk', | ||
| checkLatest: false | ||
| }); | ||
| distribution['getAvailableVersions'] = async () => manifestData; | ||
| const resolvedVersion = await distribution['findPackageForDownload']('8'); | ||
| expect(resolvedVersion.version).not.toBeNull(); | ||
| } | ||
| ); | ||
|
|
||
| it.each(['zos', 'z/OS', 'z/os', 'test0987654321=', '++=++', 'myArch'])( | ||
| 'incorrect Semeru `%s` architecture throws', | ||
| async (arch: string) => { | ||
| const distribution = new SemeruDistribution({ | ||
| version: '8', | ||
| architecture: arch, | ||
| packageType: 'jdk', | ||
| checkLatest: false | ||
| }); | ||
| distribution['getAvailableVersions'] = async () => []; | ||
| await expect(distribution['findPackageForDownload']('8')).rejects.toThrowError( | ||
| `Unsupported architecture for IBM Semeru: ${arch}, the following are supported: x64, x86, ppc64le, ppc64, s390x, aarch64` | ||
| ); | ||
| } | ||
| ); | ||
|
|
||
| it.each(['9-ea', '17-ea', '8-ea', '4-ea'])( | ||
| 'early access version are illegal for Semeru (%s)', | ||
| async (version: string) => { | ||
| const distribution = new SemeruDistribution({ | ||
| version: version, | ||
| architecture: 'x64', | ||
| packageType: 'jdk', | ||
| checkLatest: false | ||
| }); | ||
| distribution['getAvailableVersions'] = async () => manifestData; | ||
| await expect(distribution['findPackageForDownload'](version)).rejects.toThrowError( | ||
| 'IBM Semeru does not provide builds for early access versions' | ||
| ); | ||
| } | ||
| ); | ||
|
|
||
| it.each(['jdk+fx', 'jre+fx', 'test', 'test2', 'jdk-fx', 'javafx', 'jdk-javafx', 'ibm', ' '])( | ||
| 'rejects incorrect `%s` Semeru package type', | ||
| async (packageType: string) => { | ||
| const distribution = new SemeruDistribution({ | ||
| version: '8', | ||
| architecture: 'x64', | ||
| packageType: packageType, | ||
| checkLatest: false | ||
| }); | ||
| distribution['getAvailableVersions'] = async () => manifestData; | ||
| await expect(distribution['findPackageForDownload']('8')).rejects.toThrowError( | ||
| 'IBM Semeru only provide `jdk` and `jre` package types' | ||
| ); | ||
| } | ||
| ); | ||
|
|
||
| it.each(['jdk', 'jre'])( | ||
| 'accepts correct `%s` Semeru package type', | ||
| async (packageType: string) => { | ||
| const distribution = new SemeruDistribution({ | ||
| version: '8', | ||
| architecture: 'x64', | ||
| packageType: packageType, | ||
| checkLatest: false | ||
| }); | ||
| distribution['getAvailableVersions'] = async () => manifestData; | ||
| const resolvedVersion = await distribution['findPackageForDownload']('8'); | ||
| await expect(resolvedVersion.version).toMatch(/8[0-9.]+/); | ||
| } | ||
| ); | ||
|
|
||
| it('fails when long release name is used', async () => { | ||
| expect( | ||
| () => | ||
| new SemeruDistribution({ | ||
| version: 'jdk-16.0.2+7_openj9-0.27.1', | ||
| architecture: 'x64', | ||
| packageType: 'jdk', | ||
| checkLatest: false | ||
| }) | ||
| ).toThrowError( | ||
| "The string 'jdk-16.0.2+7_openj9-0.27.1' is not valid SemVer notation for a Java version. Please check README file for code snippets and more detailed information" | ||
| ); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.