mirror of
https://github.com/actions/setup-java.git
synced 2025-04-19 17:36:45 +00:00
tests: fix unit tests, add e2e tests
This commit is contained in:
parent
253a04374f
commit
9799c80ea4
2 changed files with 38 additions and 15 deletions
32
.github/workflows/e2e-versions.yml
vendored
32
.github/workflows/e2e-versions.yml
vendored
|
@ -29,12 +29,17 @@ jobs:
|
||||||
'liberica',
|
'liberica',
|
||||||
'microsoft',
|
'microsoft',
|
||||||
'semeru',
|
'semeru',
|
||||||
'corretto'
|
'corretto',
|
||||||
|
'dragonwell'
|
||||||
] # internally 'adopt-hotspot' is the same as 'adopt'
|
] # internally 'adopt-hotspot' is the same as 'adopt'
|
||||||
version: ['8', '11', '16']
|
version: ['8', '11', '16']
|
||||||
exclude:
|
exclude:
|
||||||
- distribution: microsoft
|
- distribution: microsoft
|
||||||
version: 8
|
version: 8
|
||||||
|
- distribution: dragonwell
|
||||||
|
os: macos-latest
|
||||||
|
- distribution: dragonwell
|
||||||
|
version: 16
|
||||||
include:
|
include:
|
||||||
- distribution: oracle
|
- distribution: oracle
|
||||||
os: macos-latest
|
os: macos-latest
|
||||||
|
@ -45,6 +50,12 @@ jobs:
|
||||||
- distribution: oracle
|
- distribution: oracle
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
version: 19
|
version: 19
|
||||||
|
- distribution: dragonwell
|
||||||
|
os: windows-latest
|
||||||
|
version: 17
|
||||||
|
- distribution: dragonwell
|
||||||
|
os: ubuntu-latest
|
||||||
|
version: 17
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
@ -75,6 +86,15 @@ jobs:
|
||||||
- distribution: oracle
|
- distribution: oracle
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
version: '19.0.1'
|
version: '19.0.1'
|
||||||
|
- distribution: dragonwell
|
||||||
|
os: ubuntu-latest
|
||||||
|
version: '11.0'
|
||||||
|
- distribution: dragonwell
|
||||||
|
os: ubuntu-latest
|
||||||
|
version: '8.13.14'
|
||||||
|
- distribution: dragonwell
|
||||||
|
os: ubuntu-latest
|
||||||
|
version: '11.0.13+9'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
@ -96,7 +116,10 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
distribution: ['temurin', 'zulu', 'liberica']
|
distribution: ['temurin', 'zulu', 'liberica', 'dragonwell']
|
||||||
|
exclude:
|
||||||
|
- distribution: dragonwell
|
||||||
|
os: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
@ -119,7 +142,10 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
distribution: ['temurin', 'zulu', 'liberica']
|
distribution: ['temurin', 'zulu', 'liberica', 'dragonwell']
|
||||||
|
exclude:
|
||||||
|
- distribution: dragonwell
|
||||||
|
os: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
import {HttpClient} from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
import * as semver from 'semver';
|
|
||||||
import {DragonwellDistribution} from '../../src/distributions/dragonwell/installer';
|
import {DragonwellDistribution} from '../../src/distributions/dragonwell/installer';
|
||||||
import {IDragonwellAllVersions} from '../../src/distributions/dragonwell/models';
|
|
||||||
import * as utils from '../../src/util';
|
import * as utils from '../../src/util';
|
||||||
import os from 'os';
|
|
||||||
|
|
||||||
import manifestData from '../data/dragonwell.json';
|
import manifestData from '../data/dragonwell.json';
|
||||||
|
|
||||||
|
@ -44,17 +41,17 @@ describe('getAvailableVersions', () => {
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
it.each([
|
it.each([
|
||||||
['8', 'x86', 'linux', 0],
|
['8', 'x86', 'linux', 0],
|
||||||
['8', 'aarch64', 'linux', 33],
|
['8', 'aarch64', 'linux', 24],
|
||||||
['8.6.6', 'x64', 'linux', 36],
|
['8.6.6', 'x64', 'linux', 27],
|
||||||
['8', 'x86', 'anolis', 0],
|
['8', 'x86', 'anolis', 0],
|
||||||
['8', 'x86', 'windows', 0],
|
['8', 'x86', 'windows', 0],
|
||||||
['8', 'x86', 'mac', 0],
|
['8', 'x86', 'mac', 0],
|
||||||
['11', 'x64', 'linux', 36],
|
['11', 'x64', 'linux', 27],
|
||||||
['11', 'aarch64', 'linux', 33],
|
['11', 'aarch64', 'linux', 24],
|
||||||
['17', 'riscv', 'linux', 0],
|
['17', 'riscv', 'linux', 0],
|
||||||
['16.0.1', 'x64', 'linux', 36]
|
['16.0.1', 'x64', 'linux', 27]
|
||||||
])(
|
])(
|
||||||
'load available versions',
|
'should get right number of available versions from JSON',
|
||||||
async (
|
async (
|
||||||
jdkVersion: string,
|
jdkVersion: string,
|
||||||
arch: string,
|
arch: string,
|
||||||
|
@ -163,7 +160,7 @@ describe('getAvailableVersions', () => {
|
||||||
'https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.4.0.4%2B8_jdk-17.0.4-ga/Alibaba_Dragonwell_Standard_17.0.4.0.4%2B8_x64_linux.tar.gz'
|
'https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.4.0.4%2B8_jdk-17.0.4-ga/Alibaba_Dragonwell_Standard_17.0.4.0.4%2B8_x64_linux.tar.gz'
|
||||||
]
|
]
|
||||||
])(
|
])(
|
||||||
'test for download link',
|
'should return proper link according to the specified java-version, platform and arch',
|
||||||
async (
|
async (
|
||||||
jdkVersion: string,
|
jdkVersion: string,
|
||||||
platform: string,
|
platform: string,
|
||||||
|
@ -192,7 +189,7 @@ describe('getAvailableVersions', () => {
|
||||||
['11', 'macos', 'aarch64'],
|
['11', 'macos', 'aarch64'],
|
||||||
['17', 'linux', 'riscv']
|
['17', 'linux', 'riscv']
|
||||||
])(
|
])(
|
||||||
'test for unsupported version',
|
'should throw when required version of JDK can not be found in the JSON',
|
||||||
async (jdkVersion: string, platform: string, arch: string) => {
|
async (jdkVersion: string, platform: string, arch: string) => {
|
||||||
const distribution = new DragonwellDistribution({
|
const distribution = new DragonwellDistribution({
|
||||||
version: jdkVersion,
|
version: jdkVersion,
|
||||||
|
@ -205,7 +202,7 @@ describe('getAvailableVersions', () => {
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](jdkVersion)
|
distribution['findPackageForDownload'](jdkVersion)
|
||||||
).rejects.toThrow(
|
).rejects.toThrow(
|
||||||
`Couldn't find any satisfied version for the specified: "${jdkVersion}".`
|
`Couldn't find any satisfied version for the specified java-version: "${jdkVersion}".`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue