From 1d403c2fd88438aeb755bc61ffd22630e0a3fea2 Mon Sep 17 00:00:00 2001 From: Bassem Dghaidi <568794+Link-@users.noreply.github.com> Date: Fri, 29 Nov 2024 07:36:51 -0800 Subject: [PATCH] Fix tests --- packages/cache/__tests__/saveCacheV2.test.ts | 18 +++++++++++++++--- packages/cache/src/cache.ts | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/cache/__tests__/saveCacheV2.test.ts b/packages/cache/__tests__/saveCacheV2.test.ts index 3a18272a..94a2462e 100644 --- a/packages/cache/__tests__/saveCacheV2.test.ts +++ b/packages/cache/__tests__/saveCacheV2.test.ts @@ -138,7 +138,11 @@ test('save cache fails if a signedUploadURL was not passed', async () => { const key = 'Linux-node-bb828da54c148048dd17899ba9fda624811cfb43' const cachePaths = [path.resolve(paths)] const signedUploadURL = '' - const options: UploadOptions = {useAzureSdk: true} + const options: UploadOptions = { + useAzureSdk: true, + uploadChunkSize: 64 * 1024 * 1024, + uploadConcurrency: 8 + } const createCacheEntryMock = jest .spyOn(CacheServiceClientJSON.prototype, 'CreateCacheEntry') @@ -191,7 +195,11 @@ test('finalize save cache failure', async () => { const cachePaths = [path.resolve(paths)] const logWarningMock = jest.spyOn(core, 'warning') const signedUploadURL = 'https://blob-storage.local?signed=true' - const options: UploadOptions = {useAzureSdk: true} + const options: UploadOptions = { + useAzureSdk: true, + uploadChunkSize: 64 * 1024 * 1024, + uploadConcurrency: 8 + } const createCacheEntryMock = jest .spyOn(CacheServiceClientJSON.prototype, 'CreateCacheEntry') @@ -260,7 +268,11 @@ test('save with valid inputs uploads a cache', async () => { const cachePaths = [path.resolve(paths)] const signedUploadURL = 'https://blob-storage.local?signed=true' const createTarMock = jest.spyOn(tar, 'createTar') - const options: UploadOptions = {useAzureSdk: true} + const options: UploadOptions = { + useAzureSdk: true, + uploadChunkSize: 64 * 1024 * 1024, + uploadConcurrency: 8 + } const archiveFileSize = 1024 jest diff --git a/packages/cache/src/cache.ts b/packages/cache/src/cache.ts index 139512f9..2a89d50d 100644 --- a/packages/cache/src/cache.ts +++ b/packages/cache/src/cache.ts @@ -465,7 +465,7 @@ async function saveCacheV2( // Override UploadOptions to force the use of Azure options = { ...options, - uploadChunkSize: 64 * 1024 * 1024, // 128MiB + uploadChunkSize: 64 * 1024 * 1024, // 64 MiB uploadConcurrency: 8, // 8 workers for parallel upload useAzureSdk: true }