forked from actions/toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Azure storage SDK to download cache (actions#497)
* 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 <[email protected]>
- Loading branch information
1 parent
cee7d92
commit 4964b0c
Showing
17 changed files
with
968 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
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) | ||
}) |
Oops, something went wrong.