From 9799c80ea4c231dad0b1a821ebb6eb3a7d16fdd6 Mon Sep 17 00:00:00 2001 From: Ivan Zosimov Date: Wed, 13 Sep 2023 11:39:20 +0200 Subject: [PATCH] tests: fix unit tests, add e2e tests --- .github/workflows/e2e-versions.yml | 32 +++++++++++++++++-- .../distributors/dragonwell-installer.test.ts | 21 ++++++------ 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/.github/workflows/e2e-versions.yml b/.github/workflows/e2e-versions.yml index 7af524e..a1166e3 100644 --- a/.github/workflows/e2e-versions.yml +++ b/.github/workflows/e2e-versions.yml @@ -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 diff --git a/__tests__/distributors/dragonwell-installer.test.ts b/__tests__/distributors/dragonwell-installer.test.ts index 9af4f60..3e5b98b 100644 --- a/__tests__/distributors/dragonwell-installer.test.ts +++ b/__tests__/distributors/dragonwell-installer.test.ts @@ -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}".` ); } );