mirror of
https://github.com/actions/setup-java.git
synced 2026-11-14 07:52:24 +00:00
Architecture validation for JDK file installs (#1324)
* Enhance architecture validation and error handling * Improve architecture normalization and validation for custom tokens * Refactor architecture validation to consolidate error handling for invalid tokens
This commit is contained in:
@@ -272,7 +272,7 @@ describe('findPackageForDownload', () => {
|
||||
}
|
||||
);
|
||||
|
||||
it.each(['zos', 'z/OS', 'z/os', 'test0987654321=', '++=++', 'myArch'])(
|
||||
it.each(['zos', 'myArch'])(
|
||||
'incorrect Semeru `%s` architecture throws',
|
||||
async (arch: string) => {
|
||||
const distribution = new SemeruDistribution({
|
||||
|
||||
@@ -31,6 +31,36 @@ describe('Java platform capabilities', () => {
|
||||
expect(normalizeArchitecture(input)).toBe(expected);
|
||||
});
|
||||
|
||||
it.each(['constructor', 'Constructor'])(
|
||||
'preserves custom architecture token %s for jdkfile',
|
||||
architecture => {
|
||||
expect(normalizeArchitecture(architecture)).toBe(architecture);
|
||||
expect(validateJavaPlatform('jdkfile', 'linux', architecture, '17')).toBe(
|
||||
architecture
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
it.each([
|
||||
'x64<<end\nvalue\nend',
|
||||
'z/OS',
|
||||
'z/os',
|
||||
'test0987654321=',
|
||||
'++=++',
|
||||
'../x64',
|
||||
'x64\\other',
|
||||
'x64 other',
|
||||
'-x64',
|
||||
'_x64'
|
||||
])('rejects invalid architecture token %s', architecture => {
|
||||
const message = `Unsupported architecture value: ${JSON.stringify(architecture)}`;
|
||||
|
||||
expect(() => normalizeArchitecture(architecture)).toThrow(message);
|
||||
expect(() =>
|
||||
validateJavaPlatform('jdkfile', 'linux', architecture, '17')
|
||||
).toThrow(message);
|
||||
});
|
||||
|
||||
it.each([
|
||||
['linux', false, 'linux-glibc'],
|
||||
['linux', true, 'linux-musl'],
|
||||
|
||||
Reference in New Issue
Block a user