mirror of
https://github.com/actions/setup-java.git
synced 2026-07-31 21:36:17 +00:00
5894ef6b27
* Consolidate JDK metadata retries Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a5e2549a-0d89-4c8f-b7f3-411ad21c8a06 * Expand distribution retry coverage Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a5e2549a-0d89-4c8f-b7f3-411ad21c8a06 --------- Copilot-Session: a5e2549a-0d89-4c8f-b7f3-411ad21c8a06
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import {getJavaDistribution} from '../../src/distributions/distribution-factory.js';
|
|
import {RetryingHttpClient} from '../../src/retrying-http-client.js';
|
|
|
|
describe('getJavaDistribution', () => {
|
|
it.each([
|
|
'adopt',
|
|
'adopt-hotspot',
|
|
'adopt-openj9',
|
|
'temurin',
|
|
'zulu',
|
|
'liberica',
|
|
'liberica-nik',
|
|
'microsoft',
|
|
'semeru',
|
|
'corretto',
|
|
'oracle',
|
|
'dragonwell',
|
|
'sapmachine',
|
|
'graalvm',
|
|
'graalvm-community',
|
|
'jetbrains',
|
|
'kona',
|
|
'oracle-openjdk'
|
|
])('uses the shared retrying HTTP client for %s', distributionName => {
|
|
const distribution = getJavaDistribution(distributionName, {
|
|
version: '21',
|
|
architecture: 'x64',
|
|
packageType: 'jdk',
|
|
checkLatest: false
|
|
});
|
|
|
|
expect(distribution).not.toBeNull();
|
|
expect(distribution!['http']).toBeInstanceOf(RetryingHttpClient);
|
|
});
|
|
|
|
it("rejects java-package 'jdk+jmods' for non-Temurin distributions", () => {
|
|
expect(() =>
|
|
getJavaDistribution('zulu', {
|
|
version: '25',
|
|
architecture: 'x64',
|
|
packageType: 'jdk+jmods',
|
|
checkLatest: false
|
|
})
|
|
).toThrow(
|
|
"java-package 'jdk+jmods' is only supported for distribution 'temurin'."
|
|
);
|
|
});
|
|
});
|