-
Notifications
You must be signed in to change notification settings - Fork 752
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
1 parent
67fbd72
commit 9871695
Showing
9 changed files
with
726 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
{ | ||
"8": [ | ||
{ | ||
"version": "8.0.19", | ||
"jdkVersion": "8u422", | ||
"latest": true, | ||
"baseUrl": "https://github.com/Tencent/TencentKona-8/releases/download/8.0.19-GA/", | ||
"files": [ | ||
{ | ||
"os": "linux", | ||
"arch": "aarch64", | ||
"filename": "TencentKona8.0.19.b1_jdk_linux-aarch64_8u422.tar.gz", | ||
"checksum": "ef031cc28012413ee771c318c6986bfb1dd80b16962ae073d775e269397f6580" | ||
}, | ||
{ | ||
"os": "linux", | ||
"arch": "x86_64", | ||
"filename": "TencentKona8.0.19.b1_jdk_linux-x86_64_8u422.tar.gz", | ||
"checksum": "57866cb132fc551028257dd1a6ad65650ca0436a1811f30c53ad67844e35c781" | ||
}, | ||
{ | ||
"os": "macos", | ||
"arch": "aarch64", | ||
"filename": "TencentKona8.0.19.b1_jdk_macosx-aarch64_8u422_notarized.tar.gz", | ||
"checksum": "4c9c169b983fc0b1fd2bbcdd40daa410c72c10ad360d6a61957270c9bdbd96d9" | ||
}, | ||
{ | ||
"os": "macos", | ||
"arch": "x86_64", | ||
"filename": "TencentKona8.0.19.b1_jdk_macosx-x86_64_8u422_notarized.tar.gz", | ||
"checksum": "9f9be00fb2259bc6ea0b117cb96041b12b39fdf537991af75e9e475e73c6b40f" | ||
}, | ||
{ | ||
"os": "windows", | ||
"arch": "x86_64", | ||
"filename": "TencentKona8.0.19.b1_jdk_windows-x86_64_8u422_signed.zip", | ||
"checksum": "afc16c4d048f6c90099841e16ad50314ae710340ec057ef19c845f5d43b6ee9e" | ||
} | ||
] | ||
} | ||
], | ||
"11": [ | ||
{ | ||
"version": "11.0.24", | ||
"jdkVersion": "11.0.24", | ||
"latest": true, | ||
"baseUrl": "https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.24/", | ||
"files": [ | ||
{ | ||
"os": "linux", | ||
"arch": "aarch64", | ||
"filename": "TencentKona-11.0.24.b1-jdk_linux-aarch64.tar.gz", | ||
"checksum": "505aa9e39c6fd9dab20443c0b4ed8fb1fedb40109c52b00edeaa7774c6fe9de9" | ||
}, | ||
{ | ||
"os": "linux", | ||
"arch": "x86_64", | ||
"filename": "TencentKona-11.0.24.b1-jdk_linux-x86_64.tar.gz", | ||
"checksum": "63ff8d821a2b0eef02aa257a959e53150e02865f8eb143feca1b40179d94a3f3" | ||
}, | ||
{ | ||
"os": "macos", | ||
"arch": "aarch64", | ||
"filename": "TencentKona-11.0.24.b1_jdk_macosx-aarch64_notarized.tar.gz", | ||
"checksum": "e8a6c493a9922fbabc712fa70a50260f001d9202e3370224eabc27adfcf008de" | ||
}, | ||
{ | ||
"os": "macos", | ||
"arch": "x86_64", | ||
"filename": "TencentKona-11.0.24.b1_jdk_macosx-x86_64_notarized.tar.gz", | ||
"checksum": "c8316cc8388faaa3d898f412a63ef42efbad243a01eaef37f6a19d77e4cd7956" | ||
}, | ||
{ | ||
"os": "windows", | ||
"arch": "x86_64", | ||
"filename": "TencentKona-11.0.24.b1_jdk_windows-x86_64_signed.zip", | ||
"checksum": "222b135f637af85e3092921a9c9bfc45a743944c179e4170d93e4eea82165858" | ||
} | ||
] | ||
} | ||
], | ||
"17": [ | ||
{ | ||
"version": "17.0.12", | ||
"jdkVersion": "17.0.12", | ||
"latest": true, | ||
"baseUrl": "https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.12/", | ||
"files": [ | ||
{ | ||
"os": "linux", | ||
"arch": "aarch64", | ||
"filename": "TencentKona-17.0.12.b1-jdk_linux-aarch64.tar.gz", | ||
"checksum": "bf65e9b3ab5781a5bb9ddfe5a6032efa8f099f48d85b5dcec686e5a4c0647fea" | ||
}, | ||
{ | ||
"os": "linux", | ||
"arch": "x86_64", | ||
"filename": "TencentKona-17.0.12.b1-jdk_linux-x86_64.tar.gz", | ||
"checksum": "b8b6706c3710777240696c672168c8065d7a77c2199238ace7caffe353deab27" | ||
}, | ||
{ | ||
"os": "macos", | ||
"arch": "aarch64", | ||
"filename": "TencentKona-17.0.12.b1_jdk_macosx-aarch64_notarized.tar.gz", | ||
"checksum": "d1f5653e2e8c7a0febeeadd13d7f4270076c0b4bde3785d4a93a9444c69800b5" | ||
}, | ||
{ | ||
"os": "macos", | ||
"arch": "x86_64", | ||
"filename": "TencentKona-17.0.12.b1_jdk_macosx-x86_64_notarized.tar.gz", | ||
"checksum": "870678cabbabd6970e8f9d0a7fafa8d87597f71d9f581d0f0d103879101e97bc" | ||
}, | ||
{ | ||
"os": "windows", | ||
"arch": "x86_64", | ||
"filename": "TencentKona-17.0.12.b1_jdk_windows-x86_64_signed.zip", | ||
"checksum": "0a0bc7c10cd9d0852f368674d02ee6d39200ef4d8857904004b677a15937e412" | ||
} | ||
] | ||
} | ||
] | ||
} |
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,189 @@ | ||
import {KonaDistribution} from '../../src/distributions/kona/installer'; | ||
|
||
import manifestData from '../data/kona.json'; | ||
|
||
function mockDistr( | ||
version: string, | ||
os: string, | ||
arch: string, | ||
packageType: string | ||
): KonaDistribution { | ||
const distribution = new KonaDistribution({ | ||
version: version, | ||
architecture: arch, | ||
packageType: packageType, | ||
checkLatest: false | ||
}); | ||
|
||
distribution['getOs'] = () => os; | ||
distribution['fetchReleaseInfo'] = async () => manifestData; | ||
|
||
return distribution; | ||
} | ||
|
||
describe('Check getAvailableReleases', () => { | ||
it.each([ | ||
['8', 'linux', 'aarch64', 'linux-aarch64'], | ||
['8.0.19', 'macos', 'x86_64', 'macosx-x86_64'], | ||
['11', 'linux', 'x86_64', 'linux-x86_64'], | ||
['11.0.24', 'macos', 'aarch64', 'macosx-aarch64'], | ||
['17.0.12', 'windows', 'x86_64', 'windows-x86_64'] | ||
])( | ||
'should get releases with the specified version "%s", OS "%s" and arch "%s"', | ||
async ( | ||
version: string, | ||
os: string, | ||
arch: string, | ||
expectedPattern: string | ||
) => { | ||
const distribution = mockDistr(version, os, arch, 'jdk'); | ||
|
||
const releases = await distribution['getAvailableReleases'](); | ||
expect(releases).not.toBeNull(); | ||
expect(releases.length).toBe(3); | ||
releases.forEach((release, index) => | ||
expect(releases[index].downloadUrl).toContain(expectedPattern) | ||
); | ||
} | ||
); | ||
}); | ||
|
||
describe('Check findPackageForDownload', () => { | ||
it.each([ | ||
[ | ||
'8', | ||
'linux', | ||
'aarch64', | ||
'https://github.com/Tencent/TencentKona-8/releases/download/8.0.19-GA/TencentKona8.0.19.b1_jdk_linux-aarch64_8u422.tar.gz' | ||
], | ||
[ | ||
'8.0.19', | ||
'linux', | ||
'x86_64', | ||
'https://github.com/Tencent/TencentKona-8/releases/download/8.0.19-GA/TencentKona8.0.19.b1_jdk_linux-x86_64_8u422.tar.gz' | ||
], | ||
[ | ||
'8.0.19', | ||
'macos', | ||
'aarch64', | ||
'https://github.com/Tencent/TencentKona-8/releases/download/8.0.19-GA/TencentKona8.0.19.b1_jdk_macosx-aarch64_8u422_notarized.tar.gz' | ||
], | ||
[ | ||
'8.0.19', | ||
'macos', | ||
'x86_64', | ||
'https://github.com/Tencent/TencentKona-8/releases/download/8.0.19-GA/TencentKona8.0.19.b1_jdk_macosx-x86_64_8u422_notarized.tar.gz' | ||
], | ||
[ | ||
'8.0.19', | ||
'windows', | ||
'x86_64', | ||
'https://github.com/Tencent/TencentKona-8/releases/download/8.0.19-GA/TencentKona8.0.19.b1_jdk_windows-x86_64_8u422_signed.zip' | ||
], | ||
|
||
[ | ||
'11', | ||
'linux', | ||
'aarch64', | ||
'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.24/TencentKona-11.0.24.b1-jdk_linux-aarch64.tar.gz' | ||
], | ||
[ | ||
'11.0.24', | ||
'linux', | ||
'x86_64', | ||
'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.24/TencentKona-11.0.24.b1-jdk_linux-x86_64.tar.gz' | ||
], | ||
[ | ||
'11.0.24', | ||
'macos', | ||
'aarch64', | ||
'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.24/TencentKona-11.0.24.b1_jdk_macosx-aarch64_notarized.tar.gz' | ||
], | ||
[ | ||
'11.0.24', | ||
'macos', | ||
'x86_64', | ||
'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.24/TencentKona-11.0.24.b1_jdk_macosx-x86_64_notarized.tar.gz' | ||
], | ||
[ | ||
'11.0.24', | ||
'windows', | ||
'x86_64', | ||
'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.24/TencentKona-11.0.24.b1_jdk_windows-x86_64_signed.zip' | ||
], | ||
|
||
[ | ||
'17', | ||
'linux', | ||
'aarch64', | ||
'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.12/TencentKona-17.0.12.b1-jdk_linux-aarch64.tar.gz' | ||
], | ||
[ | ||
'17.0.12', | ||
'linux', | ||
'x86_64', | ||
'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.12/TencentKona-17.0.12.b1-jdk_linux-x86_64.tar.gz' | ||
], | ||
[ | ||
'17.0.12', | ||
'macos', | ||
'aarch64', | ||
'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.12/TencentKona-17.0.12.b1_jdk_macosx-aarch64_notarized.tar.gz' | ||
], | ||
[ | ||
'17.0.12', | ||
'macos', | ||
'x86_64', | ||
'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.12/TencentKona-17.0.12.b1_jdk_macosx-x86_64_notarized.tar.gz' | ||
], | ||
[ | ||
'17.0.12', | ||
'windows', | ||
'x86_64', | ||
'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.12/TencentKona-17.0.12.b1_jdk_windows-x86_64_signed.zip' | ||
] | ||
])( | ||
'should return the download URL with the specified version "%s", OS "%s" and arch "%s"', | ||
async (version: string, os: string, arch: string, expectedUrl: string) => { | ||
const distribution = mockDistr(version, os, arch, 'jdk'); | ||
|
||
const availableRelease = await distribution['findPackageForDownload']( | ||
version | ||
); | ||
expect(availableRelease).not.toBeNull(); | ||
expect(availableRelease.url).toBe(expectedUrl); | ||
} | ||
); | ||
}); | ||
|
||
describe('No release is found', () => { | ||
it.each([ | ||
['8', 'linux', 'x86'], | ||
['17', 'solaris', 'x86_64'], | ||
['21', 'linux', 'x86_64'] | ||
])( | ||
`should throw an error due to no release with the specified version "%s", os "%s" and arch "%s"`, | ||
async (version: string, os: string, arch: string) => { | ||
const distribution = mockDistr(version, os, arch, 'jdk'); | ||
|
||
await expect( | ||
distribution['findPackageForDownload'](version) | ||
).rejects.toThrow( | ||
`No Kona release for the specified version "${version}" on OS "${os}" and arch "${arch}".` | ||
); | ||
} | ||
); | ||
}); | ||
|
||
describe('The package type must be jdk', () => { | ||
it('should throw an error due to the specified package type is not jdk', async () => { | ||
const version = '8.0.19'; | ||
const os = 'linux'; | ||
const arch = 'x86_64'; | ||
const distribution = mockDistr(version, os, arch, 'jre'); | ||
|
||
await expect( | ||
distribution['findPackageForDownload'](version) | ||
).rejects.toThrow('Kona provides jdk only'); | ||
}); | ||
}); |
Oops, something went wrong.