mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2025-08-23 00:19:07 +08:00

* Adds option to download using AzCopy * Bump version number and add release notes * Ensure we use at least v10 * Negate env var so it disables AzCopy * Use Azure storage SDK to download cache * Use same level of parallelism as AzCopy * Fix naming of variable * React to feedback * Bump Node types to Node 12 * Make linter happy * Pass options into restoreCache method * Fix tests * Restructure files and add tests * Add method to get the default download and upload options * Include breaking changes in RELEASES.md Co-authored-by: Josh Gross <joshmgross@github.com>
55 lines
1.2 KiB
TypeScript
55 lines
1.2 KiB
TypeScript
import {
|
|
DownloadOptions,
|
|
UploadOptions,
|
|
getDownloadOptions,
|
|
getUploadOptions
|
|
} from '../src/options'
|
|
|
|
const useAzureSdk = true
|
|
const downloadConcurrency = 8
|
|
const timeoutInMs = 30000
|
|
const uploadConcurrency = 4
|
|
const uploadChunkSize = 32 * 1024 * 1024
|
|
|
|
test('getDownloadOptions sets defaults', async () => {
|
|
const actualOptions = getDownloadOptions()
|
|
|
|
expect(actualOptions).toEqual({
|
|
useAzureSdk,
|
|
downloadConcurrency,
|
|
timeoutInMs
|
|
})
|
|
})
|
|
|
|
test('getDownloadOptions overrides all settings', async () => {
|
|
const expectedOptions: DownloadOptions = {
|
|
useAzureSdk: false,
|
|
downloadConcurrency: 14,
|
|
timeoutInMs: 20000
|
|
}
|
|
|
|
const actualOptions = getDownloadOptions(expectedOptions)
|
|
|
|
expect(actualOptions).toEqual(expectedOptions)
|
|
})
|
|
|
|
test('getUploadOptions sets defaults', async () => {
|
|
const actualOptions = getUploadOptions()
|
|
|
|
expect(actualOptions).toEqual({
|
|
uploadConcurrency,
|
|
uploadChunkSize
|
|
})
|
|
})
|
|
|
|
test('getUploadOptions overrides all settings', async () => {
|
|
const expectedOptions: UploadOptions = {
|
|
uploadConcurrency: 2,
|
|
uploadChunkSize: 16 * 1024 * 1024
|
|
}
|
|
|
|
const actualOptions = getUploadOptions(expectedOptions)
|
|
|
|
expect(actualOptions).toEqual(expectedOptions)
|
|
})
|