-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add saveCacheV2
tests
#1879
base: main
Are you sure you want to change the base?
Add saveCacheV2
tests
#1879
Conversation
|
||
test('save with missing input should fail', async () => { | ||
const paths: string[] = [] | ||
const primaryKey = 'Linux-node-bb828da54c148048dd17899ba9fda624811cfb43' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: to be consistent with the restoreCacheV2
tests, how about we name this key
?
const key = 'node-test' |
}) | ||
|
||
test('save with large cache outputs should fail using', async () => { | ||
const filePath = 'node_modules' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: also here, maybe it's better to use paths
instead?
const paths = ['node_modules'] |
expect(createCacheEntryMock).toHaveBeenCalledTimes(1) | ||
expect(createCacheEntryMock).toHaveBeenCalledWith({ | ||
key: primaryKey, | ||
version: cacheVersion | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking out loud: are both of these necessary? Wouldn't one be sufficient?
const createCacheEntryMock = jest | ||
.spyOn(CacheServiceClientJSON.prototype, 'CreateCacheEntry') | ||
.mockReturnValue(Promise.resolve({ok: false, signedUploadUrl: ''})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I'm reading the test, I'm thinking whether it might be better to shuffle the code, try to call CreateCacheEntry
earlier and only create the archive if this call succeeds. Right now it seems we're doing a lot of work on the runner (creating the archive first) before checking whether we can create the cache entry
const filePath = 'node_modules' | ||
const primaryKey = 'Linux-node-bb828da54c148048dd17899ba9fda624811cfb43' | ||
const logWarningMock = jest.spyOn(core, 'warning') | ||
const signedUploadURL = 'https://signed-upload-url.com' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: do we want to use the same url?
const signedDownloadUrl = 'https://blob-storage.local?signed=true' |
Fixes #1879
restoreCacheV2
tests #1876, this PR adds unit tests for thesaveCacheV2
uploadCacheFile
and includes a debug message with the status returned on upload