tests: fix unit tests, add e2e tests

This commit is contained in:
Ivan Zosimov 2023-09-13 11:39:20 +02:00
parent 253a04374f
commit 9799c80ea4
2 changed files with 38 additions and 15 deletions

View File

@ -29,12 +29,17 @@ jobs:
'liberica',
'microsoft',
'semeru',
'corretto'
'corretto',
'dragonwell'
] # internally 'adopt-hotspot' is the same as 'adopt'
version: ['8', '11', '16']
exclude:
- distribution: microsoft
version: 8
- distribution: dragonwell
os: macos-latest
- distribution: dragonwell
version: 16
include:
- distribution: oracle
os: macos-latest
@ -45,6 +50,12 @@ jobs:
- distribution: oracle
os: ubuntu-latest
version: 19
- distribution: dragonwell
os: windows-latest
version: 17
- distribution: dragonwell
os: ubuntu-latest
version: 17
steps:
- name: Checkout
uses: actions/checkout@v3
@ -75,6 +86,15 @@ jobs:
- distribution: oracle
os: ubuntu-latest
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:
- name: Checkout
uses: actions/checkout@v3
@ -96,7 +116,10 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['temurin', 'zulu', 'liberica']
distribution: ['temurin', 'zulu', 'liberica', 'dragonwell']
exclude:
- distribution: dragonwell
os: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
@ -119,7 +142,10 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['temurin', 'zulu', 'liberica']
distribution: ['temurin', 'zulu', 'liberica', 'dragonwell']
exclude:
- distribution: dragonwell
os: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3

View File

@ -1,9 +1,6 @@
import {HttpClient} from '@actions/http-client';
import * as semver from 'semver';
import {DragonwellDistribution} from '../../src/distributions/dragonwell/installer';
import {IDragonwellAllVersions} from '../../src/distributions/dragonwell/models';
import * as utils from '../../src/util';
import os from 'os';
import manifestData from '../data/dragonwell.json';
@ -44,17 +41,17 @@ describe('getAvailableVersions', () => {
describe('getAvailableVersions', () => {
it.each([
['8', 'x86', 'linux', 0],
['8', 'aarch64', 'linux', 33],
['8.6.6', 'x64', 'linux', 36],
['8', 'aarch64', 'linux', 24],
['8.6.6', 'x64', 'linux', 27],
['8', 'x86', 'anolis', 0],
['8', 'x86', 'windows', 0],
['8', 'x86', 'mac', 0],
['11', 'x64', 'linux', 36],
['11', 'aarch64', 'linux', 33],
['11', 'x64', 'linux', 27],
['11', 'aarch64', 'linux', 24],
['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 (
jdkVersion: 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'
]
])(
'test for download link',
'should return proper link according to the specified java-version, platform and arch',
async (
jdkVersion: string,
platform: string,
@ -192,7 +189,7 @@ describe('getAvailableVersions', () => {
['11', 'macos', 'aarch64'],
['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) => {
const distribution = new DragonwellDistribution({
version: jdkVersion,
@ -205,7 +202,7 @@ describe('getAvailableVersions', () => {
await expect(
distribution['findPackageForDownload'](jdkVersion)
).rejects.toThrow(
`Couldn't find any satisfied version for the specified: "${jdkVersion}".`
`Couldn't find any satisfied version for the specified java-version: "${jdkVersion}".`
);
}
);