From a3849b77aead53f9f89da9a7551f19dde8247f86 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 17 Jan 2023 17:12:42 +0100 Subject: [PATCH] Rename option to lookupOnly --- packages/cache/__tests__/options.test.ts | 10 +++++----- packages/cache/__tests__/restoreCache.test.ts | 2 +- packages/cache/src/cache.ts | 4 ++-- packages/cache/src/options.ts | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/cache/__tests__/options.test.ts b/packages/cache/__tests__/options.test.ts index 46e540cb..79f04241 100644 --- a/packages/cache/__tests__/options.test.ts +++ b/packages/cache/__tests__/options.test.ts @@ -9,7 +9,7 @@ const useAzureSdk = true const downloadConcurrency = 8 const timeoutInMs = 30000 const segmentTimeoutInMs = 3600000 -const dryRun = false +const lookupOnly = false const uploadConcurrency = 4 const uploadChunkSize = 32 * 1024 * 1024 @@ -21,7 +21,7 @@ test('getDownloadOptions sets defaults', async () => { downloadConcurrency, timeoutInMs, segmentTimeoutInMs, - dryRun + lookupOnly }) }) @@ -31,7 +31,7 @@ test('getDownloadOptions overrides all settings', async () => { downloadConcurrency: 14, timeoutInMs: 20000, segmentTimeoutInMs: 3600000, - dryRun: true + lookupOnly: true } const actualOptions = getDownloadOptions(expectedOptions) @@ -65,7 +65,7 @@ test('getDownloadOptions overrides download timeout minutes', async () => { downloadConcurrency: 14, timeoutInMs: 20000, segmentTimeoutInMs: 3600000, - dryRun: true + lookupOnly: true } process.env.SEGMENT_DOWNLOAD_TIMEOUT_MINS = '10' const actualOptions = getDownloadOptions(expectedOptions) @@ -76,5 +76,5 @@ test('getDownloadOptions overrides download timeout minutes', async () => { ) expect(actualOptions.timeoutInMs).toEqual(expectedOptions.timeoutInMs) expect(actualOptions.segmentTimeoutInMs).toEqual(600000) - expect(actualOptions.dryRun).toEqual(expectedOptions.dryRun) + expect(actualOptions.lookupOnly).toEqual(expectedOptions.lookupOnly) }) diff --git a/packages/cache/__tests__/restoreCache.test.ts b/packages/cache/__tests__/restoreCache.test.ts index c7499dc1..7992490e 100644 --- a/packages/cache/__tests__/restoreCache.test.ts +++ b/packages/cache/__tests__/restoreCache.test.ts @@ -280,7 +280,7 @@ test('restore with cache found for restore key', async () => { test('restore with dry run', async () => { const paths = ['node_modules'] const key = 'node-test' - const options = {dryRun: true} + const options = {lookupOnly: true} const cacheEntry: ArtifactCacheEntry = { cacheKey: key, diff --git a/packages/cache/src/cache.ts b/packages/cache/src/cache.ts index d464bf96..f7fadb6f 100644 --- a/packages/cache/src/cache.ts +++ b/packages/cache/src/cache.ts @@ -100,8 +100,8 @@ export async function restoreCache( return undefined } - if (options?.dryRun) { - core.info('Dry run - skipping download') + if (options?.lookupOnly) { + core.info('Lookup only - skipping download') return cacheEntry.cacheKey } diff --git a/packages/cache/src/options.ts b/packages/cache/src/options.ts index 49101572..cdddeeca 100644 --- a/packages/cache/src/options.ts +++ b/packages/cache/src/options.ts @@ -56,12 +56,12 @@ export interface DownloadOptions { /** * Weather to skip downloading the cache entry. - * If dryRun is set to true, the restore function will only check if + * If lookupOnly is set to true, the restore function will only check if * a matching cache entry exists and return the cache key if it does. * * @default false */ - dryRun?: boolean + lookupOnly?: boolean } /** @@ -102,7 +102,7 @@ export function getDownloadOptions(copy?: DownloadOptions): DownloadOptions { downloadConcurrency: 8, timeoutInMs: 30000, segmentTimeoutInMs: 3600000, - dryRun: false + lookupOnly: false } if (copy) { @@ -122,8 +122,8 @@ export function getDownloadOptions(copy?: DownloadOptions): DownloadOptions { result.segmentTimeoutInMs = copy.segmentTimeoutInMs } - if (typeof copy.dryRun === 'boolean') { - result.dryRun = copy.dryRun + if (typeof copy.lookupOnly === 'boolean') { + result.lookupOnly = copy.lookupOnly } } const segmentDownloadTimeoutMins = @@ -143,7 +143,7 @@ export function getDownloadOptions(copy?: DownloadOptions): DownloadOptions { `Cache segment download timeout mins env var: ${process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']}` ) core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`) - core.debug(`Dry run: ${result.dryRun}`) + core.debug(`Lookup only: ${result.lookupOnly}`) return result }